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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / p" z9 t& {9 m. _1 ^
  1. [code]EDMA sample test application" w, z7 p* q: ~/ a3 I1 V% [+ y
  2. /*
    1 n6 [! Y4 Q4 {& o" m! n3 j
  3. * edma_test.c
    . o+ K& w% o( X: [0 o, _# t
  4. *6 I: S; u* Q" I' c
  5. * brief  EDMA3 Test Application. w) e, P  P3 M" [
  6. *- T2 ?4 V2 f! o5 V- W) b6 Y, z- n
  7. *   This file contains EDMA3 Test code.
    $ g( m" ?0 \  m8 y8 k' Z' U
  8. *8 C+ {& ?5 b, V- e5 W; X( `( K& M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 y6 u- G0 ]( l( @& J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: X' |# h& q- P3 i+ j  A
  11. *         TO CHANGE./ |) r0 u* o% P
  12. *: ?& _* @3 _3 a, G4 ^- E$ N" C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- Y9 ^& Z9 s1 O1 F2 X# x
  14. *. B. t9 d: ?; C- ~% ]0 r6 J6 ~
  15. * This program is free software; you can redistribute it and/or
    0 y+ M; {6 D9 {2 l4 g
  16. * modify it under the terms of the GNU General Public License as
    9 |" a% f5 a$ W. P
  17. * published by the Free Software Foundation version 2.0 \+ K7 _2 Y1 H3 N6 Y4 r
  18. *
    ( m# _' A' y" S4 W" b  g: c% ]- A: ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* C, k- G) V2 V- `; x& E6 O- f. b
  20. * kind, whether express or implied; without even the implied warranty
    5 V/ C- Z' E! E" H$ t9 g& i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% O) h8 {( P, ?/ }* ^' S
  22. * GNU General Public License for more details.& l& [) H( |" i; N; o3 r3 N
  23. */* y0 J9 p1 X# S6 `, Z& r, j" g* L( `

  24. , v3 q. H4 J& _7 i, [
  25. #include <linux/module.h>* c+ p' Z9 Y" w- O3 h* @# f
  26. #include <linux/init.h>
    0 L" ~" S& J7 }5 c
  27. #include <linux/errno.h>
    1 J9 T- s, T5 ~8 n! y, \# K
  28. #include <linux/types.h>
    : R$ m4 d! d$ q5 L$ o
  29. #include <linux/interrupt.h>
    9 ~" ?, O2 M' ]
  30. #include <asm/io.h>
      z  T" T/ ?! j$ l
  31. #include <linux/moduleparam.h>9 d$ _" @- R1 Q3 @
  32. #include <linux/sysctl.h># t- G3 D5 Y  T+ M. T1 ~
  33. #include <linux/mm.h>4 c- k" p7 R" }& ]
  34. #include <linux/dma-mapping.h>
    5 g8 a: s) M8 s
  35. + }+ G% E* m% }( N! y- p
  36. #include <mach/memory.h>! ~/ ]' [' ?. g# ]. g1 t0 ?: w
  37. #include <mach/hardware.h># U2 J% o. t' z$ e0 U  h' X
  38. #include <mach/irqs.h>' {& F% v8 y' R5 o6 J% p5 k
  39. #include <asm/hardware/edma.h>
    $ d$ |6 h/ J" D" @
  40. + X% k$ U" H0 W
  41. #undef EDMA3_DEBUG9 `7 B9 @, g3 m" G0 J
  42. /*#define EDMA3_DEBUG*/
    . [6 i( B6 a! H( l9 Q* T1 h$ l. {

  43. 4 r. N: F4 u4 P+ u5 S
  44. #ifdef EDMA3_DEBUG
      o6 S2 g' ~1 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - Z& _+ e6 ^! \# Y5 h( }. j/ ^7 r1 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 G; y7 k0 L% N! n2 E+ h( C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + x/ q- ]8 L: `# m9 a0 T  t6 i2 e
  48. #else; o4 V$ l: u. G, f9 i
  49. #define DMA_PRINTK( x... )4 E0 [: ~# S% P. K0 [. s; T( a9 Q
  50. #define DMA_FN_IN
    ) \/ Q4 r( U4 L( y& W
  51. #define DMA_FN_OUT
    ! p; V/ R! r. Y5 _8 }/ j
  52. #endif
    " {: f5 b6 x( ]5 H  A

  53. 4 @' z1 P9 |; G% n8 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 W' K- C/ ^4 G% S8 s2 ~& {% u
  55. #define STATIC_SHIFT                3
    ) f5 G3 f/ w! v, L" H# n' ~
  56. #define TCINTEN_SHIFT               20
    9 P2 |) ^( V; b( w( B4 D
  57. #define ITCINTEN_SHIFT              210 t! Z9 o+ s: R3 v, \3 c* @! k
  58. #define TCCHEN_SHIFT                228 u  |, w* R8 D: ^7 O
  59. #define ITCCHEN_SHIFT               23
      [: v& D& p6 I. y
  60.   o4 J; [' u- t
  61. static volatile int irqraised1 = 0;( C. g1 `0 z0 r$ D
  62. static volatile int irqraised2 = 0;4 t  w$ O7 o2 T

  63. 8 m6 W' `" k: g! J; Q( f. f2 P; t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m$ C$ ]- l# D2 l" v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; t# Y7 ~* u+ Z" v  t, B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 F7 {* |9 F1 a3 Z* G
  67. 5 q3 B2 p2 w: B  k+ m
  68. dma_addr_t dmaphyssrc1 = 0;" A! e6 |! F% C+ S9 v
  69. dma_addr_t dmaphyssrc2 = 0;
    ( z2 ]0 j! c  l
  70. dma_addr_t dmaphysdest1 = 0;
    1 b7 ~# m1 [% o* g- {4 a
  71. dma_addr_t dmaphysdest2 = 0;% U5 f0 g$ H9 t
  72.   J9 n! g; F% q, u+ }; w5 ^
  73. char *dmabufsrc1 = NULL;
    # {, E! K" a# u9 d( |
  74. char *dmabufsrc2 = NULL;
    ; R9 z6 x. R5 C
  75. char *dmabufdest1 = NULL;
    ; H" F& C9 T& `1 L
  76. char *dmabufdest2 = NULL;( {: q# e7 C7 R9 D% ^

  77. + p$ C( r3 K9 ?$ K+ S. A' }
  78. static int acnt = 512;. i$ Q. o5 T0 N1 B( r/ o3 G0 A
  79. static int bcnt = 8;) N$ r! X5 ?7 D5 c
  80. static int ccnt = 8;3 o" U/ E$ Y7 \, I. F* l% g

  81. ( q% i; M- S$ M( }0 r" C7 j5 p
  82. module_param(acnt, int, S_IRUGO);* T3 Q( A; E" v3 b
  83. module_param(bcnt, int, S_IRUGO);& e8 A- I. l: S5 j% x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 v3 h! h; ^+ y+ O5 i* ~
3 Y" y. d) K, v8 J* [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 P  C/ l' F, ^' f/ oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' l- p& [- t$ d$ o! R  \( M5 s" m" m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 h5 t6 S- w. c3 w9 [! k/ t3 \/ ~9 ~' a' h- f

4 S- g$ L# T  ]" g# q% e: z8 q/ x, U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 06:12 , Processed in 0.041067 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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