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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 j6 T5 K$ [2 m8 q" j$ f
  1. [code]EDMA sample test application
    + x% L) E- v9 j( N: s# l4 N
  2. /*6 {5 x) }3 ~' w& E2 H1 T
  3. * edma_test.c
    ' b/ ], D* x9 \) b( n
  4. *
    3 B1 y1 {3 e. ^9 `
  5. * brief  EDMA3 Test Application( M; I  W! S8 \6 d: Y2 [: ~  Y
  6. *, Q. x- l+ Y- L
  7. *   This file contains EDMA3 Test code.
    * f" x1 r9 V! ~6 S3 H& `0 L1 a
  8. *) h7 q. i8 V; P0 _* x. ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - u* f/ I" u( }2 C1 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " {8 T0 U# S6 s, g% l9 L
  11. *         TO CHANGE.6 K$ ~  t& e( z
  12. *
    ) A  G' B& [( [7 H6 z- Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * j9 w* _5 r4 T) o0 o
  14. *7 D0 u$ c! l: N
  15. * This program is free software; you can redistribute it and/or& D2 E/ Y1 p- }# A$ H9 {
  16. * modify it under the terms of the GNU General Public License as
    3 X4 q+ x' \) m* r0 ?
  17. * published by the Free Software Foundation version 2.2 }- n7 x; T* o8 P
  18. *9 G. c- ~2 O6 i5 c( Y, n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / [( O" d* C3 h6 [# R, t. x
  20. * kind, whether express or implied; without even the implied warranty
    + o6 \$ ~& v6 B1 w! y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # t/ S( D6 Z3 A% x: R
  22. * GNU General Public License for more details.6 q' H: y/ V3 B: |; X9 P+ N' L0 z
  23. */7 E- z6 ?- j! W0 D, B
  24. ; Z* ?' n: s& E" a  Q
  25. #include <linux/module.h>
    8 d2 P$ ^6 `% |
  26. #include <linux/init.h>
    : ^6 h+ ~' m  |9 t1 F3 p
  27. #include <linux/errno.h># f+ R: Z$ }* o8 \' L9 }
  28. #include <linux/types.h>
    ' j' s2 P  c: k: f
  29. #include <linux/interrupt.h>8 s2 ]( _( m: {& O* e6 r
  30. #include <asm/io.h>
    : q1 n+ T! f. l
  31. #include <linux/moduleparam.h>
    4 u& I+ f" m6 I
  32. #include <linux/sysctl.h>2 Q& g- ?: k1 I1 H& }: }8 @! ?& ]
  33. #include <linux/mm.h>
    ' d8 D5 X! X0 w' ~$ k4 w" D
  34. #include <linux/dma-mapping.h>
      h/ ]4 ?4 I$ y

  35. / p6 M3 W3 R( g. L
  36. #include <mach/memory.h>3 \* q0 Z6 W( M! D6 E0 |
  37. #include <mach/hardware.h>
    0 T- k% L) C' s
  38. #include <mach/irqs.h>9 A9 \3 y+ w2 v5 `
  39. #include <asm/hardware/edma.h>; P9 k- M' s) ?1 r$ B) ^
  40. ( Q8 X& C+ Q- H4 M" v
  41. #undef EDMA3_DEBUG
    & |; p$ `4 ?+ n- M& I
  42. /*#define EDMA3_DEBUG*/
    % K0 }) J* |) Q6 w# i7 E) {6 u. Q0 x
  43. 9 Z. G1 C: G& A1 Y1 ]# V
  44. #ifdef EDMA3_DEBUG
    , s4 S. K- ?( g3 h7 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      V  V+ ^4 f: L( C3 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & T' K) a( q  C9 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( M( p: Z2 ]9 P' C  `
  48. #else
    - ]4 z4 f9 u1 J! S% N% s1 {
  49. #define DMA_PRINTK( x... )
    9 O; Q( l+ M9 G, O2 k# h
  50. #define DMA_FN_IN. |) l) B/ s5 ^7 @
  51. #define DMA_FN_OUT6 R* W" V2 o; I* r* A+ p
  52. #endif
    4 Q  E- f3 N8 U- P. Y6 `- x
  53. " y  V5 d" A. c5 C, w$ J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : B  q9 G' l8 h* n# d
  55. #define STATIC_SHIFT                3
    6 l) A0 `  U/ k# s4 j6 u. }9 h- Z
  56. #define TCINTEN_SHIFT               20
    4 r9 m, v2 K# _" a; ~- x
  57. #define ITCINTEN_SHIFT              21
    ( y7 o# l. w2 P. R' j  w: u' k
  58. #define TCCHEN_SHIFT                22
    ) Y( M* v. n: y" R
  59. #define ITCCHEN_SHIFT               23. {/ d+ _/ C0 d  N, I

  60. / B! L, y" V7 A6 \( ~
  61. static volatile int irqraised1 = 0;) d7 ?% q' v$ q0 _2 f
  62. static volatile int irqraised2 = 0;
    " D$ |2 W8 g- u% j. E) [

  63. . D- _( Q, R3 b# ?1 Z8 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " o* g& T6 N/ ~  V0 \* o; L0 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 \) S: R8 z$ b) A! t6 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( }9 g, @" u2 z- @$ }8 |
  67. - w( K. p2 `! J. N. p1 B9 a1 v
  68. dma_addr_t dmaphyssrc1 = 0;9 m/ ?& V( i/ \* @- e% M1 z% @0 Y
  69. dma_addr_t dmaphyssrc2 = 0;  l; _+ H. M; c" V) j% ^
  70. dma_addr_t dmaphysdest1 = 0;
      f3 q* t- p6 U
  71. dma_addr_t dmaphysdest2 = 0;9 G- G- V5 T$ S

  72. ! k4 i! |' T: l1 p6 O
  73. char *dmabufsrc1 = NULL;% F9 {# R' c  ]
  74. char *dmabufsrc2 = NULL;- f; }2 t& A6 H1 G* z% r! {
  75. char *dmabufdest1 = NULL;
    9 P- u6 Y! ~" ]
  76. char *dmabufdest2 = NULL;* f2 F3 m; b% C- U) T
  77. 8 u4 P5 w4 d) k1 B2 u
  78. static int acnt = 512;5 J5 U* n1 ^1 @3 d
  79. static int bcnt = 8;6 S0 Y1 J/ g+ ?( T4 B
  80. static int ccnt = 8;
    " d" r( G; @3 H7 X) l. l
  81. 1 Z. j; R0 f( q( y9 M/ D
  82. module_param(acnt, int, S_IRUGO);
    7 p, D& W2 }; u& D
  83. module_param(bcnt, int, S_IRUGO);
    ; o5 V% o$ v9 ?+ G$ z  c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ B' ^; j8 s, }' o$ {8 R
( ^' `8 W" R" o+ L& ^$ w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ X' I8 @" u' [& @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 T1 f6 d* ^$ }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; |/ s* a) _- M4 Z, P5 |$ P1 h0 F: S8 Z2 D

! c/ x% u% L3 I6 A4 a) Z8 Y$ D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-19 18:31 , Processed in 0.036858 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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