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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! I3 w5 X- t$ e. b: X
  1. [code]EDMA sample test application% B. N5 w; v. o( x9 n6 F& ?9 o
  2. /*
    9 \9 F! ]* W3 j! j* Y: V, j6 l3 g: w0 Y
  3. * edma_test.c1 ^" w- x3 q+ C% {- b1 T5 V, A- e
  4. *
    0 ?- ~1 p* K4 V: B, g. |
  5. * brief  EDMA3 Test Application  P$ s* M' M( |0 `( }- N
  6. *# J2 m; m0 h9 {3 I4 j6 T' p
  7. *   This file contains EDMA3 Test code.
    / \, {( V2 D8 k+ l. S7 a' A+ O; z( j
  8. *
    0 g; h5 Z  ?8 |1 X% H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 g, j0 t% c' H( m* u8 z9 X8 B  }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) Q* r6 d/ m5 O8 p. f1 q' s
  11. *         TO CHANGE.
    0 W  w8 Q) ^& T" i7 X( N
  12. *6 r) z, L8 F# U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 V7 J: X) V0 p8 A; ~; N
  14. *- j* I# A& s1 u6 H- |5 S0 B
  15. * This program is free software; you can redistribute it and/or, _6 U# m1 K/ r4 q* F! w2 V! V
  16. * modify it under the terms of the GNU General Public License as$ L9 [& c6 K( e# z5 y9 W
  17. * published by the Free Software Foundation version 2.
    % w% D0 }  W( ^% f) Q7 U2 T
  18. *+ b/ F  g2 ~8 v, y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 e1 U1 b3 p% |: b7 ^2 e4 M+ K
  20. * kind, whether express or implied; without even the implied warranty
    ; l, G) _* T) M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 M0 F/ O, y/ ~5 N" O
  22. * GNU General Public License for more details.% l5 f. j, ^, \! O( K9 K) \
  23. */
    + L7 l2 i$ g& U& ], X

  24. 8 v1 [/ Q8 U( a& c
  25. #include <linux/module.h>- `2 y: a$ }* m; p: T
  26. #include <linux/init.h>
    - L4 X" U( R4 U" F- T- v- H
  27. #include <linux/errno.h>
      @, `! m5 a% j2 _9 E
  28. #include <linux/types.h>
    5 D  ^: n  R0 F3 R2 l
  29. #include <linux/interrupt.h>
    8 M6 c9 O) F: D% Z
  30. #include <asm/io.h>
    , D+ I! c) ]& a, F4 m& W+ Q
  31. #include <linux/moduleparam.h>* }. j. F- r/ {- t6 B' y
  32. #include <linux/sysctl.h>& m* v+ g- k; S
  33. #include <linux/mm.h>6 _6 p1 T$ n9 q. g! g. b1 G3 q0 n
  34. #include <linux/dma-mapping.h>, C5 H6 [4 [& ^; a% y
  35. * T7 \" Q& P6 Z( [
  36. #include <mach/memory.h>' S/ @! M% `* s
  37. #include <mach/hardware.h>
    , g& F1 }4 Q" ]8 Z0 ]
  38. #include <mach/irqs.h>7 A0 H7 K+ V$ b0 {9 \3 Y, S
  39. #include <asm/hardware/edma.h>
    2 m1 D5 T. S* i0 Z$ z8 o, {% L
  40. $ M0 S* X+ a$ e, z
  41. #undef EDMA3_DEBUG! z; M' g% Y: c$ D$ m3 p" Z# X
  42. /*#define EDMA3_DEBUG*/) n0 h" c, W& O& m

  43. 2 y. s7 L. a) Q# y* Z
  44. #ifdef EDMA3_DEBUG, n$ [* R9 G/ L; J6 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* G' y5 N2 b' e0 L1 n8 X% O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- V8 D) a" j" B; b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ X2 O+ M* _/ P! c  f+ b
  48. #else
    9 f$ F4 A: E1 H, Z  e
  49. #define DMA_PRINTK( x... ): k/ d' e1 I1 d" D3 N& t" d
  50. #define DMA_FN_IN
    * e7 E6 }* o+ I' I9 t
  51. #define DMA_FN_OUT
    " `/ j. X$ \5 M8 F
  52. #endif/ D. b* d- {/ r' m( t* k% F4 D

  53. % m% x0 H: N9 w; c" i. k) v6 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 u& ?, G) T+ @3 N4 o. U* n1 f
  55. #define STATIC_SHIFT                3- w  T: f$ V, s! a% S, B
  56. #define TCINTEN_SHIFT               20
    6 r5 r: k2 M2 Z+ I  k
  57. #define ITCINTEN_SHIFT              219 W5 q( e  `& C* l' E
  58. #define TCCHEN_SHIFT                22
    ' N# t. f8 @9 |8 S  M
  59. #define ITCCHEN_SHIFT               23! _% e, _2 E: K1 |

  60. ' s3 m$ g( m( v+ x$ T
  61. static volatile int irqraised1 = 0;
    0 b7 }' ]# A  m' `% v
  62. static volatile int irqraised2 = 0;' T0 ]; I- v5 F  Y

  63. # [/ K; O" q( J8 ~% |$ h+ `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 R8 t, F1 ]5 j8 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 a& ~% `2 {" Y# x8 L- h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ^8 v2 _! Y, h: c8 ^; a* G- X
  67. % t+ o; M5 m: ~5 G; t9 B! s! Q/ B; g
  68. dma_addr_t dmaphyssrc1 = 0;6 c0 g2 T8 I/ u
  69. dma_addr_t dmaphyssrc2 = 0;
    ; n8 S7 K& |$ H/ E3 F$ d
  70. dma_addr_t dmaphysdest1 = 0;
    7 r3 H0 j* O. o7 ^8 V1 o
  71. dma_addr_t dmaphysdest2 = 0;! S9 w6 r9 Y5 C1 I2 E! O' A
  72. : I  B) b% T7 f# J7 H
  73. char *dmabufsrc1 = NULL;0 M3 s+ ]5 I7 T
  74. char *dmabufsrc2 = NULL;5 @1 N' O+ _. [( f
  75. char *dmabufdest1 = NULL;0 P; g9 }9 z  \8 N$ w1 L7 G" z
  76. char *dmabufdest2 = NULL;
    . M2 a% t" f" R" R3 P; ]: I

  77. ' t1 C8 ^- Y8 F8 v3 j/ S3 H
  78. static int acnt = 512;
    & G  Y/ ?8 O. K
  79. static int bcnt = 8;& p3 V# {/ d8 G7 r- |
  80. static int ccnt = 8;
    6 j6 k1 E, i" U  T- H" r3 ~

  81. / H3 N  k# P( |" P2 v
  82. module_param(acnt, int, S_IRUGO);
    : x+ C. J3 J4 L0 F
  83. module_param(bcnt, int, S_IRUGO);
    $ g8 M  q) w) i5 P0 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 `3 Q6 Z+ R. r1 S8 D
2 q7 [  h$ O& a0 v& g  P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 X6 D% e0 [# |* w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 g' b; f4 x+ f5 L: X9 U7 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 u8 b6 \/ n# n/ t+ \" e

  I- \& Y, ^5 ~& L  N: K: S; A  ]' f/ [6 A6 g/ p' B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 19:14 , Processed in 0.039059 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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