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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; {9 T2 t6 {2 D0 \
  1. [code]EDMA sample test application, f! J; w0 Z' c8 G" o/ k) |2 ]
  2. /*3 r* ~( s  S/ l# a6 q/ v
  3. * edma_test.c5 c( i1 w2 F5 n
  4. *" Y8 Y% L1 o8 _. ~& A. T
  5. * brief  EDMA3 Test Application
    4 }" U! D+ O. A
  6. *
    7 l( P0 F, E  ?9 I3 `# S: h! c
  7. *   This file contains EDMA3 Test code.
    + ~) c3 s/ R0 ?- H6 k9 I. W4 n; A  f
  8. *
    * F* j/ y# c. s' g& L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& j) O5 O: G  ~6 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . O- K% p: e6 K  Q; `
  11. *         TO CHANGE.- Y; E  i. J# e* B: q+ \+ P
  12. *
    1 U2 E; C/ ~& R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" }0 {" H: ~+ Q. f  R
  14. *
    , b. r% n; A6 N# F5 h
  15. * This program is free software; you can redistribute it and/or/ Q- w; Z8 q/ E4 @. I2 f* \6 P
  16. * modify it under the terms of the GNU General Public License as
    2 l$ ^3 E1 c. D
  17. * published by the Free Software Foundation version 2.1 h, L- v  b* e3 h- G( p7 W
  18. *1 Q7 R$ ]; ^2 Q6 P$ S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& F4 E( X7 v/ j! F2 M/ O" O" h
  20. * kind, whether express or implied; without even the implied warranty, T' ]' j8 Y  m# ~- }* M1 j9 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& o/ O0 L4 P8 e8 y) }
  22. * GNU General Public License for more details.
    ! |! F8 G' |/ s
  23. */7 E  q: J7 N1 Z/ ^4 E
  24. 1 ?1 M! g! ~+ q1 [& N
  25. #include <linux/module.h>
    , Y0 O2 d: J) W
  26. #include <linux/init.h>3 l! V7 x* Y6 ?% |
  27. #include <linux/errno.h>
    6 _3 a) @) ^% S2 J/ v" B7 F
  28. #include <linux/types.h>1 o# N: v$ a) ~8 V5 k
  29. #include <linux/interrupt.h>
    4 N2 K2 Z- Q, z/ ]) ]
  30. #include <asm/io.h>5 @) x; Z9 B6 I6 t2 C
  31. #include <linux/moduleparam.h>
    ) c' @1 Q+ U' p8 t3 h
  32. #include <linux/sysctl.h>
    - h( v5 j3 [/ s
  33. #include <linux/mm.h>4 d  _% d' _. n/ e
  34. #include <linux/dma-mapping.h>$ s3 q5 Q, a0 V0 i

  35. ( u' e; C7 K+ n7 O1 X' F
  36. #include <mach/memory.h>) D6 w$ D% L: J$ h. x. y3 X! P
  37. #include <mach/hardware.h>) f/ H1 ^! ]& d- d" c, B" C( Y8 X
  38. #include <mach/irqs.h>
    ; r9 y9 V8 W' ~( d& ]) [8 Z
  39. #include <asm/hardware/edma.h>
    8 j6 q' y4 M/ F; F7 o
  40. 6 H; S$ _5 g' v7 D
  41. #undef EDMA3_DEBUG
    : X7 K& g% G+ b' q
  42. /*#define EDMA3_DEBUG*/8 l5 n6 ?& t- Q* }: Y, r0 A
  43. 4 B2 B3 X" v# Q6 l; s/ _; q$ ~. T+ P
  44. #ifdef EDMA3_DEBUG. d9 Y& A: E2 x& q% L) Y8 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) Z' i: j2 L9 N* e( C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; _" Z" _1 s) m1 D2 W+ f; K# e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / F9 X' M' t9 G3 B8 c
  48. #else/ F; F& u* [; j) n; I5 i
  49. #define DMA_PRINTK( x... )  I( ~# w5 A9 L! M- u
  50. #define DMA_FN_IN
    " J4 P# T# G* j' `, s
  51. #define DMA_FN_OUT: I. ]6 O7 h  T5 r* e3 |( `9 E
  52. #endif( M8 n3 e3 i( A( H
  53. 6 P3 q* s* E6 u" }" U, s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; q& A1 R! A3 t0 z( K# a& J8 m. S
  55. #define STATIC_SHIFT                35 ^' g0 R- ~+ ^
  56. #define TCINTEN_SHIFT               200 ^$ O% u9 I; }; `  h9 j$ c7 Z3 s
  57. #define ITCINTEN_SHIFT              21
    " K7 t) J5 o7 y8 |4 t8 A/ Q! F, ]1 t7 W
  58. #define TCCHEN_SHIFT                22
    ( Q) D9 x, ~6 X8 P- Q$ F
  59. #define ITCCHEN_SHIFT               235 C" u0 c2 r/ @+ x" p4 J! N

  60. " k0 F8 F$ Y4 }& q, P
  61. static volatile int irqraised1 = 0;6 K$ w3 ~7 \2 q/ a
  62. static volatile int irqraised2 = 0;0 ~$ p! b. K' I6 u. @7 Q& p
  63. 5 f8 H" g. g+ W' x( f% {# D1 ]6 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p9 U- _0 i+ [& l, A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ D2 v) U/ T' b$ {$ B9 Y4 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / K( o# d' I4 P, Z* G' [. I) `7 g

  67. ) Z; E  c8 n' ^7 R6 x4 K1 k3 F0 F5 n
  68. dma_addr_t dmaphyssrc1 = 0;' b2 T5 d7 p, [2 E0 |+ H
  69. dma_addr_t dmaphyssrc2 = 0;7 {+ k( J' ~" a7 s( _$ T1 E
  70. dma_addr_t dmaphysdest1 = 0;, O% U- z6 ]% ^$ E. }
  71. dma_addr_t dmaphysdest2 = 0;  g& N% t. F! _  K) Q) W

  72. / l( P5 z6 o; m+ W8 a
  73. char *dmabufsrc1 = NULL;3 b7 v) p! ^. P5 d
  74. char *dmabufsrc2 = NULL;0 R  b% g1 D7 d" {) i% _9 g
  75. char *dmabufdest1 = NULL;
    4 Q" g4 T' O9 U2 I, V( d% h
  76. char *dmabufdest2 = NULL;
    9 H& ^* S1 l1 Y# Z/ I* O' }/ e! D
  77. $ H( }1 {$ i7 }# ]/ N8 D3 ?# ?
  78. static int acnt = 512;2 q9 _% e5 I$ a1 j4 T1 q
  79. static int bcnt = 8;# J; V8 f+ ?( ?- l2 h  z; h! I3 a; m
  80. static int ccnt = 8;7 T: Z$ S$ R# V9 a0 b. v/ X
  81.   O3 ~( G' e1 q
  82. module_param(acnt, int, S_IRUGO);# i' U4 A1 ^. J7 o+ Y
  83. module_param(bcnt, int, S_IRUGO);
    . P1 n6 o2 u4 h: W" y4 L3 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( ]/ b' e. E, N4 J7 a; z( K* p6 l" Q2 u  @/ d7 z& w  c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ `. f8 A+ g& k; D) `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 A5 K/ E6 [4 @0 I0 \1 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) C* {. t6 e3 Q, U2 f

7 V2 C2 y* e! }' o& u/ T* D+ R$ [! W1 q  W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-17 11:15 , Processed in 0.040288 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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