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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' H' ^  @+ {2 {: ~' P
  1. [code]EDMA sample test application
    9 k: h' y# }% s
  2. /*
    8 Y6 _1 {' t# O; P
  3. * edma_test.c2 @% h+ R; V5 r. ^) Z+ _
  4. *
      Y/ ~4 P; ^2 E* g, Q1 M
  5. * brief  EDMA3 Test Application
    2 X0 ]+ w; W. T* K" D
  6. *
    8 ]# i9 b. u9 b$ b
  7. *   This file contains EDMA3 Test code.0 D( l+ n) H$ o- l$ q: M$ w; V
  8. *1 E) E; L3 E' l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ?/ z) M4 |4 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' e) \! ^) l/ G0 ?  X
  11. *         TO CHANGE.% }( s- S1 ?' S) I8 V% l  q; y
  12. *
    + N" {/ h4 g) w- K! V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, ^, D5 Y; X3 a/ e
  14. *
    8 R+ G2 i. s: @' }
  15. * This program is free software; you can redistribute it and/or
    ) A  b0 c( h# W$ D1 ~0 p
  16. * modify it under the terms of the GNU General Public License as$ R1 K2 _) Q6 b8 s7 ^5 e0 R: m2 b
  17. * published by the Free Software Foundation version 2.
    2 [1 x% u0 D- w+ F
  18. *
    ) l. |" e: j5 Y4 F1 |+ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # r$ p: Y+ |0 F. m! U2 x' Y2 s3 D
  20. * kind, whether express or implied; without even the implied warranty0 i% x3 R- R8 x8 e" H. Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 H0 e% N2 Q) V2 @
  22. * GNU General Public License for more details.6 J+ Q# q* c; S6 h$ H9 Y' L/ D
  23. */7 Z: H* _6 e# ~. V+ q
  24. : S' n( \0 C% \' P' k  ~
  25. #include <linux/module.h>: k. w5 w1 W: S* I& O+ W$ G
  26. #include <linux/init.h>2 X; W+ {. a  I* ~, v# S
  27. #include <linux/errno.h>
    * h7 ^7 T4 k1 ~2 g$ n3 o
  28. #include <linux/types.h>2 h- v! _" f9 X; ^9 U
  29. #include <linux/interrupt.h>% g$ M, t) r+ {* h# _$ c2 J! F
  30. #include <asm/io.h>
    & S, ?  f3 I2 D; _0 ?
  31. #include <linux/moduleparam.h>
    & d- x/ K* |3 d. z5 @
  32. #include <linux/sysctl.h>
    ; D4 m! k% F; D! l1 o0 c1 M
  33. #include <linux/mm.h>" K4 y; I2 t1 s. F% @
  34. #include <linux/dma-mapping.h>4 u9 ?0 N+ R) e9 I
  35. 2 n6 P# Q# x! }7 S, w3 f
  36. #include <mach/memory.h>3 E: u& j7 L% |3 p
  37. #include <mach/hardware.h>8 f, L7 f% _/ J- m+ q# n' |. d- g
  38. #include <mach/irqs.h>/ y: ?% P( l3 X) t. r3 q" ]
  39. #include <asm/hardware/edma.h>5 K% ]6 \8 \. O2 @# B

  40. 9 t0 ^3 E7 p  j% h$ E2 n- _
  41. #undef EDMA3_DEBUG
    * T& L2 R; r& y# C
  42. /*#define EDMA3_DEBUG*/
    # H) h! J8 [5 w" X# ]  J2 F
  43. * j7 I3 ]" |% j' o! r4 N5 S
  44. #ifdef EDMA3_DEBUG+ `. C* [& F$ Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" j, w, `/ h6 e" ]6 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 V  U  F1 w& ^6 N0 q3 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! k0 s$ u: e# K$ h$ g
  48. #else1 S. [( J6 ]; [) p% t
  49. #define DMA_PRINTK( x... )1 \9 _9 G. W8 I) e7 r- {5 M+ M
  50. #define DMA_FN_IN
    . D3 B2 o7 n& s. U5 {
  51. #define DMA_FN_OUT
    1 N: V- K/ P5 a2 h& e# Y& e6 N0 }( c
  52. #endif6 v, P( B" [) a- c9 m3 k" r
  53. 9 H$ L% N9 U1 g1 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ^- ?* \$ ~$ T, y
  55. #define STATIC_SHIFT                3. I8 `/ l" @1 E
  56. #define TCINTEN_SHIFT               204 W/ @9 H9 \) v4 S* G
  57. #define ITCINTEN_SHIFT              21
    ( K" T7 [) T- m- S( i
  58. #define TCCHEN_SHIFT                22( \! |, {$ o$ z# u2 X# D& Y8 J
  59. #define ITCCHEN_SHIFT               23
    8 M. i  B. ]) _$ j. V

  60.   U/ S4 w3 Z  z* Q
  61. static volatile int irqraised1 = 0;* d2 }3 e0 o" D7 s! Y
  62. static volatile int irqraised2 = 0;) Z' F& H3 f# Y" t. L2 y
  63. 3 m& A5 r; N7 y. V& d) B  ?3 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" `2 m9 |& |6 ~0 W/ t- l0 k! A" h" M( \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * ]) T3 S: K+ G4 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C6 g0 M- Y5 c2 U( ^
  67. 1 C% n, t* }& @- T1 ^3 ]% g+ m
  68. dma_addr_t dmaphyssrc1 = 0;; Q) O3 U) K. m* A& F
  69. dma_addr_t dmaphyssrc2 = 0;
    % N. _/ `- V1 O, H- B
  70. dma_addr_t dmaphysdest1 = 0;/ b% S8 [# z" w4 Y! q7 p, h
  71. dma_addr_t dmaphysdest2 = 0;6 D( `* b5 n7 }& q+ K: N( {+ {
  72. 3 C- O* |; G! g4 U) U
  73. char *dmabufsrc1 = NULL;8 `  o* ~& p. y6 Y5 X( x3 ^
  74. char *dmabufsrc2 = NULL;
    - P( c8 J5 V' a7 Y" T
  75. char *dmabufdest1 = NULL;
    # ]( Q! i- B- A" F
  76. char *dmabufdest2 = NULL;
    ( s" V; B8 @$ n$ P& Z3 O
  77. 8 L  x. J  D( `# A  ^
  78. static int acnt = 512;
    8 f: M, e! d9 G- e$ l
  79. static int bcnt = 8;$ w; a6 D3 v4 j% w' _1 X7 H1 N
  80. static int ccnt = 8;- r8 D3 l$ y. [" H$ b4 W
  81. ' E  K$ a* [- e4 N
  82. module_param(acnt, int, S_IRUGO);2 r$ c2 Q$ @9 P' E$ G- G* U5 e
  83. module_param(bcnt, int, S_IRUGO);
    % N6 ?6 S, A9 o/ k2 A! q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 p* v6 s9 u& M( c) u. V
2 D/ X' Y! F$ }# h9 {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% R7 u" C; ]4 {* ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; r7 X5 R+ b; _. g4 R4 y2 R( Y1 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; p8 O& m# b* ?$ J9 Z% }& @
8 k1 Y) R  z* C2 a5 G  W! s
9 E6 w4 q! ~9 F, l9 A4 Y0 o) M) C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 17:07 , Processed in 0.038791 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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