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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( x. D- u- W; U1 D3 r  ^8 A: G
  1. [code]EDMA sample test application+ L' @* ]  _; _( Y
  2. /*, E$ A% b3 R7 [1 r) D
  3. * edma_test.c, `. _" z' p! O% _
  4. *0 j) Z! H! V* b3 \0 p4 L( N& H& S4 Q
  5. * brief  EDMA3 Test Application) Z5 K9 P2 J0 r/ n+ X* Q* p
  6. *
    ; [6 r5 |& ^7 S- B1 ]4 e% B7 w% x
  7. *   This file contains EDMA3 Test code.
    2 N- A( H4 B* @' }0 s
  8. *
    " x) x$ t" @5 s7 J6 n- G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 L' y# T) Q) S0 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! W; w; m! l5 m# g' S% X7 A, _. B& ]
  11. *         TO CHANGE.3 Y- F8 ^; Y/ k* w
  12. *
    & i- l, R0 E7 S( `' ^# y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& h( U# k4 f& I6 `) _1 ^- V
  14. */ y* ?0 u$ i( ^& J) r4 e" X
  15. * This program is free software; you can redistribute it and/or
    7 q. o5 h: Y: U
  16. * modify it under the terms of the GNU General Public License as& t- k0 `4 W3 L4 f5 J9 G! B
  17. * published by the Free Software Foundation version 2./ u2 P% V* ?' ^+ M! |; C! ?
  18. *9 D) x" p8 e! D- d, J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! ?, f4 [! n! y
  20. * kind, whether express or implied; without even the implied warranty3 d, b( }3 O" z5 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 ?8 b: l0 H0 A6 X/ j: Y
  22. * GNU General Public License for more details.. f( \- Z" f* K! z
  23. */4 x1 n+ s6 V2 O3 R$ l1 {0 S

  24. 3 C4 ?9 i" D; _
  25. #include <linux/module.h>8 s7 |0 D& V8 g/ y6 ^
  26. #include <linux/init.h>
    2 x) ^; x& A, |, {
  27. #include <linux/errno.h>2 f  s- V7 B+ p% u9 k
  28. #include <linux/types.h>! f# a, m# D2 {* i/ X  A3 r+ l  f# n
  29. #include <linux/interrupt.h>
    9 S. }2 ~" @2 K, w0 n9 |7 L
  30. #include <asm/io.h>
    / x5 j+ p4 i' Z3 D! T! ~) u
  31. #include <linux/moduleparam.h>
    & K' {# f+ `% M0 F
  32. #include <linux/sysctl.h>
    3 J1 B' u$ a# H+ T$ d
  33. #include <linux/mm.h>
    0 K0 T0 d0 ~0 a& \/ z5 T0 Z
  34. #include <linux/dma-mapping.h>6 t; F* V9 M: Y
  35.   p- d' {$ t% Q& L* x+ B+ h
  36. #include <mach/memory.h>
    . }3 P6 W% n2 T6 l$ Z$ E3 j4 @2 E
  37. #include <mach/hardware.h>6 R6 O/ p- {" V8 j, L
  38. #include <mach/irqs.h>
    " W; n3 M! O) E! b" a
  39. #include <asm/hardware/edma.h>1 e' a5 I0 R& z* `* d% b
  40. ; Y% r9 [9 b5 X+ e
  41. #undef EDMA3_DEBUG  e, S/ `1 L" ~2 x
  42. /*#define EDMA3_DEBUG*/' L! G, t% x- y7 O- Z$ O. |

  43. ( q9 K* w: k, C" `/ L0 h0 O+ p
  44. #ifdef EDMA3_DEBUG
    . F5 k% F2 a" J+ L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" Q$ }; w( B( `; [& x; j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 G/ L  {- K1 G8 i3 i# B& {' r  o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 g- F7 q* e( h7 i% I7 a
  48. #else2 g& T1 D! O7 N+ y& H" H: E) a
  49. #define DMA_PRINTK( x... )$ w- V- `6 `( D' ?# c9 \" y# w
  50. #define DMA_FN_IN- b1 f8 O! |8 I7 q8 Y
  51. #define DMA_FN_OUT
    2 M$ \# A  Z1 |  ]! W; o3 v' \0 t
  52. #endif
    # Z1 _: {/ X8 [: b

  53. ( a' R+ P5 H4 b. \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ r2 t6 I  r' i3 f7 v8 M5 }$ e. p
  55. #define STATIC_SHIFT                36 J2 k0 [3 e* Z+ {) s$ [
  56. #define TCINTEN_SHIFT               20
    0 {' R! K# v5 U' J* p2 B) W* V: ^
  57. #define ITCINTEN_SHIFT              21
    3 l% J. ]* g/ A7 Z, K# u
  58. #define TCCHEN_SHIFT                22
    " v* y1 ?; ~: O; ?
  59. #define ITCCHEN_SHIFT               23& {: h* O( G. k) Z

  60. + ^* k9 w: q/ E1 s; D+ V9 R0 a0 b
  61. static volatile int irqraised1 = 0;
    8 J7 _3 z7 j2 a; j5 \
  62. static volatile int irqraised2 = 0;
    7 z% u5 o' G; w. F' w
  63. 6 ~) s! ^; F. Y, K' u# ~2 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 a6 g3 W+ a8 L2 ~; g9 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ h: H  k5 g" S% x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & a8 ~5 b* c9 Z& k, x* b3 G

  67. 8 g1 y2 U* ^) U/ ]- \" h
  68. dma_addr_t dmaphyssrc1 = 0;* e! L- J- v  Q
  69. dma_addr_t dmaphyssrc2 = 0;
    - f9 h# v3 U( |  r
  70. dma_addr_t dmaphysdest1 = 0;
    # z7 T0 {8 d# e, t: m) W
  71. dma_addr_t dmaphysdest2 = 0;
    * i% G; v* ]! F# q
  72. + o2 K, p* ?5 D# V" m$ R# w* l9 V; ^; S
  73. char *dmabufsrc1 = NULL;
    . s1 k5 f! R& K4 k
  74. char *dmabufsrc2 = NULL;
    & W1 N8 ]/ q% S3 C; ]
  75. char *dmabufdest1 = NULL;
    4 r8 J$ G9 {1 ^9 Q" ]
  76. char *dmabufdest2 = NULL;
    # q& S7 X+ j2 p- L& o
  77. 4 T  w3 @5 u, h+ q, L0 B6 d- E, h
  78. static int acnt = 512;4 f. P6 ?; r" c/ l' u
  79. static int bcnt = 8;8 j% k. n+ O- R1 k2 ~6 a2 |# o7 V
  80. static int ccnt = 8;
    ! t5 U8 @# x' z+ \9 M
  81. * E; Y8 w6 ~* ?; @; l( v6 l
  82. module_param(acnt, int, S_IRUGO);
    7 g  }. Z" f1 S$ w0 Z# c: _7 O2 u8 |
  83. module_param(bcnt, int, S_IRUGO);
    ( z8 T6 C. Y# O. e' R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; ]  |# F8 |; b2 g% \4 `& u3 W4 K
" t. b- M& r" Z( V1 p! `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" h" R/ b4 G! z! _4 X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 h6 _3 q' L5 T6 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& v6 W# M1 b* v5 X; o: R, h4 R/ z8 ]) L- A3 I  k

' m5 x% {# W! G  w2 q0 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 17:50 , Processed in 0.041039 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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