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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , Z, }* r5 o* v/ y
  1. [code]EDMA sample test application
    - V, j5 U3 w* C' k- C( O
  2. /*
    / \0 }0 T- ~' B2 T6 s! X
  3. * edma_test.c
    3 U* V2 X0 _- e- N) z; v; |0 q
  4. *& C7 ]2 p. v0 x5 Y( t3 w1 f
  5. * brief  EDMA3 Test Application
    & A) g4 z/ ^/ |* r: l0 B
  6. *1 E. h: z  h* R. H9 e2 q) _( ]
  7. *   This file contains EDMA3 Test code.
    : A" F5 k. `; U5 Y- L7 u
  8. *( U8 v! f* O4 O. [, x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # S; m. h) C- ]  M0 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 W, v" d6 D6 Z& ]; n
  11. *         TO CHANGE.
    9 z1 A% a3 p) o
  12. *
    8 v- r! k9 l  l/ @% d3 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # y' |) t* V! ?8 D
  14. *+ {1 G: i* D0 Y7 v& M, x0 v% H9 o4 q
  15. * This program is free software; you can redistribute it and/or
    % h# \- k( w0 M- ]6 L& @9 A
  16. * modify it under the terms of the GNU General Public License as! R& U4 f$ e" y4 m. u, o& {0 L
  17. * published by the Free Software Foundation version 2.
    , q( H% y. J' f2 ?' l6 w
  18. *
      A; `1 ]0 s/ D% n, B1 M. r. G, P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ L; N$ Z2 s; z
  20. * kind, whether express or implied; without even the implied warranty* ~/ Q* E) U0 Y. R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 Y, p/ j3 s  o& x+ G
  22. * GNU General Public License for more details.+ E7 J% I, X6 k( F( g
  23. */
    : J& ?4 F1 c3 f7 a# q
  24. ' U1 N0 y0 o4 g2 ^3 N9 x
  25. #include <linux/module.h>2 o# T* m7 w. Q  l+ o% A7 {
  26. #include <linux/init.h>
    " h* v  h1 V2 M. W* A3 H/ y; U- V
  27. #include <linux/errno.h>
      L- D  ~- A  X
  28. #include <linux/types.h>
    * i" q- D5 O) P$ e
  29. #include <linux/interrupt.h>
    : n' y( F1 d; _# x  r* Q# [; y
  30. #include <asm/io.h>, s/ a" k6 C9 Y1 u: b- H
  31. #include <linux/moduleparam.h>+ W+ r  A8 i1 g% j
  32. #include <linux/sysctl.h>
    6 A: Q, R( T; `* v
  33. #include <linux/mm.h>0 R( X0 g& |0 Q) g8 C- Y! n
  34. #include <linux/dma-mapping.h>
    6 y  e5 t1 ?0 P$ J
  35. . y5 \" K3 t6 _- ^) w
  36. #include <mach/memory.h>' _8 ?0 Q( A3 X1 @- B* q
  37. #include <mach/hardware.h>
    " j/ f1 n8 t# `# b9 i$ b
  38. #include <mach/irqs.h>3 G0 c' o" A2 J2 I7 a8 p
  39. #include <asm/hardware/edma.h>, \% w4 }! I$ G3 M4 V: }+ j
  40. 1 |8 N0 [0 d6 }6 `+ u" L
  41. #undef EDMA3_DEBUG& ?% S+ ]9 g0 g8 }+ I
  42. /*#define EDMA3_DEBUG*/7 Y3 f6 ^* J8 v  x# i

  43. $ q' J# ?( A: H, k' p2 R  F; E0 d
  44. #ifdef EDMA3_DEBUG2 p( b" W  [2 J8 f1 \, u- |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ ^; s. Y3 \! B# ?/ o2 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 K$ _7 Z* z0 a& B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ w( n: X8 ^; ]/ B7 r+ Q* H' u% j+ M
  48. #else& v1 p* h1 K8 V0 H# j4 x; c6 }
  49. #define DMA_PRINTK( x... )
    4 R1 F  V) F0 k4 v, }( F. N
  50. #define DMA_FN_IN# I9 }2 ?9 x. d! Z: [
  51. #define DMA_FN_OUT
    7 T* w( R0 b. l, c- D
  52. #endif' v- P4 m. b% V9 Z, Z7 E- `; l
  53. / d( x! K9 n8 P- M; n; g; p8 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); _0 s+ u. |) T: l) ]/ l0 P3 S" Z
  55. #define STATIC_SHIFT                32 S7 k; S  T0 V: C% |- }: M
  56. #define TCINTEN_SHIFT               20% J3 m" h( W1 W$ U8 N
  57. #define ITCINTEN_SHIFT              21
    8 |( @; k6 G' l8 s% i
  58. #define TCCHEN_SHIFT                220 s! `* D1 u& m% n9 Z( ?
  59. #define ITCCHEN_SHIFT               23! G" b- _+ ^: V! C

  60. 6 t% C  h7 K. `0 N' _' V% ~+ i# }
  61. static volatile int irqraised1 = 0;
    " [4 ?* o' T. I5 J  a# e
  62. static volatile int irqraised2 = 0;
    6 A# K0 I6 f- q. u% ?% i* _" F
  63. 9 e- x. T; D  G! p% h) d8 v$ b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 S3 s& q% V8 [8 g, |! z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! @+ m9 n& \8 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( @+ ]4 a. s7 V! ^
  67. " O/ M, v  M* Z9 k  O# b+ h& z
  68. dma_addr_t dmaphyssrc1 = 0;, u5 X- P9 ~1 o5 V! L6 O# J. e! K
  69. dma_addr_t dmaphyssrc2 = 0;! j" L7 U7 v/ F4 z
  70. dma_addr_t dmaphysdest1 = 0;, ?  |3 b- l% e, ]7 w! u
  71. dma_addr_t dmaphysdest2 = 0;4 P* x6 e/ f' v; u1 e

  72. + @" K( i/ A, Q# W+ X
  73. char *dmabufsrc1 = NULL;
    7 T8 a8 o% x, w7 Z5 V6 H7 q9 H
  74. char *dmabufsrc2 = NULL;
    & a3 ^( c. ?; B# Z0 O& x: b
  75. char *dmabufdest1 = NULL;
    6 X* G: `/ u- y, K
  76. char *dmabufdest2 = NULL;0 g1 [% y  t. c* l

  77. 6 b$ t) V( G' m
  78. static int acnt = 512;
    ) @  r4 h3 R+ i4 h) a! D0 i( W* j9 I
  79. static int bcnt = 8;
      l" O0 m* L; A- z3 |. o
  80. static int ccnt = 8;2 |( Q" d5 S. s  c
  81. 2 w; G' j9 j( J9 ?' y3 x( j
  82. module_param(acnt, int, S_IRUGO);
    1 ~  n, a' ^# M* ]
  83. module_param(bcnt, int, S_IRUGO);
    9 v6 z& X* B- Q) M7 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) u' {5 c) w, L, J. X

) U' @6 o! r' ~5 J+ g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 M2 F' B/ g( g5 Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' n9 |& Q; o/ S& L# s3 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) w: r% d* `, w4 _' V  ~
% S% f$ {$ r* W; p7 }$ E5 ?5 M. j6 T% J7 [+ r& f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 10:58 , Processed in 0.039120 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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