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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + r+ v+ c( t" K
  1. [code]EDMA sample test application
    " Q1 F2 a/ [6 ~8 J: K5 v  l- K
  2. /*
    ) V% P  P; X! R2 j6 I1 z1 S. J
  3. * edma_test.c
    8 t1 f. n( x9 ?$ w
  4. *
    6 J3 ~5 c# p+ \
  5. * brief  EDMA3 Test Application
    5 t! H/ e, i1 P2 K. _) f6 J! w
  6. *: m$ [3 T" N. b2 |4 u" ]
  7. *   This file contains EDMA3 Test code.
    & o% J9 C$ P  U( X" L7 r
  8. *; g9 f+ d+ o) w' J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( H) }. c& V6 ~9 a1 c7 W/ _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - e5 _$ E7 |, N" F$ E9 R6 q. ^
  11. *         TO CHANGE.# ~0 L& \: g  a  V$ ~  O
  12. *
    # M" A' L+ s; P4 s1 ^( f: N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// N  Q3 x8 n& C' T0 ?
  14. *
    2 `6 V6 O/ D7 Q+ o: l
  15. * This program is free software; you can redistribute it and/or  G# D: Z( b9 q- a
  16. * modify it under the terms of the GNU General Public License as* F1 g* A0 m  |5 e. T; l
  17. * published by the Free Software Foundation version 2.& N$ ]3 S- q- V5 }4 }
  18. *
    ! _9 Z: A8 m- e" P! j% c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 t- y+ t4 e' q# l. |
  20. * kind, whether express or implied; without even the implied warranty
    8 H7 ]! P  ~& Y2 }; i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% W6 f+ Q: T# c- R
  22. * GNU General Public License for more details.
    2 p8 }$ c$ C* L  C7 J* r0 e9 W
  23. */
    : l0 w, ^2 p  y0 R$ t1 j- N
  24. ( Q; f: }9 l5 W2 Q6 a/ n* {- `) F
  25. #include <linux/module.h>
    8 ], ^( i4 Z, y
  26. #include <linux/init.h>! H+ y, v) @: p1 f
  27. #include <linux/errno.h>5 q# s& e5 }, s) B
  28. #include <linux/types.h>" t8 T& }8 s$ U& H1 f
  29. #include <linux/interrupt.h>
    , h$ T9 }8 c+ w+ M% q
  30. #include <asm/io.h>' z- a3 R9 h* X8 ]( {+ _
  31. #include <linux/moduleparam.h>  _. _4 r. q9 [: H/ y
  32. #include <linux/sysctl.h>
    1 N6 l) S& M1 [) O3 [
  33. #include <linux/mm.h>
    + h) C& i+ c- O2 X' E  j9 g. M
  34. #include <linux/dma-mapping.h>& J- l, X0 o1 W! ^# o4 A; l

  35. & S7 B- R% n$ }+ x
  36. #include <mach/memory.h>
    , H5 q3 i) H: D3 W( r1 Q& ?( N2 x+ e
  37. #include <mach/hardware.h>
    3 T# s4 I8 @3 f
  38. #include <mach/irqs.h>
    6 Q: M$ F1 @! ~* S) f% X" }
  39. #include <asm/hardware/edma.h>* I$ B0 P8 Y0 _, Q2 L& c& ?# r
  40. ( n& c. v9 }( V) q8 \, B3 _0 d
  41. #undef EDMA3_DEBUG
      K- I) H( ]4 ?$ `9 t4 Z
  42. /*#define EDMA3_DEBUG*/
    : m+ {6 [* I* L/ Z% ^- {3 T$ @1 b3 C

  43. 7 e0 N2 G. x: j  P" e2 T
  44. #ifdef EDMA3_DEBUG
    , D& I5 g* \7 m" f) p3 z' p  z# M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ c. g0 L' q6 d$ Q. e% `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 x# C+ R/ F+ K# Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( v, W& h+ o5 k. L, R' A
  48. #else
    + |4 J1 h( C' a( |2 k7 _; B
  49. #define DMA_PRINTK( x... ): b) I; X  o. w. g. c7 _
  50. #define DMA_FN_IN6 u2 K# m2 H# ?' v2 ^3 T
  51. #define DMA_FN_OUT- m2 L8 Z% c" D# Y' b: f
  52. #endif4 V$ t) b' X# T& {& r( d

  53. $ C! C6 e* q* z& V9 l0 r( B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ s2 x# E7 Z8 Y* l* }0 L) w% _
  55. #define STATIC_SHIFT                3/ ~: q1 W8 F3 O4 r6 Q- a- `6 b, C0 d* x
  56. #define TCINTEN_SHIFT               20
    + n" F+ l8 k9 m7 a" i
  57. #define ITCINTEN_SHIFT              21
    + ?' D/ T( u2 y. Q
  58. #define TCCHEN_SHIFT                22' b# G8 G* i4 r. Q% g* ~/ Q
  59. #define ITCCHEN_SHIFT               23
    - ]: X! @. q. z9 p4 G) s9 f/ X

  60. + h" S3 k! J$ \- U: [) Q' Q4 m
  61. static volatile int irqraised1 = 0;
    6 K) l/ k; H4 Z9 n" q" Q6 v
  62. static volatile int irqraised2 = 0;; J* a- ?" r" _% [

  63. 2 K( q0 F# Z# ~5 Q, ]- J7 c$ N- D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; B9 Z( H- e5 m9 A0 Y8 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. n4 q2 e8 q0 O7 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o. }& x" e6 A( R8 k6 m
  67. 1 X: ~9 l) s0 z# |  `& ]* p
  68. dma_addr_t dmaphyssrc1 = 0;
    : w* v; I7 U' o6 }$ q$ f( L/ l( F  v
  69. dma_addr_t dmaphyssrc2 = 0;
    / ~$ Y4 Y- I$ I& q# Z
  70. dma_addr_t dmaphysdest1 = 0;  x# x1 g1 k- M$ {) o* N4 ?/ n/ X
  71. dma_addr_t dmaphysdest2 = 0;
    1 I+ s# R3 T5 c& G
  72.   `* I* q1 _3 X  K2 g
  73. char *dmabufsrc1 = NULL;
    ; ?' m. R0 X) X& U6 r6 {2 O" }
  74. char *dmabufsrc2 = NULL;
    - I4 ]8 p4 w* g5 \, {
  75. char *dmabufdest1 = NULL;6 n0 b& @6 M+ `# t9 V
  76. char *dmabufdest2 = NULL;: P; f9 u! {+ ~2 F" i( u% C
  77.   p$ y0 H+ s# l) v4 ]
  78. static int acnt = 512;
    # r* t9 d& c- M4 ^/ G1 c
  79. static int bcnt = 8;) l5 C. z: b6 r& M2 l2 B( `
  80. static int ccnt = 8;
      P/ a+ U' |' ?7 i3 J' X
  81. 5 }  P1 P/ L3 v3 a, M7 y
  82. module_param(acnt, int, S_IRUGO);
    8 ]/ c5 u2 y& f& Q
  83. module_param(bcnt, int, S_IRUGO);) Z" z7 M) v: \  s" r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) [0 h( V& W3 S( A) a
; @$ d3 D; ^+ y; N: K' ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 n1 g8 A3 {6 r$ u* a" Y# o6 ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 c+ B9 [  y8 y/ {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. S) w9 r6 m1 Z5 L' }( x% p) W/ T" L# Y+ z7 k! H( I& G

) G( V/ p1 h2 ]' o, Y4 j0 C  V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 23:36 , Processed in 0.044497 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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