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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , j$ Y" |, w# R$ i5 _' g& X6 F
  1. [code]EDMA sample test application
    ' n$ h6 p) b0 w+ f( r' u
  2. /*& m) I! R1 e; n1 l. \+ `; u; f
  3. * edma_test.c
    - o# X5 [+ B( ^* ^. w' h
  4. *; r6 W4 h4 Z* K
  5. * brief  EDMA3 Test Application
    3 ?* \/ Q6 P0 \5 m  \  U% ]2 e+ @
  6. *
    ' x& y" ^5 Y1 `7 H+ ?5 M( L3 ^6 U
  7. *   This file contains EDMA3 Test code.
    % e6 I4 ]4 @& ]; t4 r6 f
  8. *  y: d# W( _9 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  c& p4 r8 _0 K" O2 F1 H: Q% K( N* o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # R. r- q, s) W
  11. *         TO CHANGE.% ~  Y6 @+ u0 O- Z2 N
  12. *
    * S0 l* z) K3 [. e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 j% S* _$ U7 c, r
  14. *
    ) O; _+ w! Z# F8 j7 b
  15. * This program is free software; you can redistribute it and/or
    7 V9 |/ ]3 U0 H! H
  16. * modify it under the terms of the GNU General Public License as( k1 y; m* g% `* N' z% n; @/ O
  17. * published by the Free Software Foundation version 2.& w/ Z- |& [2 J1 K1 Z9 ]6 H
  18. *
    2 E9 j& X) ?9 j( B6 ]5 S- j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , w+ Q% W' w7 k1 B4 R
  20. * kind, whether express or implied; without even the implied warranty" X) _4 |$ R( M2 i4 x0 o) c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 F7 I* m, q8 e. u; b4 ?1 E
  22. * GNU General Public License for more details.
    ; A) t$ G6 z/ j6 m/ Y7 v& V
  23. */
      z  {# k$ f0 g& q8 G
  24. ! H% i& j& t0 [% O
  25. #include <linux/module.h>* G1 K+ d) R1 S/ U7 _( u9 S
  26. #include <linux/init.h>
    & B+ W: `1 R1 B4 ^1 C; L
  27. #include <linux/errno.h>9 E( S& o1 @: L0 P# H- K
  28. #include <linux/types.h>/ Z& p% H) X- M5 ]9 S
  29. #include <linux/interrupt.h># @, s$ i; K1 O8 w
  30. #include <asm/io.h>
    4 A; a/ u! O7 `6 R: e) U4 W
  31. #include <linux/moduleparam.h>( ]; b! K' @1 a
  32. #include <linux/sysctl.h>
    ; b- p% `( l( p2 A4 e3 v& j
  33. #include <linux/mm.h>9 ?( E8 m( K; ?. j
  34. #include <linux/dma-mapping.h>6 E  x. n* j3 |+ ?. r1 o

  35. 9 K3 t8 a- y4 e5 c8 t' O$ \
  36. #include <mach/memory.h>; Y: F, c/ h  H) M: C
  37. #include <mach/hardware.h>, v; b0 s$ `' u! P& H
  38. #include <mach/irqs.h>
    3 @, c3 P9 S& I* b
  39. #include <asm/hardware/edma.h>
    , H: L2 D0 e2 r. R
  40. 9 I( z3 k  o; W8 H8 H. D8 A: p
  41. #undef EDMA3_DEBUG% c: T+ v6 u* F: g$ w& o7 V
  42. /*#define EDMA3_DEBUG*/
    ! L/ w5 b$ ?# l# Y# n

  43. ; W( Y' z% I+ m% }' C; n
  44. #ifdef EDMA3_DEBUG1 b$ ^+ ^( l9 f, ?0 Y' [+ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 y: h9 q) x( W$ g8 m& H3 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 e* N$ L/ ?- [7 k, D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 O& g. k1 e' X/ ?" ?( Z
  48. #else
    ) @+ ?1 F& M: [0 z
  49. #define DMA_PRINTK( x... )
    4 c1 {& y" C. Z4 e4 y; H- y; \7 {' i0 h3 q
  50. #define DMA_FN_IN
    0 a1 e2 [- J5 p
  51. #define DMA_FN_OUT: {, T- ]+ ?& H9 y* H5 n: ~1 f
  52. #endif
    * [# ~+ E+ O! L8 A
  53. 8 o, X- |: `" _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! n) |4 Q, y! J; z* f9 ~
  55. #define STATIC_SHIFT                3
    $ _; l3 g! W; R( L5 F
  56. #define TCINTEN_SHIFT               20
    $ r' G% r9 v* z- Y' W4 q- Z+ F; _
  57. #define ITCINTEN_SHIFT              21+ w% L8 L/ X$ C3 `1 ?
  58. #define TCCHEN_SHIFT                22
    * v8 d6 B. u2 q" X& J1 }% C4 p
  59. #define ITCCHEN_SHIFT               232 r$ T3 K: @) Z; o; U9 y9 j
  60. 5 u) {' k: m( {
  61. static volatile int irqraised1 = 0;
    ) R0 ~9 V* l, ]8 W: P9 k
  62. static volatile int irqraised2 = 0;) f4 G2 P6 }# F8 b' c/ Y% _9 M+ O5 T
  63. , ^. x! x- L5 ^  r+ i% \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Q( ~- K; s) g4 T1 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( x1 l; d7 L3 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 J/ K/ x  f( e5 M
  67. ; J% s, E1 J3 S6 `# l
  68. dma_addr_t dmaphyssrc1 = 0;
    0 U8 @* R9 I- p* F$ I; d/ d* J7 }
  69. dma_addr_t dmaphyssrc2 = 0;/ R! h. T, q3 x5 _3 ~
  70. dma_addr_t dmaphysdest1 = 0;
    ! F" Y, {0 }8 l# K# f5 d7 a/ Z
  71. dma_addr_t dmaphysdest2 = 0;& Q2 r5 ^* j  h. K* g" i8 @; @
  72. + U+ _2 e: m( w- q$ x% F! i
  73. char *dmabufsrc1 = NULL;
    - T, G5 Q. L4 m- Q' s; a
  74. char *dmabufsrc2 = NULL;. o8 Y. F. K7 l) {+ K
  75. char *dmabufdest1 = NULL;7 r' G3 v1 G. a5 Y* ?1 W! G
  76. char *dmabufdest2 = NULL;* y" ]5 Q+ M# _8 V( j

  77. - p+ V* q. ]2 }: i1 W! P/ [7 W
  78. static int acnt = 512;- U9 W- U- A/ O9 t' R( F6 ?
  79. static int bcnt = 8;
    ' S! c" e2 l) `! p9 F
  80. static int ccnt = 8;" B  |$ I: d/ p: }% g* b5 p

  81. / C6 B3 L+ o" k! o# c/ j
  82. module_param(acnt, int, S_IRUGO);6 s3 l2 J0 p, g# U
  83. module_param(bcnt, int, S_IRUGO);1 q0 F3 q; ]  H( h" _# Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 B( z+ L  [6 I3 I7 C7 i2 h' s, J

8 }8 Z3 g  a3 {0 Z  [) }$ U7 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 K' ]! k% c# ~6 y; m0 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 R8 h& b/ F9 n7 U9 |& ~* I" p$ Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# N  h8 Q7 X1 @  [7 T' p% i

6 U' j( w0 u( @" i7 L
6 {4 H5 H  P6 F4 b" ?4 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 05:28 , Processed in 0.045467 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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