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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, x6 f& U; }( z0 {$ V
  1. [code]EDMA sample test application
    + [+ B) @( E/ o7 T+ U) v! Q
  2. /*" [" [# }1 x. W0 @# ?( }
  3. * edma_test.c
    / h6 p. F8 e" f7 h/ C3 }3 V0 z: e
  4. *
    , _# \: a# c! u
  5. * brief  EDMA3 Test Application% F, l  R' ~$ F' h6 v. c0 d
  6. *$ d& E. X) }% `$ t) S8 X
  7. *   This file contains EDMA3 Test code.
    4 ]: _, h" Y( v  g( x
  8. *
    . T0 Y; D+ x0 |( y1 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( E) g4 [( z8 |- T, j6 I0 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' S  _  ~# S) B- l
  11. *         TO CHANGE.
    % ^3 f$ I) [5 F; z& O6 d
  12. *5 ]- B# J, e4 ]5 D; Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" M; \% P0 i4 r, r/ a- ]
  14. *
    6 I3 q! M3 x  C" b7 w5 d  G
  15. * This program is free software; you can redistribute it and/or- f/ O) O5 y! I0 z  O& U
  16. * modify it under the terms of the GNU General Public License as6 D! l' f2 }, I; P% o/ `# g1 J' D
  17. * published by the Free Software Foundation version 2.
    & m6 X0 A4 x0 s; [7 e4 ]
  18. *
    $ D- V' a7 n3 u* @7 w3 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & B! ^$ f* u. t+ t0 x
  20. * kind, whether express or implied; without even the implied warranty
    7 w/ N+ G2 ~8 [; L( O6 W5 G' v' l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , F4 q4 G" \5 c4 T5 l
  22. * GNU General Public License for more details./ c' Y. a7 s, Z6 ~* ^& O% m
  23. */: A* c. k7 d5 R0 {5 \0 e
  24. 3 G3 z; x- {9 ^" a/ h3 q. w8 {
  25. #include <linux/module.h>
    * v8 E% v" w. g+ _  O1 h
  26. #include <linux/init.h>
    ' C3 v' a% ~, @3 B
  27. #include <linux/errno.h>
    3 D/ R3 N* h4 P! S" S- e( r
  28. #include <linux/types.h>, X/ U/ R: K: E
  29. #include <linux/interrupt.h>
    $ o8 ?& s3 _6 K& v" W2 _1 ]  y
  30. #include <asm/io.h>
    , k- @  D8 X( T4 Z0 r) T1 M
  31. #include <linux/moduleparam.h>5 B, C: F1 ?9 i" d3 i" H  I
  32. #include <linux/sysctl.h>7 s. h) B* Z( M+ h$ ^
  33. #include <linux/mm.h>
    ' w' ?, J0 P. g5 R. N8 |6 C
  34. #include <linux/dma-mapping.h>
    & A+ N) f/ N% |& L4 x5 P1 ^& m

  35.   g$ Y# f, [* G" W$ G: ?" H
  36. #include <mach/memory.h>
      w2 l' N0 z) L
  37. #include <mach/hardware.h>) V& R6 E7 \% @* b8 s4 e
  38. #include <mach/irqs.h>+ ]( R( w7 G4 G4 q; T3 M5 _( M! f
  39. #include <asm/hardware/edma.h>- E4 V& T) f4 Q$ h' R$ z

  40. ! ^' F% Y6 ], s' e
  41. #undef EDMA3_DEBUG
    2 ~7 f0 l' @; c6 g# m5 V
  42. /*#define EDMA3_DEBUG*/( K% _- |: N( {; T# t# R- d
  43.   ^5 T5 U3 j& x- f
  44. #ifdef EDMA3_DEBUG
    ) W5 |- B0 A. N. \) J$ y( r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 l9 n5 j% V+ w9 g' r- }+ x3 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & F' X; l# C7 z: m5 I+ I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* X6 n6 B5 o' ^& e
  48. #else
    9 N+ U5 M' ^( S* z* Q' |/ f2 ]
  49. #define DMA_PRINTK( x... )
    2 C" [5 W8 o( b) M- n: w; r' h7 E
  50. #define DMA_FN_IN
    ' g. e1 h& a# w4 k, @) x
  51. #define DMA_FN_OUT
    0 B6 G4 d& t& l+ I3 Y5 t0 e
  52. #endif
    / x) Q: F( h& s+ ~* r

  53. # Y4 F. B9 x  x5 ?% h7 n9 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' Q: W  k2 s  ]8 Q- }8 w
  55. #define STATIC_SHIFT                3
    1 p: h+ A7 {: l( j- s( T' Y) C9 F
  56. #define TCINTEN_SHIFT               20
    " C( m+ Z* O% |
  57. #define ITCINTEN_SHIFT              21
    0 B$ f5 j9 J% @4 y! K. O3 H: o: R
  58. #define TCCHEN_SHIFT                22
    8 l  \7 g9 v' k& s
  59. #define ITCCHEN_SHIFT               23. `+ d# ]* Q7 d4 u* Z
  60. 4 v: \! q. }8 G' @0 N
  61. static volatile int irqraised1 = 0;
    1 [( `5 A: `+ h2 i( m! C
  62. static volatile int irqraised2 = 0;
    9 Z  ]2 B7 u* P# g; l' ]

  63. & k* a( r2 E; a7 `/ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 {; a; G9 n' n0 C4 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ]5 N+ q1 F( I% Y. _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 b& Y$ \3 p/ A( I) v/ N8 y

  67. 7 r3 n' u4 H5 P1 X  D
  68. dma_addr_t dmaphyssrc1 = 0;
    & J$ K4 M# l5 j9 `7 L7 f4 \
  69. dma_addr_t dmaphyssrc2 = 0;
    & W/ Z. ~# z6 d; M8 `
  70. dma_addr_t dmaphysdest1 = 0;! l6 Y  c8 w: z: ]  ]
  71. dma_addr_t dmaphysdest2 = 0;/ k4 q* J- l8 L( y3 U

  72. ! V$ O5 t3 `+ r
  73. char *dmabufsrc1 = NULL;
    7 x" v: h9 ?  }
  74. char *dmabufsrc2 = NULL;
    ( {/ X7 y+ W3 }2 ^* [
  75. char *dmabufdest1 = NULL;
    + r- J: [- w$ `1 \, N' m
  76. char *dmabufdest2 = NULL;/ K- ~' C. J) i
  77. " w. N8 C) l& O$ N/ O! G4 ?% {
  78. static int acnt = 512;
    2 e: S$ T6 V' I2 l' {% O; d9 P
  79. static int bcnt = 8;
    . Q8 ]  Z: T3 h9 N1 n1 K7 M
  80. static int ccnt = 8;8 J, J6 `. A5 S9 \' J+ ], x

  81. : ?! @' W9 F# u: `
  82. module_param(acnt, int, S_IRUGO);- z& \4 y# \/ ]
  83. module_param(bcnt, int, S_IRUGO);
    + h$ G/ v* l& A( e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  }, n/ e3 ?7 w+ P; d2 t. o$ e6 V0 j
2 Y& M, t) h0 T4 b3 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* ]! B5 A* p" u3 ~  ~" x& narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ m: |$ E% u/ t' m# g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) |9 f( Z& g7 r; l$ G) v$ X3 I7 m& ^  r. N+ k& V4 G5 Q( i. ?: o4 l; x& q
. d1 r) r  ^, D6 x' f8 ]& F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-19 09:49 , Processed in 0.043962 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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