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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' f( T% B- v! w
  1. [code]EDMA sample test application
      A3 a. |) Q& E$ Q2 R
  2. /*' s4 _: M4 d( a1 U! b5 S: v
  3. * edma_test.c, a) ~$ q* N/ w' E
  4. *
    . L7 i' d) o' M, A
  5. * brief  EDMA3 Test Application; Q# j5 ~& ]5 \, a; X  v9 {
  6. *
    ! ~: {  h% g" ?1 L/ G1 p
  7. *   This file contains EDMA3 Test code.
    + }. z% }! ?& F. N6 e: J
  8. *
    : v& P4 P# i) f, \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- g, i" X+ j" P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, Y& J' v2 U5 e# E8 V. J6 v5 H& \
  11. *         TO CHANGE., Y+ x- j$ b$ L6 p  D; s
  12. *; k: f$ G! z- Q6 T0 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# l) W0 j" b+ N! \/ a
  14. *
    , f1 v& P5 s+ V% }( t3 c+ ^5 X
  15. * This program is free software; you can redistribute it and/or$ E8 u, H8 ~. S" b) x
  16. * modify it under the terms of the GNU General Public License as8 s) K$ M2 g( `# Z8 c6 T8 F9 _
  17. * published by the Free Software Foundation version 2.
    ; B* o- Y* i4 m& M) c& R7 M
  18. *
    2 E7 ]% X% f3 b0 {$ l, _5 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * k$ n) {& Q5 @
  20. * kind, whether express or implied; without even the implied warranty
    % S( f+ |' O! T0 t& O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . w( L2 n3 R. C4 O0 L
  22. * GNU General Public License for more details./ I1 T0 ~7 ]3 `
  23. */
    2 F5 T% S' v# o* A3 U) i
  24. % m) W# O( u, |; T
  25. #include <linux/module.h>; \# Z( `3 H1 a6 H8 H
  26. #include <linux/init.h>
    " |9 N; x4 O7 U
  27. #include <linux/errno.h>, V3 N6 [( a9 n' ~
  28. #include <linux/types.h>7 H: Z0 [+ O$ X! Y
  29. #include <linux/interrupt.h>
    ) O, |9 x' ~! k) E/ M7 f% f0 ]# b: H
  30. #include <asm/io.h>
    * l0 z& `# \/ F9 Y# I( `) S8 R
  31. #include <linux/moduleparam.h>
    6 ?4 X3 w, C# J& l
  32. #include <linux/sysctl.h>6 [( C8 A. V, j! N4 Z& M
  33. #include <linux/mm.h>
    $ @/ p* ]* Y5 P2 c
  34. #include <linux/dma-mapping.h>
    & q# d( _: J9 J. e7 A5 |
  35. 2 l' y. ^' p, f" Y4 a) @
  36. #include <mach/memory.h>
    0 Z2 X& N# j; ?
  37. #include <mach/hardware.h>
    . Q# I3 d1 U9 T( Q9 @: T
  38. #include <mach/irqs.h>3 s! X( A8 H- \3 s, B$ P
  39. #include <asm/hardware/edma.h>
    ) y- S/ @3 K0 b( |  S# S

  40. . P) p* K/ C( M
  41. #undef EDMA3_DEBUG+ v- `8 n: x+ Z( s2 t  v) E! @
  42. /*#define EDMA3_DEBUG*/
    $ P& D# E% n7 l, W

  43. , F6 i8 N8 J9 a' ]
  44. #ifdef EDMA3_DEBUG+ ?" R/ H' b# M7 x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! n6 j# R4 c1 L0 r2 Z) l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 U% _, I+ q! D9 L) l- Z6 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 q0 Y. k' e0 ^
  48. #else* ^. |2 `: a1 |: c! ]  m; x
  49. #define DMA_PRINTK( x... )
      e8 n/ \8 x4 P
  50. #define DMA_FN_IN3 |/ b0 D$ x& H- B/ j! B
  51. #define DMA_FN_OUT7 x9 f6 p* k' p  d2 j9 u
  52. #endif
    / b$ q7 t$ h( M. s4 o

  53. / b, V8 d' V- }* N. ?' T. L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& m4 I  m: D- ?( L: C5 P' b& t
  55. #define STATIC_SHIFT                3
    % i$ Z+ W: L# r, D
  56. #define TCINTEN_SHIFT               20
    2 g3 B8 O4 }0 {5 J
  57. #define ITCINTEN_SHIFT              21
    9 f% L1 d/ f; L
  58. #define TCCHEN_SHIFT                22
    $ }) W4 {( H5 {: O$ M/ G! p. m
  59. #define ITCCHEN_SHIFT               231 Z3 E+ i" {. f

  60.   z$ H5 Y4 X$ z' I0 H0 E( A9 y: ^, D
  61. static volatile int irqraised1 = 0;
    - f. ?/ d% V/ d- M3 |# J& i+ n, a
  62. static volatile int irqraised2 = 0;
    # q) S8 _3 v! D7 o1 [" a" P$ Y

  63. : m' i+ }8 l) J4 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g# k/ `& _7 \. A$ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) n) Z2 s& V3 k7 L2 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ^- p! }" _; F' c

  67. ' v5 ]* y0 }; F% a& T$ Z
  68. dma_addr_t dmaphyssrc1 = 0;& e+ S& B" ^4 R, b% H
  69. dma_addr_t dmaphyssrc2 = 0;/ R0 P& A3 v7 O$ I  e& p
  70. dma_addr_t dmaphysdest1 = 0;8 L* O  I6 u  T* n* f: o9 e
  71. dma_addr_t dmaphysdest2 = 0;, ?" Z: O% f' t; ^: A
  72. % K/ O& J2 R+ e/ r
  73. char *dmabufsrc1 = NULL;% v9 x! N( p7 T
  74. char *dmabufsrc2 = NULL;( d% ?/ U* |" @% }
  75. char *dmabufdest1 = NULL;: v# k2 I/ @5 ?* _# b1 C5 g
  76. char *dmabufdest2 = NULL;
    / Q* G  j. @, f1 u( G+ O; h/ s

  77. " @& p9 L1 q7 B: N
  78. static int acnt = 512;) ?# n5 r4 p+ k- ?8 z' Z/ c
  79. static int bcnt = 8;
    2 }" E' h% x# i0 k. l7 G# I1 L3 |
  80. static int ccnt = 8;
    / o, T1 q8 A  q" \/ @( q# z3 F
  81. . c2 c" e, G% H6 m; N
  82. module_param(acnt, int, S_IRUGO);* s, v# }( [" y# x8 ~* H  x- m
  83. module_param(bcnt, int, S_IRUGO);
    2 [0 Q" U: X" q( c/ s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, e. b, h' z3 O# K" v
6 b' f* [: B0 f; c0 [0 s! F3 G) \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ l  a9 c' S% [# }8 [/ l9 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 k6 T/ C+ R+ e' \* M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ A2 _* p) v4 ^8 |) I& r( x4 L6 O/ y- q/ }; J) N

' N% K' L$ c* O* I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 13:56 , Processed in 0.036969 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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