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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f9 }3 X; |3 R( ^4 Z2 s; |8 N: S1 h
  1. [code]EDMA sample test application
    9 S3 D$ j2 T8 t
  2. /*6 I) s$ _# p* L7 i0 s% h" X0 N
  3. * edma_test.c
    5 I* `; v3 e3 M- y5 S$ ]
  4. *, \1 q3 c. o3 ~+ ~" q* d  z; p
  5. * brief  EDMA3 Test Application
    $ T% C$ p4 d1 {1 M5 t9 u. s
  6. *
    3 f& v: y$ C. g1 B% h0 ?- u
  7. *   This file contains EDMA3 Test code.' k  L% w; _3 D
  8. *9 h* t+ G/ b# W2 v( N; O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 [- G4 m2 \3 Z3 E) N3 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 S5 ]: U' t0 G/ C: j% t8 ?7 t7 ~2 z
  11. *         TO CHANGE.
    " N* D- o. d5 M3 s# S9 _
  12. *
    : C4 P1 P% H  e/ }5 y( G0 N# k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// {$ `4 ]2 M, I" d( D, r
  14. *
    ( X5 u! a8 S  |" p( Q" p
  15. * This program is free software; you can redistribute it and/or  N" X/ a9 f* e, {; g. C5 ?
  16. * modify it under the terms of the GNU General Public License as
    3 [' V% ]0 E- Q# P
  17. * published by the Free Software Foundation version 2.
    8 E7 n5 L4 H" l# g
  18. *
    + S. w) J; R1 F: R$ ]2 o6 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ R- X: f5 \1 n/ ~
  20. * kind, whether express or implied; without even the implied warranty
    # D. r1 n, h5 ?5 {( I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 g% Z( T7 j3 Y5 Q
  22. * GNU General Public License for more details.
    ) v9 F; d+ a! K/ u& E. P9 D
  23. */
    / |7 o/ T9 a( D8 v0 v

  24. . R& x6 v+ z2 L& r  y/ B( V
  25. #include <linux/module.h>
    4 Y5 |9 g, |2 c
  26. #include <linux/init.h>
    1 [8 y% b& w' @: }
  27. #include <linux/errno.h>$ ~9 o: h  Z" K* g2 e
  28. #include <linux/types.h>2 Q$ O/ Q5 l+ T% x! h% L
  29. #include <linux/interrupt.h>
    . u7 L- K- c# U! Y
  30. #include <asm/io.h>
    2 H/ l0 O( `! s$ B7 C
  31. #include <linux/moduleparam.h>
    9 j' U- o2 ^* H3 V
  32. #include <linux/sysctl.h>
    6 c5 V$ D8 S% v
  33. #include <linux/mm.h>; N1 r" r4 w; U! B1 s0 ?
  34. #include <linux/dma-mapping.h>% J; W+ l% _/ B3 E
  35. * m' F. `: z4 c9 `. T7 _$ P
  36. #include <mach/memory.h>
    5 E$ `3 g2 W; I: H  P
  37. #include <mach/hardware.h>
    / g- ~' N, l% R4 ?. L
  38. #include <mach/irqs.h>8 V  d0 O! d: k! g
  39. #include <asm/hardware/edma.h>( ?+ {& w1 o, \9 s7 T

  40. ; ]: n- a" g8 r( s) b
  41. #undef EDMA3_DEBUG* d5 p+ U3 N/ w1 W" |/ w( {' Z
  42. /*#define EDMA3_DEBUG*/) z# Q- k5 {: q: J5 j" [2 v
  43. - F; j+ F# r0 O# M* t$ T
  44. #ifdef EDMA3_DEBUG, U* [- Y' a' a. N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 |7 ^% l8 M/ q; `8 C' y8 L" a' s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). O" q) G3 `0 ?; e* I1 y6 n5 u/ |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' m8 r/ }& n; g0 M+ {
  48. #else+ S3 |7 B$ V1 w7 V0 h
  49. #define DMA_PRINTK( x... )
    - ]& |3 q8 N1 c
  50. #define DMA_FN_IN: L$ L" s0 m8 X: G) w/ f/ d6 M
  51. #define DMA_FN_OUT& R6 N, M: i1 r7 u
  52. #endif
    . y9 ^, F6 o) m7 u. \

  53. ( n2 \5 \; Z" Q2 \# p2 B# H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . r3 L8 \. }+ K% T2 [* ?/ x
  55. #define STATIC_SHIFT                30 k. K+ L, l. H; c6 X
  56. #define TCINTEN_SHIFT               20
    # ^) S3 I8 x- G& ^& U
  57. #define ITCINTEN_SHIFT              21, l! w9 z) q6 P& \9 f
  58. #define TCCHEN_SHIFT                22) G& Q+ Q7 b5 b: ^. W1 j& z
  59. #define ITCCHEN_SHIFT               232 K& X' p' [: t1 n
  60. . Z$ [6 n% H' _4 L. m3 q# C2 y  ~3 v
  61. static volatile int irqraised1 = 0;
    ) c/ D2 T+ W0 ^5 r9 I5 m; \
  62. static volatile int irqraised2 = 0;. {4 E* |% x8 z

  63. * Y! L, p; E1 o8 }- w- B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 d6 M) p& ]" z5 n7 \3 d+ F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . g# f# f6 K; w+ U. E- {6 f0 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Z( v; c$ H0 M2 j' H  v
  67. 3 d3 u) G- y- Q7 i* ^3 a* A
  68. dma_addr_t dmaphyssrc1 = 0;" w5 k( _. @" m6 l0 N  E  Y
  69. dma_addr_t dmaphyssrc2 = 0;
    / k' \" g' n3 B  a/ w1 }
  70. dma_addr_t dmaphysdest1 = 0;  K9 c/ P7 Y7 F7 N; l
  71. dma_addr_t dmaphysdest2 = 0;
    * Q) F) c" F5 M" y
  72. / h7 Y& E, e$ F+ T/ L# K. ]
  73. char *dmabufsrc1 = NULL;
    * o1 G" ~  H  C8 U2 @& W6 n& z% S9 y
  74. char *dmabufsrc2 = NULL;2 j  z9 |# q2 K) X3 \- v  G
  75. char *dmabufdest1 = NULL;0 B' Y: P( Q6 c: J! c8 X2 Z& j
  76. char *dmabufdest2 = NULL;
    * e* Z1 l" Z  ]/ O6 g' w% F& Q
  77.   f9 q+ t/ K+ _4 k
  78. static int acnt = 512;+ C- e" X' I( _: h7 P& w9 x) s
  79. static int bcnt = 8;
    , z) R- G( {8 `
  80. static int ccnt = 8;
    * c* a. |. f% k9 D5 [4 p

  81. # h2 Z1 ^3 t( V/ `( g% A' p/ c
  82. module_param(acnt, int, S_IRUGO);1 t* ]' j" D" G5 ~7 g
  83. module_param(bcnt, int, S_IRUGO);
    7 l- l: H$ z9 f2 y3 ]1 p5 s5 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) ~2 F9 j6 [3 M9 A  G! g% _# s2 W: I, `* _2 y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  e+ M$ j8 z: Q- x+ f9 x9 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 f  P4 o  f" ]  t) X# B$ B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ h+ N, P* y& g) b$ ?4 ?2 [; _# y! h; a. w; z1 ~1 m$ H6 V- O0 b
' ]% J( F# H9 @3 d& f( L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-16 09:08 , Processed in 0.045458 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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