OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 5460|回复: 0

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
发表于 2018-1-30 11:01:43 | 显示全部楼层 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / y9 X9 B7 v3 n9 p+ z
  1. [code]EDMA sample test application
    ) O9 p3 s& r. I+ h& z% i  q* l2 K
  2. /*4 P( c3 w3 z: t8 j
  3. * edma_test.c
    ; {$ e( d- Y( l; f; a  _
  4. *8 p& p% M9 K* i0 u
  5. * brief  EDMA3 Test Application
    0 ~3 U- W" [/ @/ r
  6. *" f& s+ ]% a/ I6 U$ u
  7. *   This file contains EDMA3 Test code.
    $ n% N2 f2 Z# A9 O2 x1 w: ~! g
  8. *6 o) d8 k, q; g% `, F  u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 o- Q, h- o: q1 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S- X9 `2 `: K- m8 G5 V( S
  11. *         TO CHANGE.
    0 e5 p, ^/ C% q; i, t3 t0 c. d4 F* \
  12. *
    ' a8 p! l4 c8 q! p" @8 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; m2 B) c) V8 [) K8 ~" X
  14. *7 ^* z0 w& I' c; R! o2 ?0 t
  15. * This program is free software; you can redistribute it and/or% ~; P$ H. E4 c7 ~$ L0 O
  16. * modify it under the terms of the GNU General Public License as! O5 b  \- X% S6 e5 B
  17. * published by the Free Software Foundation version 2.
    1 j% ?: g& O" J. p
  18. *
    ! H4 Q# J; r7 T# R" u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % s6 @) G( K2 X3 N* K& h; ?
  20. * kind, whether express or implied; without even the implied warranty) \) b- Y! A% c: A9 k) W; F" N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Z* c" K% t2 ~- G* s2 w
  22. * GNU General Public License for more details.0 B5 E. m* Y  H: |
  23. */
    4 b1 r0 h/ E+ u' X, B! Y$ l

  24. " R. _4 `8 A$ h" v8 K5 J
  25. #include <linux/module.h>8 m& }' b7 B0 I% _; {$ [
  26. #include <linux/init.h>2 x2 l( n# |7 z% @
  27. #include <linux/errno.h>
    0 P2 w1 |2 a( e5 Q
  28. #include <linux/types.h>$ X: A8 z9 R" r# @+ \, i
  29. #include <linux/interrupt.h>
    " r. x5 g+ [2 P& n  @" \& d
  30. #include <asm/io.h>
    & n4 ~* e7 t# U8 B0 V  P. v. l
  31. #include <linux/moduleparam.h>8 _( g2 s- c1 ~
  32. #include <linux/sysctl.h>! F7 h3 c6 ~+ I' V/ q  _
  33. #include <linux/mm.h>' X: A2 h( s$ ^8 c
  34. #include <linux/dma-mapping.h>
    6 Z2 b3 {( m0 J3 t
  35. 3 m; F" n% Y, N
  36. #include <mach/memory.h>
    ' [' z# b1 |8 G: C5 \& b/ }
  37. #include <mach/hardware.h>& ^. [" v* e" H& E
  38. #include <mach/irqs.h>
    & g. |) H4 t; U) ^# p  y+ {% d) |
  39. #include <asm/hardware/edma.h>3 G( ^& E5 S* h6 Y" W8 r/ m* \1 p; i1 q

  40. * P4 Z& {7 J  y8 ~) q
  41. #undef EDMA3_DEBUG
    / v  j; _+ u5 S! o6 L; v& \
  42. /*#define EDMA3_DEBUG*/2 S7 ?  g0 q  m  }+ Z1 p
  43. 3 q9 j0 k- b0 q9 s2 \8 `
  44. #ifdef EDMA3_DEBUG. ?5 z: K3 B% W+ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  F+ |/ a% s  i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 T. @" X% T3 M7 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 k. q  d9 ~$ U# V. A% _
  48. #else
    , P- K: ~7 u7 f: y. |: B2 D1 V
  49. #define DMA_PRINTK( x... )- X. Q( V' Y+ I6 ~6 F# S: r7 ^% {4 m! E3 d
  50. #define DMA_FN_IN
    % r5 }4 E% f. {/ k- n8 a& h4 p
  51. #define DMA_FN_OUT. `5 ^4 j8 s' b# h& }
  52. #endif
    0 S2 G# J* h) v
  53. & `# ~. N5 I* n4 m+ D) D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 b. N0 X( s) Q+ a
  55. #define STATIC_SHIFT                3' \% \% o' |. z2 \' n/ c
  56. #define TCINTEN_SHIFT               20
    6 i+ A2 N" H1 {
  57. #define ITCINTEN_SHIFT              21. b1 Z4 |/ S2 D+ A
  58. #define TCCHEN_SHIFT                22, J  L* w% R1 I
  59. #define ITCCHEN_SHIFT               23# w6 G, t# j+ M
  60. * C+ n+ w+ G2 ?
  61. static volatile int irqraised1 = 0;
    0 r9 F7 b' `% x/ T6 H; Z
  62. static volatile int irqraised2 = 0;2 j, C3 i+ J; X: l1 ]

  63. ! h- _7 K& V4 B' I4 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ?% m. v; ?& P( O, F0 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 Y" ~' J9 ~4 v/ ^' w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( B* _5 a  f$ a

  67. , N" R* U7 X% H  H2 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    5 [$ f( G8 W6 a0 ]
  69. dma_addr_t dmaphyssrc2 = 0;1 ^0 K5 e1 Z2 b, n' y/ J
  70. dma_addr_t dmaphysdest1 = 0;
    4 `! U! W; O$ b. G- @3 s
  71. dma_addr_t dmaphysdest2 = 0;  R2 ~6 H, ^/ [) D! x9 q: g
  72. * T: \) i4 J0 E5 u
  73. char *dmabufsrc1 = NULL;
    8 u8 v2 L0 k; T8 D8 D( F- b
  74. char *dmabufsrc2 = NULL;
    ; |2 [* q! o0 E& n
  75. char *dmabufdest1 = NULL;8 V- ~3 Y5 Y) }. U; W
  76. char *dmabufdest2 = NULL;
    , X. L! w5 o* N  V
  77. * t! V0 D  _$ v( p9 ^
  78. static int acnt = 512;
    6 Q2 C! k2 t2 a, \, x1 v
  79. static int bcnt = 8;
    5 Q/ ~1 Z6 B$ Z! Z
  80. static int ccnt = 8;
    5 r: Z' i: T2 C

  81. " s6 A4 |, ?7 w5 j
  82. module_param(acnt, int, S_IRUGO);
    ; P) H3 V) e- |; f1 v
  83. module_param(bcnt, int, S_IRUGO);" d) w, E) E7 O" i7 o2 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 K, `$ O5 f5 Z, Y7 |

, A8 j- i% A& P2 R& Z4 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  G" X3 s- E3 ?/ s+ j4 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# P8 E* D+ q  f1 |. a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. D1 c; X7 A6 M1 ~( A; E) ?: i

7 b1 {* z; r/ V4 f0 e5 u
5 ^* W5 a2 u* R  ~. S
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-3-29 03:12 , Processed in 0.036079 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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