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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 k$ z( y& y8 N: Z
  1. [code]EDMA sample test application6 n- K) V: K+ M
  2. /*
    " m" E. ^6 X; i; p  y, F! B' P8 F
  3. * edma_test.c
    ) d) f) s6 \* u; {; j% S9 N" ?
  4. *) }4 n9 C) `1 i* y2 X+ ~6 y
  5. * brief  EDMA3 Test Application1 ^8 v& y" u1 q! u0 k) ?. o
  6. *$ L6 u* @/ ?0 L# x/ g. x
  7. *   This file contains EDMA3 Test code.
    ! D2 H; m" J/ }5 v0 \7 N. p' P
  8. *
    ) v4 Y8 \$ {$ T( _1 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 f$ H: V+ D! Z7 T$ ]( r* R/ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; a: {2 w0 Z" j( ^8 e" P8 f; }6 p
  11. *         TO CHANGE.  p3 Y& T5 i/ Q4 a3 m' r
  12. *- e5 V: I! s) A5 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# p3 q" s2 u! B! S
  14. *
    % l9 T3 M; T8 I& w5 A( q7 H- Q% ^# D
  15. * This program is free software; you can redistribute it and/or8 J3 o- u# Q7 P5 J; d. ^& u
  16. * modify it under the terms of the GNU General Public License as
    / x7 d' O* o8 ~1 {) T9 O" ?) T
  17. * published by the Free Software Foundation version 2.
    # o+ m4 D0 V2 d8 R: f2 p7 t
  18. *+ G" r& e0 |3 }. G' [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 o2 _' d1 m2 ]" Q  }2 K5 [- Q! M" Q
  20. * kind, whether express or implied; without even the implied warranty" [/ e1 b* |  u. Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 H" b8 y" L8 s: t
  22. * GNU General Public License for more details.0 Z- @/ x) k: s
  23. */
    ! J2 P8 l: D( c# W* v/ b1 P

  24. , I% G, |+ j8 A% x# B1 }
  25. #include <linux/module.h>) y; q% j5 B2 J  M1 A; t
  26. #include <linux/init.h>1 L, V; ^4 M4 K
  27. #include <linux/errno.h>1 m& D! e7 s! C7 A+ D6 c
  28. #include <linux/types.h>0 N' ~- S2 c; _  \5 a
  29. #include <linux/interrupt.h>
    $ U; N1 w; [3 i
  30. #include <asm/io.h>0 m' _5 l" P7 \/ l7 o# s
  31. #include <linux/moduleparam.h>0 n# w  ^$ a1 m" z2 u
  32. #include <linux/sysctl.h>/ ]1 C2 a$ k5 F! X2 y# T6 c
  33. #include <linux/mm.h>
    2 d8 L4 f) J. v! a$ }. Y& F3 W
  34. #include <linux/dma-mapping.h>9 U# B4 q3 t0 y$ A2 a5 q& r! r7 \

  35. 9 M0 u! @- ]) F+ @3 s
  36. #include <mach/memory.h>
    % J4 `8 T) S) m0 E2 s; U
  37. #include <mach/hardware.h>1 h/ T# \6 \7 Z; A2 e9 |
  38. #include <mach/irqs.h>: U% t3 S2 \3 \* J4 T
  39. #include <asm/hardware/edma.h>
    1 U+ D; [% c$ X/ U, X

  40. ; _2 x% C. W# ]) I9 M
  41. #undef EDMA3_DEBUG
    / \% I3 s0 c: K: A
  42. /*#define EDMA3_DEBUG*/
    3 `# W. f( O( a7 }7 y$ ?: J
  43. % N+ P) T" m2 b2 U
  44. #ifdef EDMA3_DEBUG3 J9 f9 D  O2 I/ m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): ^$ p1 K, N8 s& H( K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . l  @5 m( L0 _" I: K% a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# E- w+ ~% V9 N
  48. #else
    0 z, e2 h9 i) B1 p
  49. #define DMA_PRINTK( x... )( ~! p* z/ @* Z4 l& D) U
  50. #define DMA_FN_IN, `1 n: _+ G8 S6 d& i0 W2 E4 v" X6 |2 g
  51. #define DMA_FN_OUT
    . f9 n2 L- H) N( V) _
  52. #endif! r/ B" e- M5 M- o8 G7 N

  53. 6 V: g# u9 }2 b# _6 d4 [" W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' y, \% N& G+ s4 @1 Y$ }
  55. #define STATIC_SHIFT                3
    * }- ~1 f& g( Y4 \+ y
  56. #define TCINTEN_SHIFT               200 d2 ]- h" V) w: I! Q& T
  57. #define ITCINTEN_SHIFT              21. m. `) u2 ?+ K" W# Z
  58. #define TCCHEN_SHIFT                226 y. m% }' `$ {, H
  59. #define ITCCHEN_SHIFT               23
    6 N% {) S  L7 \3 U. B/ m
  60. ( h) G6 j  j* M' r3 M2 d
  61. static volatile int irqraised1 = 0;7 E7 r1 ~/ D! _8 y5 e  M
  62. static volatile int irqraised2 = 0;
    ! S& R# _, J. E: E

  63. ! O9 T+ Q- h' Q. Y+ e$ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: \/ E2 G% P# ~, e2 Y& T5 N  U& ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! h( M3 l& O' M3 Q2 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ]9 K2 |: X" e7 ~- j1 t& Y$ h
  67. 9 m2 ]( L; Q! O* @2 F. B
  68. dma_addr_t dmaphyssrc1 = 0;
    3 @2 e, Y* D# w: E' X
  69. dma_addr_t dmaphyssrc2 = 0;: _' e1 J5 p' h- L" n& |# Z9 b
  70. dma_addr_t dmaphysdest1 = 0;+ }& E+ x$ A1 v' m1 _2 ~
  71. dma_addr_t dmaphysdest2 = 0;1 O$ V- i% ]  E/ k$ p6 [. i
  72. % t0 u5 _( {* P' F
  73. char *dmabufsrc1 = NULL;
      S5 q+ d1 [. f( Q* F8 Y
  74. char *dmabufsrc2 = NULL;
    5 e2 B$ P/ b4 Z; ~, U) w$ o! ?
  75. char *dmabufdest1 = NULL;
    ) b' w+ Y2 M3 R
  76. char *dmabufdest2 = NULL;
    7 g$ }9 W( K2 L& x& Q' R

  77.   L/ X7 D, f. C9 \2 m0 X, i
  78. static int acnt = 512;
    ' C! e# m9 w9 k, I1 p& H7 V- V
  79. static int bcnt = 8;
    8 S# W3 S& e9 h
  80. static int ccnt = 8;
    $ h5 V  S' U" D. @% }- Y( k1 B+ M
  81. % T, }: ~5 }3 J' w1 s8 D
  82. module_param(acnt, int, S_IRUGO);3 \$ ]9 \4 a- S! m, d
  83. module_param(bcnt, int, S_IRUGO);) R# E4 B2 R0 f  Q9 n$ v6 r& s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% N0 s$ t" Q+ I8 Y2 |& F7 \. A, X0 P* T/ {* h- a* ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, G! M. M! ]3 O# t/ barm-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 z  y3 P7 `" x& V* L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" `) h* g6 z. h; _- }; Z$ w4 k% R( y/ {! @! M( b

; k2 L3 q( N' k' D* y& _1 @9 M: ~4 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 12:06 , Processed in 0.041273 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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