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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! @; E+ k0 p. C# ]& P$ `3 S6 g8 w
  1. [code]EDMA sample test application
    " u! k7 a  z8 e; F) F& e- r. L
  2. /*
    5 L; b+ Z/ c* h6 @
  3. * edma_test.c; c. j6 ?8 `/ C3 p" Y7 v
  4. *
    ! C# n+ f5 \; D* L; p5 M
  5. * brief  EDMA3 Test Application& n+ c! N3 L1 s* A
  6. *
    5 s& Z( M+ H% ^- P; `+ P$ T
  7. *   This file contains EDMA3 Test code.$ H7 @" @$ D! R$ o& p/ G# k5 m
  8. *! i$ i+ F$ s$ [5 r( g# B. F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 B) d0 b. G- I0 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& s; _1 A$ z( \
  11. *         TO CHANGE.3 D# y- ^' x3 i
  12. *
    0 f" b% X' O) r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ?  h! i. x& E# e9 _& E' C
  14. *! x6 U6 b" Z. q2 |# t( T
  15. * This program is free software; you can redistribute it and/or
    7 u# H- {# z( \# B7 f, q2 c
  16. * modify it under the terms of the GNU General Public License as; s) f2 z! {) f  T- j  s% A4 G
  17. * published by the Free Software Foundation version 2.
    + ~. V4 }. e+ B
  18. *& H1 S2 Y4 \: u4 z/ K1 V# p, C1 w! p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & @6 X* E) N# ~% S* W  x
  20. * kind, whether express or implied; without even the implied warranty
    $ z1 M! p" d8 R4 P2 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 b( W% f. t, W9 [" S) J" o
  22. * GNU General Public License for more details.
    6 z- N: N. b2 r: y% N( f9 ~
  23. */) \9 K; n1 c+ k! o6 J2 U% u
  24. : L7 D9 C8 y* i5 c8 }* {
  25. #include <linux/module.h>9 ]" B. g) e" T: E- L0 q
  26. #include <linux/init.h>$ i: c+ M4 Z5 y; O# t
  27. #include <linux/errno.h>
    6 M$ ]! _5 M. A
  28. #include <linux/types.h>8 _7 Q: B9 B& ]
  29. #include <linux/interrupt.h>
    7 f/ L# f/ C' @; m8 J
  30. #include <asm/io.h>
    / V0 I0 J( a% H6 `" U" z
  31. #include <linux/moduleparam.h>  x! n' i* S. M  L. g
  32. #include <linux/sysctl.h>
    ! v9 e$ A1 U; X, _
  33. #include <linux/mm.h>4 [5 [$ |) M; H" |) S& ]( L4 Z/ f9 }
  34. #include <linux/dma-mapping.h>6 S2 ~: e! s1 Y6 y, ?
  35. * I/ B6 u7 x& c# I
  36. #include <mach/memory.h>- L! A, t3 G, V/ ~
  37. #include <mach/hardware.h>, R% }' V$ z3 N$ f3 N& j  u
  38. #include <mach/irqs.h>6 r; I9 ]: Z2 E- |2 K! T
  39. #include <asm/hardware/edma.h>( D: j) T- s! C1 O, l$ R

  40. ; s! E9 y' n1 D# C, H: M- R
  41. #undef EDMA3_DEBUG$ ?( X+ F( p3 v+ r" B1 m' Q& n
  42. /*#define EDMA3_DEBUG*/
    + k; Y% d: ~$ s% m2 j/ o6 A7 u
  43. ( R. P) T, w8 h$ \, N
  44. #ifdef EDMA3_DEBUG
    0 [2 y+ U: m: m& B$ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 m0 x: b% R% U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ O  ~- d5 D. l( Q/ A& X. X! F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - |: {8 {+ z* x* t! e( A$ v# \
  48. #else
    ) @$ r( T6 x4 o. T) U' N
  49. #define DMA_PRINTK( x... )6 _! d' j6 C$ _8 a7 m+ E
  50. #define DMA_FN_IN' a" J! K" Y' c+ J# _, F
  51. #define DMA_FN_OUT
    ' i9 z% o( b9 d" V$ C! j
  52. #endif: n( x; r9 J9 t1 t8 |
  53. % l, p4 r" P( Z  A1 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " f$ N- K! _1 ^' P3 \( ~
  55. #define STATIC_SHIFT                33 z; q+ A2 H4 x2 S& k1 b1 ^1 }6 f
  56. #define TCINTEN_SHIFT               20
    $ Y) k# }  Z: L  r. ~+ n2 c( M
  57. #define ITCINTEN_SHIFT              212 \- r/ ]/ {  r. [
  58. #define TCCHEN_SHIFT                22
    0 f# F5 y0 y4 A( e# q" P
  59. #define ITCCHEN_SHIFT               23  x3 v# u! t3 [" a/ B

  60. ( s( }  O- ^9 N5 C# p1 S  j# q
  61. static volatile int irqraised1 = 0;
    $ _" u3 N. D! k& u; H
  62. static volatile int irqraised2 = 0;
    & o9 d8 T$ j  {6 U2 h2 K. b& `

  63. % _, o( J+ Y( U# J4 I/ |% _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y! s& @% `1 R% [  G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 j( x, I/ |$ f* p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      V, q3 f; [7 M  q, D
  67. / Y- j6 l  v- K
  68. dma_addr_t dmaphyssrc1 = 0;" r+ ?: I8 I" g
  69. dma_addr_t dmaphyssrc2 = 0;2 ?6 b# S/ _; B3 |. r$ E9 h
  70. dma_addr_t dmaphysdest1 = 0;
    9 R( n! \4 Q' r8 e7 n
  71. dma_addr_t dmaphysdest2 = 0;! z- b7 E. `7 `- `
  72. 0 d+ `! i) \4 A- d+ x; ]
  73. char *dmabufsrc1 = NULL;
    0 m2 _0 A9 J- _* o% s2 Z( v# B
  74. char *dmabufsrc2 = NULL;" T; R7 W3 t# u9 L0 z# L6 A9 w7 W
  75. char *dmabufdest1 = NULL;
    " M6 d3 m1 D* L/ Y
  76. char *dmabufdest2 = NULL;
    2 I8 Y* }; l) T4 D7 [* Z
  77. * H* N7 _8 @5 {' ^, m2 [  X
  78. static int acnt = 512;
    , z5 `/ t4 S: S# Y
  79. static int bcnt = 8;
    . e+ Y) `& U8 |, k7 E
  80. static int ccnt = 8;0 w  d' I; k& D
  81. 6 ]6 E* w$ q  D& b* F9 e+ n* ?4 u
  82. module_param(acnt, int, S_IRUGO);
    / f9 W! o5 \2 R% t
  83. module_param(bcnt, int, S_IRUGO);0 Y8 I2 o- g, z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ P9 H7 s+ D" D) s2 f
* D2 w7 `# q+ a7 @! u; l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 ^) W: [8 d% w
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 F& n4 @0 i2 ?3 F! ~) a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 s* z! _1 ]1 E* J& i9 S9 p& J& W9 p; P3 ^! k- w& i# Q' b
3 {, B- o' o! W, F2 }! t1 P( H: ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 20:36 , Processed in 0.037493 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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