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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; s2 t5 a0 w; t0 L8 X' i1 G5 W8 Q
  1. [code]EDMA sample test application
    6 z( a) n1 u0 F/ ~' k2 N0 Y
  2. /*! j1 v5 Q- e, d
  3. * edma_test.c
      a) `- A; f' i
  4. *
    2 Z& Q; l0 {' }* h/ a2 f1 T5 o
  5. * brief  EDMA3 Test Application
    2 s* M2 l! n) @( C" Y8 p
  6. *+ g6 f6 q4 p! @. s8 q  I
  7. *   This file contains EDMA3 Test code.
    " ]4 a0 H( M$ C$ H; N& @* |0 R( n
  8. *
    1 o( r, R& `8 Y; h0 E* U/ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. h. A; P4 H3 N8 ?+ K. t, t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& d: p$ A! S0 E2 k" T1 o
  11. *         TO CHANGE." q  n* U+ T  }4 `0 z. o* B
  12. *3 n% \& r9 ]- p$ a0 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 Y! \) P5 x9 ~1 `5 L, n4 y* V
  14. *
    5 j9 [& C. ?0 X; P2 t. n# Z: B
  15. * This program is free software; you can redistribute it and/or
    5 L% i7 B" m' b6 O. F) I0 O# N( N
  16. * modify it under the terms of the GNU General Public License as
    % O5 v4 D7 A- a5 S& g
  17. * published by the Free Software Foundation version 2.
    7 @2 V) [$ j- n! F
  18. *
    . N0 W. \5 [3 e4 U" S/ h' W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 n  l$ {6 C$ T( g" j3 R* W
  20. * kind, whether express or implied; without even the implied warranty( E4 m( g$ q$ ~3 P( B9 _$ u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 F4 E/ Y8 N7 K( ]# Z* N
  22. * GNU General Public License for more details.; P- W  A- ]8 ^: d8 p
  23. */
    2 B2 S, B3 Z9 h5 N
  24. ; e7 `6 x% }' _7 ~- r
  25. #include <linux/module.h>
    ) W8 I! ?. j1 a" A
  26. #include <linux/init.h>
    ' l2 K; e5 N: S/ Z- @$ E% d, k! k
  27. #include <linux/errno.h>3 p" I: ^; {6 \0 w% o/ F8 c
  28. #include <linux/types.h>
    5 c! v, R( Z6 i( h
  29. #include <linux/interrupt.h>" Y7 M  l$ _# S2 L# D( I
  30. #include <asm/io.h>5 ~  U8 c. W; Q4 q! K
  31. #include <linux/moduleparam.h>+ r$ N' A8 l9 \& C% {9 E
  32. #include <linux/sysctl.h>
    % i/ {. z2 K% o4 B
  33. #include <linux/mm.h>+ x! n' x: U7 L4 z5 k
  34. #include <linux/dma-mapping.h>6 s9 Y, j5 I, L8 ~
  35. 7 q- |( S$ O- ]$ F
  36. #include <mach/memory.h>1 t4 S- Y1 |+ M
  37. #include <mach/hardware.h>
    9 `2 g0 `; u7 f2 Q. g
  38. #include <mach/irqs.h>
    1 T1 d3 {' n4 }9 B8 e" Z" |- U6 d/ y
  39. #include <asm/hardware/edma.h>
    4 h8 a$ ], w- p- k3 G
  40. 8 c  }* ~2 e3 B* y) O% L: N/ v
  41. #undef EDMA3_DEBUG
    5 R( ~. m  [! T& s/ J
  42. /*#define EDMA3_DEBUG*/
    $ H/ t+ J: G2 L

  43. " `( k' N6 A. Z8 g, ^
  44. #ifdef EDMA3_DEBUG
    : P! x; t, w5 `$ v$ \" D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* [: r: B$ x9 Y( ?2 A) b/ v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( K: u/ H1 r- [3 J5 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  j+ V( G) z& P0 T" i$ t2 r2 F
  48. #else# J7 Y; c% k6 V7 N
  49. #define DMA_PRINTK( x... )
    8 c2 q& D; O6 H" R
  50. #define DMA_FN_IN
    7 M4 v5 l1 d8 i0 }- I: ~
  51. #define DMA_FN_OUT5 G8 ?- F* o- K5 f  f5 k+ w% d
  52. #endif$ ^" x  H) S; T5 m8 _
  53. 5 b$ s; H) s' a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 ~, z. S& T4 z0 w. k: X' M! ?
  55. #define STATIC_SHIFT                3* c, P3 P: ?- e& Y& k& q
  56. #define TCINTEN_SHIFT               20
    : Z/ d6 i/ c2 O8 B# F! Q, l. h6 ^
  57. #define ITCINTEN_SHIFT              211 v9 z" D7 O# I8 B
  58. #define TCCHEN_SHIFT                22
    6 M4 p- z" E+ i; k
  59. #define ITCCHEN_SHIFT               23: D% r5 A* O% ]  X$ h  b- p

  60. + i; E0 p& P5 a0 `% m
  61. static volatile int irqraised1 = 0;  s9 I: G6 u" D3 K# e, ]) H
  62. static volatile int irqraised2 = 0;7 Y! y% q) Y1 _4 A2 Y
  63. " U- V* _' Z* W, v& ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * {. B4 W7 M8 G: M6 n( z; o0 @# L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 o. g: P9 M7 j: B" g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  T% ~0 {# m7 R1 }9 n' E

  67. , ?6 t* m0 \- e3 ^
  68. dma_addr_t dmaphyssrc1 = 0;4 p5 g' ]/ b# w6 m2 [; V
  69. dma_addr_t dmaphyssrc2 = 0;
      n  T5 m; Y5 C7 q+ x$ B! C  [
  70. dma_addr_t dmaphysdest1 = 0;
    4 v* H! H  f4 k0 _
  71. dma_addr_t dmaphysdest2 = 0;) F8 F" o0 ]2 {& S, d3 I4 @* Z. Y

  72. - e5 }& E* O  F3 A1 I' T
  73. char *dmabufsrc1 = NULL;, [- X0 f  b& c2 X# u) v
  74. char *dmabufsrc2 = NULL;' g) {3 o& M5 {/ d& J9 l$ I4 i- r
  75. char *dmabufdest1 = NULL;
    - D3 O. H9 A. ~4 o$ X# l' i
  76. char *dmabufdest2 = NULL;% a, D- Y; y+ W! E

  77. ' H8 P& j% \; U* X
  78. static int acnt = 512;
    ' Z( ]) s( ]! V( k- B9 f8 a* H
  79. static int bcnt = 8;' ~2 Y) ~% C% s& u& c
  80. static int ccnt = 8;
    6 ~0 X- W. y  a# Q9 D  L) T
  81. ; p; I' d9 q4 ]' h
  82. module_param(acnt, int, S_IRUGO);( ]6 \7 S) f* N# _
  83. module_param(bcnt, int, S_IRUGO);
    9 x% M6 q- O. r; Z/ d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ @) z% W+ _+ h4 k. j, }- Z( O2 R# x
5 ]" J% O+ B0 O; W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( R2 ~4 ]7 h" p9 c/ z4 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" u) t- z/ X4 {' T% w1 ?- i4 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Y7 I8 j  m- ?

) q! G! r% e- @& D$ u1 P8 M  s* _0 J/ M& a# i6 A: @" M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 13:41 , Processed in 0.044074 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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