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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( H4 U9 O) w' D0 Z8 Z$ b8 C
  1. [code]EDMA sample test application8 L4 ~3 {/ E' Y7 {, y% ^# L4 ?, K
  2. /*4 K% y1 t. k6 q/ `
  3. * edma_test.c
    7 b: _) {& V6 V: v
  4. *( |9 n6 B( P8 R& W4 }. p" E, Y
  5. * brief  EDMA3 Test Application
    1 P1 ]" y$ \% u" y! [
  6. *
    # I9 G' q9 _  i3 j+ V& y3 o# D
  7. *   This file contains EDMA3 Test code.
      J0 d  L$ K0 X+ A% F) ~; h6 \
  8. *" D- A9 C/ J7 Y9 P" ~1 a( ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & Y% m' y2 O' U/ ?/ b6 m! |% ?5 T) [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 k& c* G+ ~2 F# ~' M1 G
  11. *         TO CHANGE.# x; Z+ P/ L/ ~  D  u+ x) v
  12. *+ H; K, l7 i+ G) C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 c9 |2 p* y+ ]" ^: F- T3 y3 y! L2 `
  14. *
    0 Q8 c, Y8 U0 i8 ^5 w# x
  15. * This program is free software; you can redistribute it and/or
    " y+ {- p& \  n7 m; `
  16. * modify it under the terms of the GNU General Public License as) n  [% D* a" R/ D9 c. `7 r
  17. * published by the Free Software Foundation version 2.
    1 ?; G" C/ Y+ o/ q( N) n! k
  18. ** _, F3 v; M9 b) c3 H1 l* u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 b) d: D2 c2 T3 n( b( S" n
  20. * kind, whether express or implied; without even the implied warranty9 v- B, Q! W, V; S/ Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 {/ T! v6 K5 i' N
  22. * GNU General Public License for more details.& @. g, {! d4 l% h/ @. H
  23. */# d! p" j3 @& g8 r! u

  24. 2 {0 ~6 b9 \# h  l3 R
  25. #include <linux/module.h>
    6 Q; r8 H+ D+ ?; I
  26. #include <linux/init.h>  H& O" y& h, Z
  27. #include <linux/errno.h>
    / q2 t. Z1 K! G6 _) j
  28. #include <linux/types.h>" ], b% \# Q3 r. `+ J0 V0 V! |
  29. #include <linux/interrupt.h>3 x( H, A! ]) x# {7 [& f
  30. #include <asm/io.h>, S8 E9 O/ p5 P2 d; h
  31. #include <linux/moduleparam.h>8 z! q' s  o+ U4 P) i& t0 r
  32. #include <linux/sysctl.h>
    1 r9 R9 {* ]& O  M, G' G4 G
  33. #include <linux/mm.h>
    $ t# E: g4 V# H/ p' }9 }
  34. #include <linux/dma-mapping.h>
    % t/ i6 v% k: u. J
  35. * K. O. Z9 n  U, p8 y  E$ |
  36. #include <mach/memory.h>) E& b& u2 p, |$ t5 p
  37. #include <mach/hardware.h>
    : Z) m' `' G2 P5 \, I4 K6 _
  38. #include <mach/irqs.h>
    + y& N: A; D8 @6 v6 A
  39. #include <asm/hardware/edma.h>. ]  M* ~3 U: J/ B% p1 A- I
  40. 8 ^" |( A$ l$ B, _
  41. #undef EDMA3_DEBUG% F  P3 j9 p* B! \+ _
  42. /*#define EDMA3_DEBUG*/. _3 N8 c4 K) I5 x) M. k

  43. ' M% C4 t5 t1 @: X, L/ j0 F4 |
  44. #ifdef EDMA3_DEBUG4 ?$ D4 H$ m3 z+ `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( l3 Q- b  C4 l+ k) ^+ k" w/ [, |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! T. g; T7 D1 q1 @. j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # {2 j$ `/ d7 ]0 }
  48. #else- s2 M# D; K# \# ~
  49. #define DMA_PRINTK( x... )
    ' A. \3 Z' C1 X; h" q4 h
  50. #define DMA_FN_IN
    0 v) f  P# l2 Z- J; r, a
  51. #define DMA_FN_OUT& s6 m9 G& B( t1 N! s' t
  52. #endif
    7 s% F& @  s3 W

  53. ) e: X2 ]" p, D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) ]% N( x5 E. p+ L$ {+ q9 K
  55. #define STATIC_SHIFT                3: f4 m+ r7 {. N
  56. #define TCINTEN_SHIFT               208 t: b3 K0 X+ V+ X
  57. #define ITCINTEN_SHIFT              21% n( M' y6 Y5 c  d. @/ j/ A
  58. #define TCCHEN_SHIFT                22% m3 A+ K: T  h
  59. #define ITCCHEN_SHIFT               230 n: j6 m" W. |) }0 v3 M* E! b

  60. 5 |2 o7 S- U' l1 r
  61. static volatile int irqraised1 = 0;
    3 e' T9 ?' n) ^5 M9 h8 T' j
  62. static volatile int irqraised2 = 0;
    / @" Z0 H0 G3 m& L

  63.   I0 `6 g" ~, f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. @& T' ^9 @( a4 e& V1 n2 _6 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 O* d/ D4 X+ x' }) j$ H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . q$ ~7 _& `2 r
  67. : B# a: U+ K% p" d2 q( p, S$ h
  68. dma_addr_t dmaphyssrc1 = 0;& d8 W& o; O. R7 j7 g
  69. dma_addr_t dmaphyssrc2 = 0;
    . o2 x0 X' L. A2 H1 q
  70. dma_addr_t dmaphysdest1 = 0;# G$ V' B  m+ q+ d8 f% Z$ L; ?4 b/ u
  71. dma_addr_t dmaphysdest2 = 0;
    8 ], \! D  F$ w- M6 H
  72. ; V+ D- D, K$ H4 ~; `3 H
  73. char *dmabufsrc1 = NULL;
    6 q4 Z9 P1 R& v5 @( y$ V
  74. char *dmabufsrc2 = NULL;8 P& c% w% J" j' S. e- m
  75. char *dmabufdest1 = NULL;" i# f6 ?; ?/ Y2 E* U+ q$ S
  76. char *dmabufdest2 = NULL;8 L, {4 j4 z8 H& B5 r. y+ B
  77. / X, H: M; F) O& |0 i# g: ?+ d
  78. static int acnt = 512;3 \( i1 l+ j5 L% @! l9 F8 ~
  79. static int bcnt = 8;
    1 f% H; X# G$ V0 H; ]4 W  X
  80. static int ccnt = 8;
      [, v! H( L  c. E9 Q) L% W
  81.   K. w+ ]" b2 k7 }# {4 f2 ]0 v
  82. module_param(acnt, int, S_IRUGO);
    ) m# v, J* |5 E+ Z) x
  83. module_param(bcnt, int, S_IRUGO);( e  W. R" e) u' T: Q4 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* v1 l: y' q! n  H( U# }. N5 L' f3 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 @; w, C; Z9 F9 Z* k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 `# W* Z4 D5 Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 j; j7 o3 R" G# i0 z  u

* M5 U) W5 _) c3 h8 |0 }; ^' Q* Y- o
: A# ^1 U" o& _! }$ t5 I! D3 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-15 04:15 , Processed in 0.040706 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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