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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  p' {- F( y3 k/ ?$ b9 C0 ]8 A9 b% o
  1. [code]EDMA sample test application
    9 Q) s2 C1 {1 L( I' i5 P; ]
  2. /*, i8 m, K4 Q" F7 K* }2 |- q
  3. * edma_test.c6 }/ b$ {' I. u) O& ]- A
  4. *. M8 @/ I6 _$ `3 E5 U, y3 t
  5. * brief  EDMA3 Test Application
    1 x& Z& P4 Z$ c. b( ^% {) `$ F  v
  6. *
    ) }$ G7 I& \4 A! H, X2 N: ]% U% z
  7. *   This file contains EDMA3 Test code./ r/ P$ D# ^2 A- i* a5 Z& \9 f
  8. *: I1 d2 C  q/ e7 _7 j2 Q6 a' \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: i6 v! \0 ~3 p/ g3 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% h1 ]6 s( ~8 z% k; w) y0 B  a
  11. *         TO CHANGE.
    % O$ a2 X* ^9 L. a
  12. *
      G# A0 ]" Q& k" N; O: @) l+ {2 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 e& G5 v& _9 }2 V
  14. *
    $ `) b' F8 K, ^' @1 e
  15. * This program is free software; you can redistribute it and/or. K6 _, T2 X3 l2 B
  16. * modify it under the terms of the GNU General Public License as; E  V, ?/ u9 X  K
  17. * published by the Free Software Foundation version 2.
    + w8 F  W" W3 V8 u
  18. *
    ; }) x9 a6 `3 P& i1 X( P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( v5 G+ b- M$ ~) A  d$ G2 A, E
  20. * kind, whether express or implied; without even the implied warranty
    3 B6 M# j% {( l+ v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& V3 ^0 ?) Q# Q
  22. * GNU General Public License for more details.
      m1 h: E9 ?! u7 ^  \8 Z
  23. */' i, E- ]* R# N5 j
  24. ' |/ u  A0 y- k5 I6 {
  25. #include <linux/module.h>  f7 P/ x2 D- ]$ p
  26. #include <linux/init.h>/ L0 z' i! a+ G: q6 N/ G! F
  27. #include <linux/errno.h>3 f5 l8 Q: f" M1 J2 G* r& D
  28. #include <linux/types.h>
    ) x& K. X4 z/ L1 j; M0 o
  29. #include <linux/interrupt.h>
    0 _: k+ J' ?( P  ?2 r4 w
  30. #include <asm/io.h>
    ) w% F5 g, Z. [: a; _) g( X
  31. #include <linux/moduleparam.h>
    9 K3 @7 p, i7 M( y  H4 i0 }# l
  32. #include <linux/sysctl.h>6 F, t; r: O$ T
  33. #include <linux/mm.h>. r/ }+ d1 _6 ?0 [. Z# Z6 C1 O
  34. #include <linux/dma-mapping.h>4 A9 g0 v: U* i* W# J  B
  35. ; v, J4 c- N4 ]& o. o( Y0 c; {
  36. #include <mach/memory.h>& b- a- X- D1 ]( p0 @% \, K5 V
  37. #include <mach/hardware.h>
    * ^0 [' T. p  f% W) F; b! T! L9 y6 \  [
  38. #include <mach/irqs.h>
    ( s6 a1 L. j) Y- G* T2 q, G, T9 N+ ]: C
  39. #include <asm/hardware/edma.h>7 X' N$ y+ N8 Q" x8 Z% u
  40. + z# y1 \/ E  b- r5 d1 Y3 j
  41. #undef EDMA3_DEBUG5 Z% _0 }* a' X5 ?! A. P
  42. /*#define EDMA3_DEBUG*/: y0 M9 C, ^. z  c: y2 n

  43. ; Q, Y8 x( ~# }, x% q4 j" ^
  44. #ifdef EDMA3_DEBUG
    - g# K4 O+ w% e! M' [: g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 K  s' H# M) Z1 C( A" ]' b/ V2 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 J1 n/ v( m4 B& y  T% C( t: R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / J- Y+ D+ N( s+ f7 G% ^" v8 B- @& e
  48. #else5 k4 H/ c" T- z# u1 @( E- V
  49. #define DMA_PRINTK( x... )
    % Z* D% J0 O# g* _) l, R! r- o
  50. #define DMA_FN_IN
    $ d4 E! d/ G. |. v3 z/ S$ s
  51. #define DMA_FN_OUT# A* ^" y. X- i+ |. D& j
  52. #endif
    " T6 _5 Y6 s2 {

  53. 4 H1 e2 a% u7 w% t" i/ K) q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' ^7 A# x& R, j7 H1 r* p
  55. #define STATIC_SHIFT                3% Q& i2 V9 i# }1 Q* b0 G
  56. #define TCINTEN_SHIFT               20
    ! W1 H1 e# t2 q& M6 Y5 z
  57. #define ITCINTEN_SHIFT              21& P  o1 V$ F& V' b
  58. #define TCCHEN_SHIFT                22
    & E5 ~/ Z2 @1 m* {, A- b
  59. #define ITCCHEN_SHIFT               23$ @& I/ m4 z. e: X
  60. - i1 H4 C! s; ?* i
  61. static volatile int irqraised1 = 0;. ]+ f$ z( Y( I
  62. static volatile int irqraised2 = 0;
    # f( J; a7 [( [% N" _
  63. - |* m0 j5 B) f/ g4 j" a, q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , s5 y! ?9 i9 M- |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 N0 h/ a9 E- V! d% o# ?' E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) {& m4 w% M* |0 ~0 y1 e

  67. : h4 Q2 p, r$ F/ _' ?2 |
  68. dma_addr_t dmaphyssrc1 = 0;4 ]; C& R' ^# x2 s! u  D- B2 @
  69. dma_addr_t dmaphyssrc2 = 0;
    2 g% O! f, O4 I- p
  70. dma_addr_t dmaphysdest1 = 0;& `9 E- D6 z5 Q# K, ~& z+ N
  71. dma_addr_t dmaphysdest2 = 0;
    6 i8 N) |8 v3 s) S; r+ Y

  72. . K6 K9 f1 y6 b" S" s
  73. char *dmabufsrc1 = NULL;2 D" U) p) S+ X! b; R
  74. char *dmabufsrc2 = NULL;9 l0 p. _9 H4 O, Z
  75. char *dmabufdest1 = NULL;, s/ u7 b% B- r$ |0 f! W  U2 y* M
  76. char *dmabufdest2 = NULL;  G$ n2 A1 o1 ^  i) l: N
  77. ' D6 A( q9 j' N2 v. j* H0 Y: [
  78. static int acnt = 512;, F" o9 ]+ c0 }% o
  79. static int bcnt = 8;' g1 E; x* ?+ B' G0 q9 }! x% E
  80. static int ccnt = 8;" P" u8 s% b  U$ a9 `; ^8 @
  81. 6 t' o6 d6 l: c
  82. module_param(acnt, int, S_IRUGO);
    ' U* x  Z) A; N) f
  83. module_param(bcnt, int, S_IRUGO);
    4 t+ l3 d7 X. Z0 T( f/ t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# c3 v7 `0 |& b% ^7 y! e
$ y- Y& Q" @0 r3 P' D- J% D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& m9 O$ x: |; ?. b3 V, D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ S0 y; K7 F; T; G" u( ^8 u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ V- f) F! h) \6 Y8 ]
$ ~4 z+ n( h) k
. i* P# W# W4 l4 Y) h* E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 18:09 , Processed in 0.036891 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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