OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# T* E2 x% o5 }5 R1 S  S
  1. [code]EDMA sample test application
    + w9 }* r3 ~% V8 y
  2. /*: K" j. A/ I2 w7 }/ w$ K' V- h( q3 u3 h) _
  3. * edma_test.c
    & y- j8 O3 P0 T% w
  4. *% T1 ?  F. I) S7 L5 i
  5. * brief  EDMA3 Test Application
    ' u% a8 ^$ w; h. D% S- t; d
  6. *
    / v; Q" a( L' P* _
  7. *   This file contains EDMA3 Test code.
    2 h- V7 e. T: R' \" F
  8. *
    7 P) X# q% B! F& o- `* F  o/ v* |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 V* b" T$ |# G8 O/ G, k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      }* H! n9 I; q6 l# A
  11. *         TO CHANGE.
    ( P: Z2 @4 s3 O0 u
  12. *
    # P; h, l( R. x& W, z/ g0 U: X* ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: {$ u/ R- m4 G( o8 r  O: c
  14. *
    " c9 w8 ]* |8 x" W/ p8 ?
  15. * This program is free software; you can redistribute it and/or% m/ P$ d. W( @* b+ B  V) B
  16. * modify it under the terms of the GNU General Public License as$ `) a- w6 n( i$ e- W8 y. v
  17. * published by the Free Software Foundation version 2.. R- |8 i' G" Y' W; i" T! N
  18. *4 }7 N! U" e9 m* C) y% E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) N1 }2 b" E+ f/ n
  20. * kind, whether express or implied; without even the implied warranty
    3 `  h% Q" d/ k+ }4 [- F) _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; v" ^* n/ e' A# V. o$ E: y  D
  22. * GNU General Public License for more details.
    8 {2 A& z. U* }* e* @! D
  23. */( q6 J  X+ @7 E# Z

  24. 9 H; K9 }% k' b1 }
  25. #include <linux/module.h>
    . G0 P& Z+ C2 r* |1 V
  26. #include <linux/init.h>
    ) A' `$ o* O& x
  27. #include <linux/errno.h>
    / w$ v. w8 a, L- |+ Y& j
  28. #include <linux/types.h>. t/ g9 r* d& N! k* l
  29. #include <linux/interrupt.h>" Y: l; L1 z: q
  30. #include <asm/io.h>
    ' {) m3 V& {# K8 T; }5 T0 U9 p. ~
  31. #include <linux/moduleparam.h>
    8 U2 e4 x7 V6 C" N0 D
  32. #include <linux/sysctl.h>( r; j7 M# U; {+ I% o
  33. #include <linux/mm.h># n$ b5 ~8 l) e8 O/ G4 Z5 F& R- U/ u, U
  34. #include <linux/dma-mapping.h>
    3 V6 n2 l% _0 c  [
  35. " s/ c" ~" ]! y0 V; m, ]0 }+ ^
  36. #include <mach/memory.h>* ]7 X" u2 g$ O
  37. #include <mach/hardware.h>
    " ]9 v4 Y; G, K
  38. #include <mach/irqs.h>6 H3 e$ A# G7 p" ^
  39. #include <asm/hardware/edma.h>& A+ x" X; B, V! ]9 ]$ Y
  40.   d5 f4 i4 @# ^' q0 _. u: m8 Q2 M
  41. #undef EDMA3_DEBUG$ c7 q# c2 b  ^* @3 Q! A: ~5 F
  42. /*#define EDMA3_DEBUG*/
    . _4 L  i7 g5 [4 @+ p3 S. {9 J

  43. ; I6 l: M3 U6 O* W% m9 r) t9 I  n
  44. #ifdef EDMA3_DEBUG/ ~4 C  o% _0 f- @. S/ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - i! j4 L5 {) Y- o/ a9 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 n+ b( l9 h# O8 D3 W, s: @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 H4 z4 ~  y1 E5 D% I
  48. #else
    : Y( W/ m; A2 z$ z0 K
  49. #define DMA_PRINTK( x... ); T0 N9 `& V2 A
  50. #define DMA_FN_IN
    * s8 r5 C6 R3 C* m. n
  51. #define DMA_FN_OUT
    ( B5 u- ~$ x9 x- I$ t- l/ z
  52. #endif; t  O0 r) ]& Y; C. O; x% w
  53. - d- G0 Q7 C' f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), K& Y5 L, ]6 H, ]
  55. #define STATIC_SHIFT                3' I# u  {! P' B) V3 y, g
  56. #define TCINTEN_SHIFT               20
    8 y$ A5 s: A( E" L$ O
  57. #define ITCINTEN_SHIFT              21
    . E2 ~" {1 l0 |3 ~% H$ }5 x4 r# j
  58. #define TCCHEN_SHIFT                22
    * \# N+ h1 J; t- d( X. b! v6 G
  59. #define ITCCHEN_SHIFT               23  M! q% i, Y, J4 x5 L, E6 d* U
  60. 2 ?( a- p, g' E6 o3 P7 u
  61. static volatile int irqraised1 = 0;
    / R. j1 P0 m' q% [' D& ]
  62. static volatile int irqraised2 = 0;" L& I0 D- C; \7 D. S1 }6 |

  63. 5 T9 C# C) F: f4 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. B5 e" L% J+ J2 V( \* @8 E6 |/ G6 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 q% p3 t( A- m! [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ u% _5 E7 Y9 F: C7 j: w5 p! b

  67. - ~" C5 F' ?9 q0 w
  68. dma_addr_t dmaphyssrc1 = 0;
    * _0 n& G/ }8 n
  69. dma_addr_t dmaphyssrc2 = 0;& j$ O! L  C, D: h
  70. dma_addr_t dmaphysdest1 = 0;0 ]# N6 t9 N* w$ F3 a& P$ A8 s5 f8 J
  71. dma_addr_t dmaphysdest2 = 0;
    7 X' ^3 k. Q8 n1 U% a$ P  y; ^

  72. ( O4 \! `5 a2 \/ [! O& }' v( \
  73. char *dmabufsrc1 = NULL;
    4 N# W8 c3 V2 W  ]3 O
  74. char *dmabufsrc2 = NULL;
    & [$ Y3 E4 m4 l- n% d- }* e
  75. char *dmabufdest1 = NULL;* K+ K7 D) i1 ~5 K! S% r7 T+ o' |
  76. char *dmabufdest2 = NULL;
    9 R9 W$ D; j  F2 s2 b

  77. + B% z" P* U) V% f1 U
  78. static int acnt = 512;
    $ q3 o, [- Q6 X3 G5 U5 I
  79. static int bcnt = 8;
    + y' H+ S4 D0 w8 Q
  80. static int ccnt = 8;& c" D* \4 u6 q8 A; a3 m: ^& c$ p

  81. 1 M* A% _% t: U1 r8 j9 s9 B$ v, l
  82. module_param(acnt, int, S_IRUGO);
    " |& Z- e5 M  o
  83. module_param(bcnt, int, S_IRUGO);1 r6 Y% L' S/ B9 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! m' i/ x, F7 p, B8 ?

1 A7 j4 H  O! P: K2 p- x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 l$ C4 v& S: t. b! [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. U: p3 z$ Z7 s  {! D: x, S( |5 l- m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 ?5 [; D+ i% p0 R- [2 w" p6 d
! s: b9 i- Y7 G9 P
6 ?3 h- [5 L0 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-12 22:08 , Processed in 0.077461 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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