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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " r5 u+ A" O7 C/ {0 E3 G
  1. [code]EDMA sample test application8 |4 i, J2 [9 f4 R6 L0 L
  2. /*6 T' B4 k: z$ T- F- @! T1 b
  3. * edma_test.c: L& N' H9 O) c. J! m$ G5 Q- ^
  4. *# h8 e6 c1 A8 M6 J: \- W* o# w9 F
  5. * brief  EDMA3 Test Application* q; |! J2 ~1 p' p  `+ V- W
  6. *
    . W" w5 m1 R5 ~
  7. *   This file contains EDMA3 Test code.3 \  S2 q6 x  _' n2 \2 ?- O' V
  8. *+ X0 X+ w0 ^, u* B1 i* G3 c; P/ v7 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # n( E8 G  r+ A5 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 D" c# u/ ]) s0 I
  11. *         TO CHANGE.& _" m3 ^* h* ~& k
  12. *
    ( b) H  ~- i( e7 E1 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " P* a/ h% o& h  t
  14. *
    ' \$ C! c3 A; {. Y) i  O
  15. * This program is free software; you can redistribute it and/or: F+ R& p. ]* m+ {, c4 Q& s
  16. * modify it under the terms of the GNU General Public License as4 L& w5 k7 \  N' Y
  17. * published by the Free Software Foundation version 2.
    0 [4 t5 g( [8 v" i: R! j
  18. *
    4 H$ ]7 ~5 [) M7 f) L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! K& G3 N# f8 V' S; b1 c; m  {
  20. * kind, whether express or implied; without even the implied warranty
    , W# S, ~& [) M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' F3 x1 B' Y! \' K9 r
  22. * GNU General Public License for more details.
    5 B1 @# u5 }/ ?7 N8 j% g
  23. */$ g' U2 ]; Q/ `: u4 K1 ]. E

  24. # K! b1 k7 H2 L/ x. A
  25. #include <linux/module.h>/ }8 r  C5 A* |% q; j
  26. #include <linux/init.h>/ p3 B* \/ S8 w( n; B- K+ {
  27. #include <linux/errno.h>
    ' {8 e" {5 p& Q+ c
  28. #include <linux/types.h>
    7 k: P4 N5 \# ?- U5 _
  29. #include <linux/interrupt.h>
    * l4 D% c6 U" n6 h
  30. #include <asm/io.h>! {7 c/ S( t, E" L5 D' K- W
  31. #include <linux/moduleparam.h>
    - P6 f0 Y2 F! e0 U+ _+ o
  32. #include <linux/sysctl.h>- j; c. A5 j7 O5 N$ e; v
  33. #include <linux/mm.h>
    4 M3 w: k/ b4 C- p1 V' D' T
  34. #include <linux/dma-mapping.h>
    , Y, E& f+ |0 n% [) F4 w
  35. " |5 J/ a2 n9 X% c% _* \
  36. #include <mach/memory.h>
    2 W) \) ?. e7 m/ w% I6 w- R* ^
  37. #include <mach/hardware.h># r/ |* Z9 i: g( G+ v
  38. #include <mach/irqs.h>+ U, Z, ^0 u: I. S% Q
  39. #include <asm/hardware/edma.h>6 ~, x' Y9 r; ]3 b, l4 O0 D% s
  40.   {/ f, J0 W0 w( m0 e$ s% {
  41. #undef EDMA3_DEBUG' u4 ?- J! ~2 d
  42. /*#define EDMA3_DEBUG*/: ]0 N4 _# S% I- i  ^7 S, j9 E/ G

  43.   D2 D* e& ~0 j& P9 a
  44. #ifdef EDMA3_DEBUG0 N; N2 I7 i' S/ {- `3 w7 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , ]! @5 t! R9 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  y% Q5 K2 Z0 s( ^( z1 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): H$ @) C6 |7 O6 U2 K5 B6 x) G& I6 E
  48. #else0 O" z0 B2 S' |: f9 m
  49. #define DMA_PRINTK( x... )# Q# H: }' N) G6 n1 a; F- B
  50. #define DMA_FN_IN
    * X1 j& o: F+ W4 Z* W1 d
  51. #define DMA_FN_OUT
    1 G9 b5 V" K2 _- `0 t1 R$ o1 ^) F
  52. #endif
    & A4 Y, Y" A" @3 t; E. k

  53. * k, J3 F& E- M: t) \; `4 j6 z; W' u8 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ m' L5 g7 {0 W9 K8 I4 Q" J& p
  55. #define STATIC_SHIFT                3( E/ U9 @: t. E1 m8 J- S% G
  56. #define TCINTEN_SHIFT               20$ Y( O1 H  S* s' y( Y+ s$ ]" ?& d2 E5 u# d
  57. #define ITCINTEN_SHIFT              21
    ; ]% P# T2 b. ~( s# r
  58. #define TCCHEN_SHIFT                22
      F4 Z- V# ]" [. @
  59. #define ITCCHEN_SHIFT               238 z" G) a) d9 Z9 s
  60. 9 X: r8 y' m, g# i9 M
  61. static volatile int irqraised1 = 0;( j) q# g, q& e( {
  62. static volatile int irqraised2 = 0;8 l% i, R6 L, [) u: }
  63. 5 V1 W: t6 H+ {% n/ z+ B( U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & N8 B! e" w8 W! h" `! |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( p- c. @" i# _. g# G0 c' {4 R' v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 C6 h! x6 ^/ p0 h3 @8 Z
  67. * T- L& v% U2 O  O5 y$ n, X6 M
  68. dma_addr_t dmaphyssrc1 = 0;9 U5 a$ O! X" x9 {9 O
  69. dma_addr_t dmaphyssrc2 = 0;
    & _1 J- N7 O, R+ H* f7 ?- L
  70. dma_addr_t dmaphysdest1 = 0;2 Q# W9 {$ M" ~) V% c
  71. dma_addr_t dmaphysdest2 = 0;8 w* _1 V# H9 \
  72. 3 {. O2 y4 u. v2 m* c
  73. char *dmabufsrc1 = NULL;/ ], L2 ^' O$ S# ^% o
  74. char *dmabufsrc2 = NULL;  G+ J9 W  ^: y: c4 B  {' |. k
  75. char *dmabufdest1 = NULL;4 Q( \3 p% Y2 z8 ]4 m9 f  b9 H' x
  76. char *dmabufdest2 = NULL;$ A8 s4 Y$ C* O( J; _: x
  77. . F/ |1 T3 W4 F  Q
  78. static int acnt = 512;8 K5 d$ I, M8 o. x! i; z4 ]# s* U
  79. static int bcnt = 8;5 \* Q8 Q! n+ |- q
  80. static int ccnt = 8;. j1 @% Z2 w/ r' l

  81. ( _2 i+ l3 d, q9 c
  82. module_param(acnt, int, S_IRUGO);1 v! [0 P) J( E" T& u
  83. module_param(bcnt, int, S_IRUGO);
    5 w+ u0 }2 o) {  W+ b5 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ e/ ~6 j. L, M/ u8 E
; n+ {% X" B) x2 a9 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ i5 u/ G! Y9 F3 Z: O' G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ y" c' g4 m8 l- N3 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 l1 \# S5 R& A+ q& o
+ w% f: ^6 U$ r, ^

1 |' g0 ?/ c" h- ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 17:34 , Processed in 0.040536 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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