OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 13240|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - {" w3 g6 K% u, {% U
  1. [code]EDMA sample test application
    9 |% X1 Q+ d' @2 a6 z3 B3 x
  2. /*9 X3 C- b2 h& o" A8 ~
  3. * edma_test.c
    ) A  I& m; ~# _' B7 m! W- |3 ^0 y
  4. *
    . h  u( A& ]: a5 H( U# z: \4 X; V7 v
  5. * brief  EDMA3 Test Application$ `) J: N$ A9 E) w' E& l
  6. *3 r9 {, U4 G: d0 a9 {+ c3 J
  7. *   This file contains EDMA3 Test code., s, \+ z; z# c. W, W
  8. *
    ' s/ K6 w1 H0 B; V4 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 L$ o' @  ~, N3 D6 ?0 a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; n% W, `2 N+ A# w: i# l; K: J5 z
  11. *         TO CHANGE.8 B$ E8 H+ c: H) O: V, O
  12. *
    0 Y* e. ?  R5 \: ]) L+ r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 }1 a! g1 B5 \% U
  14. *6 Q. c$ F% m/ G% x5 P
  15. * This program is free software; you can redistribute it and/or9 I) Q2 {  g; \3 ~% ]6 Z( o
  16. * modify it under the terms of the GNU General Public License as
      P+ r0 f0 t  M
  17. * published by the Free Software Foundation version 2.) e  U1 A% k1 ~- y
  18. *$ i- o1 g3 s9 n+ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 P% T; d/ `* \% _8 E' u
  20. * kind, whether express or implied; without even the implied warranty
    6 U, @' {6 ~$ A' y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( w8 W9 U! N2 [0 Q) V8 s
  22. * GNU General Public License for more details.. \% y1 A: I. p0 y+ ?) ?1 V
  23. */
    $ a- ^; c. u- B. U
  24. 1 h" w+ O0 `3 `3 `, U( W, v
  25. #include <linux/module.h>
    - I, L! T1 W# g
  26. #include <linux/init.h>
      `+ l/ [; u# m7 }3 f
  27. #include <linux/errno.h>9 [& k4 S% |1 t! Z! g2 F
  28. #include <linux/types.h>
    % R: E' @4 W5 h# l6 I% `6 f# s
  29. #include <linux/interrupt.h>0 g' C# S8 P2 R8 P2 P
  30. #include <asm/io.h>
    $ [" L/ [; k9 C& A% I- g. l
  31. #include <linux/moduleparam.h>* a& U+ D3 t7 e
  32. #include <linux/sysctl.h>
    ; R: ~1 f% c% d3 w5 U2 }8 c0 _
  33. #include <linux/mm.h>
    - q5 P8 k( w, L- d
  34. #include <linux/dma-mapping.h>) B4 a8 p0 |, G

  35. % ?, x, ~( b$ _' d' G  x
  36. #include <mach/memory.h>2 F2 v  h- C; [( i( L
  37. #include <mach/hardware.h>: f/ Q7 z' E& v3 G
  38. #include <mach/irqs.h>
    4 N5 v3 U+ Y' k% |! q. ~* g3 j$ G, S* ^8 l
  39. #include <asm/hardware/edma.h>
    ( s; v0 c$ K! G+ x: R1 y% D
  40. 3 p, y2 k3 E8 O- H3 ]/ V; n
  41. #undef EDMA3_DEBUG1 y7 M" L8 g2 l0 A7 v9 h+ e
  42. /*#define EDMA3_DEBUG*/! F6 }2 M( v$ q4 c& `

  43. 0 t/ T) h9 a. ?5 |/ N* b$ G3 E% Z, g
  44. #ifdef EDMA3_DEBUG
    , U: E5 T' E! k$ V8 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- ]1 M  S& q. G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 D" C% l5 R$ u- m% ~( ]" n: ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % B6 ~8 X6 Q0 x; l
  48. #else
    $ M  x3 u8 P0 M1 e) S
  49. #define DMA_PRINTK( x... )
    2 W. w( `& A& M6 d. f0 h
  50. #define DMA_FN_IN
    4 z! ?* _: O' W- N2 X3 ~/ X
  51. #define DMA_FN_OUT
    * f- P% t: n7 R- ?: u
  52. #endif8 ]$ I) V1 f8 L5 v4 |6 A& _
  53. ' G& ~- `9 _& S1 A% Q+ B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 ?- c' s. k0 ~" g; J$ N8 m
  55. #define STATIC_SHIFT                3- Q4 X+ f; z0 K8 B  r- D& L! ~6 B' U
  56. #define TCINTEN_SHIFT               20
    ( _4 q0 c! H& d/ G# ?
  57. #define ITCINTEN_SHIFT              21
    ! I) B0 k+ h& |0 x; i9 ]7 \9 a3 j
  58. #define TCCHEN_SHIFT                22
    ) e( `1 c) M( s) E
  59. #define ITCCHEN_SHIFT               232 a$ p: {) _5 Y+ i1 Z
  60. 0 Q- U8 K( b; s( \" j
  61. static volatile int irqraised1 = 0;# T* O- z* V; H. _# v; y: n: \
  62. static volatile int irqraised2 = 0;
    - d0 C$ u1 U) m2 u- b

  63. & z6 U2 C: a( S  y( [$ Y2 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ s, `1 y; X8 M- v- W/ L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 y. ^" y) G7 K5 ]/ A' ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; p2 P) K, a- \" h  U9 ~) \% [
  67. - A/ s# g. q6 ^. m: n
  68. dma_addr_t dmaphyssrc1 = 0;" z- T+ m4 i* b
  69. dma_addr_t dmaphyssrc2 = 0;( V: f3 q. _8 j
  70. dma_addr_t dmaphysdest1 = 0;
    + H, I; e4 P- t0 v( _/ N+ u( z3 ?
  71. dma_addr_t dmaphysdest2 = 0;0 U# c# B5 ?: y) l3 f# x& x: v

  72. 4 g1 s( a+ r) x& x! B5 W
  73. char *dmabufsrc1 = NULL;1 ~! @& J8 v0 O4 Y" |3 Z. X- |1 y- n
  74. char *dmabufsrc2 = NULL;
    % b- w; M1 }0 T: R  B7 L8 c- l* e
  75. char *dmabufdest1 = NULL;+ `1 v, I( I7 k) l) F, S
  76. char *dmabufdest2 = NULL;% y) I! m: A# d9 z

  77. $ b) Z5 F' I) k5 e' S- \; F2 v
  78. static int acnt = 512;3 J$ [! ], W" \, E
  79. static int bcnt = 8;) E- E, z: t* s
  80. static int ccnt = 8;
    & ]9 n7 u0 J# E

  81. 0 i& o5 c  m( g7 @5 R
  82. module_param(acnt, int, S_IRUGO);  K) h" A9 L8 o# S4 Y# j
  83. module_param(bcnt, int, S_IRUGO);, p$ T+ A) n- `& D! ]2 C0 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 \, G$ a2 W& f4 F
" o  p" C2 b+ f; }8 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( D. u3 E, w1 T$ @2 ~1 U3 q# K
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 B. k) M, e0 a; V7 v) S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 s/ x9 W! _: {; r+ H  v2 t' ?$ R3 o# U
: g( O3 |0 ^/ J! D; s( V+ r+ U4 W6 m! N$ K( k. m  L( Z5 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-4-6 11:49 , Processed in 0.040455 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表