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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; c) a* W3 ?9 d+ I" o
  1. [code]EDMA sample test application3 W. E- m, t% f7 E2 G  s
  2. /*6 K3 t: V' ^! b% G0 \6 S$ u+ e
  3. * edma_test.c
    ( i: l, b/ o" k, f; U+ o
  4. *1 @, g" h1 l* [
  5. * brief  EDMA3 Test Application
    5 j8 p0 u" P/ A' [1 @. |3 b' e
  6. *" _6 `% z7 J" T" B6 Z
  7. *   This file contains EDMA3 Test code.
    ( W7 }* t% V+ F9 W5 e
  8. *4 p" Y) U# F) p8 m2 j* D$ q! w8 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / t6 z! j5 _0 L# M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; S" K) z7 m6 M, E2 h# G* H
  11. *         TO CHANGE.# b: Y* d: L5 l6 c
  12. *1 U- p( K( ]% G  O: t0 \  W2 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 F* c9 L. _1 h: V
  14. *
    : J$ |& i( Q& k
  15. * This program is free software; you can redistribute it and/or/ p' K3 l. f" A- [( Z/ a0 v
  16. * modify it under the terms of the GNU General Public License as
    3 [1 a1 U) R8 G# j' \( C2 T+ ^7 X
  17. * published by the Free Software Foundation version 2.: V" {8 B  j7 i5 g( s( b
  18. *, G2 c$ s: c% w9 B1 i! l5 Q* D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * R) x5 s2 d. ^7 E) d  {' }
  20. * kind, whether express or implied; without even the implied warranty: U4 Y* x# d7 n& F1 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - }. {7 s+ o' \
  22. * GNU General Public License for more details.
    9 W3 J: C0 @1 E8 R8 I# Z
  23. */$ N2 _3 Q2 v. h# F6 V0 ], `+ b
  24. 9 N) G* P3 M" \2 e( w( \. S/ v
  25. #include <linux/module.h>: _( h# ?: Q5 ^: F8 ]- n9 C! G: \
  26. #include <linux/init.h>
    7 T2 O) |# R7 }2 H1 Z2 O) J& |
  27. #include <linux/errno.h>
    / ~2 \' w! ^( o! A$ e
  28. #include <linux/types.h>
    : I0 l0 t# E6 z1 e* J5 \6 K/ D1 }
  29. #include <linux/interrupt.h>
    - ~, g6 U8 i6 {3 M( W% w
  30. #include <asm/io.h>6 I6 u% Z7 R0 g9 M
  31. #include <linux/moduleparam.h>
    0 Q/ N+ l$ J% X2 w" u
  32. #include <linux/sysctl.h>, W; r# c8 \' E* ?( L: M# b3 _  g  @! {
  33. #include <linux/mm.h>
    . p2 s/ K/ v/ B. m4 x
  34. #include <linux/dma-mapping.h>
    # \$ l) R2 h9 P, ?+ v$ }

  35. + C; l; _( s  T/ i
  36. #include <mach/memory.h>
    4 n% I/ J5 y: b( J; \7 g, F' V) }
  37. #include <mach/hardware.h>
    - `& n& b/ B6 C2 v7 t  c0 a: \
  38. #include <mach/irqs.h>
    & y2 j( N, O3 E$ o( O0 O& ]
  39. #include <asm/hardware/edma.h>7 ^4 T- `8 }9 C3 S2 V- {

  40. ) H1 H# s' m+ P; P/ g' Y
  41. #undef EDMA3_DEBUG
    & Y& \- D4 J$ u) ]( a
  42. /*#define EDMA3_DEBUG*/
    # v7 u! a3 I/ x3 I, s9 x9 o/ J9 S) ~$ s

  43. - Y" Z# g0 l( j% Y1 i% D
  44. #ifdef EDMA3_DEBUG
    # ~$ ]+ J0 d* o' d* p& `% U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) s  c$ v1 A7 @0 s( Q* ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 m5 T0 k; l  i# s  v4 `' A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 t1 ?1 m, b8 r5 u6 t7 e, x% i8 V
  48. #else9 x' a; O% ^: a, V; U
  49. #define DMA_PRINTK( x... )
    / E; w8 \2 @3 d3 O% }
  50. #define DMA_FN_IN
    0 w% j% J5 S" S+ x- o: \
  51. #define DMA_FN_OUT0 |7 U! ?1 P/ @3 G% n
  52. #endif
    / K2 N1 A2 J( B1 P6 V( S( i
  53. ; U( Q& F9 b8 p. ~$ Y0 y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 p* b( s. X1 c
  55. #define STATIC_SHIFT                3
    4 n. B; v, E- X8 z0 O8 \5 S  _
  56. #define TCINTEN_SHIFT               207 p* S9 F0 a2 ~
  57. #define ITCINTEN_SHIFT              21
    & c7 n4 q' }" J9 L
  58. #define TCCHEN_SHIFT                22) R! u8 H# i9 h. P: K- G/ e+ \) H- B
  59. #define ITCCHEN_SHIFT               23: L9 \8 M6 P0 F/ `6 o. o) M$ t+ y
  60. ; t2 c; F9 \! a' S/ i. `+ w
  61. static volatile int irqraised1 = 0;
    # R0 e2 q( M: k) i6 s0 K: O- w
  62. static volatile int irqraised2 = 0;
    * T. I4 _6 X+ m6 L- K

  63. . {% u. a) v( B0 W, o5 {2 i. W' \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . z+ m* M( _4 N. F- t' t6 E2 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) c/ Q) J( `$ l6 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ^: g, J* {$ O  H1 \0 V& l

  67. # U& G$ ]! J/ S; i3 b- S0 C' W
  68. dma_addr_t dmaphyssrc1 = 0;) G( e* G( L5 P( O
  69. dma_addr_t dmaphyssrc2 = 0;
    / U; n( U+ o3 X, Z1 u$ B
  70. dma_addr_t dmaphysdest1 = 0;- `1 r& e& C3 V1 [' F* j% n
  71. dma_addr_t dmaphysdest2 = 0;
    8 O" }- j6 K6 H& h7 Z' T: k* j

  72. ' C! ^) {; n, x1 H) `$ b
  73. char *dmabufsrc1 = NULL;& w1 P9 k0 V6 l0 j
  74. char *dmabufsrc2 = NULL;+ v5 Z% r2 h1 |
  75. char *dmabufdest1 = NULL;
    & y, ?( v, g: ?4 v- ^
  76. char *dmabufdest2 = NULL;6 J  o1 U) s5 ~

  77. 1 C! x6 G- u' T* q
  78. static int acnt = 512;7 w1 |0 e# j3 E0 n; Q
  79. static int bcnt = 8;0 {* b' ~! i4 J5 B. f$ l! o
  80. static int ccnt = 8;
    4 g, x; j7 Y) u# P, Y

  81. $ m5 }2 c  O( q; s* [% Y1 o" d: M
  82. module_param(acnt, int, S_IRUGO);
    * R* O4 D$ y8 k' u
  83. module_param(bcnt, int, S_IRUGO);
    : p, ]' A. c! ]  a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, L7 }" s; R* s4 V& Z; K8 C4 S2 K$ U/ t* ?: N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& T7 y( _# L6 E( F: K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) a' ]7 Q5 j1 V8 Z& z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ l; [2 k% E+ B9 F* ~. c: R1 C/ V' T1 N# c$ b

; A0 Q( q: J* l2 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 13:50 , Processed in 0.039223 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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