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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ A0 T$ I8 e8 Z3 m+ ?. u5 Y
  1. [code]EDMA sample test application$ k3 H1 Q0 [& t9 J; v% W
  2. /*
    9 E8 M  Q7 y$ C
  3. * edma_test.c* [2 ?: O5 l4 l
  4. *( [9 w" C" _+ ]# G! X# ~4 c
  5. * brief  EDMA3 Test Application
    $ `$ T5 B! Z4 k5 z/ F$ t# f5 Z
  6. *
    5 z! w7 |) L. f7 t/ `
  7. *   This file contains EDMA3 Test code.# O4 T. T7 d2 Z/ N2 s
  8. *. d+ ^( q* @7 o& c) g# S! T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ~: |. v3 t2 G3 M% s5 o: f- w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- V6 j. `: w/ e5 {8 m0 V! z( ^
  11. *         TO CHANGE.
    ; F5 l& g8 S/ l- e& \  J$ Z/ p
  12. *3 m: r7 P  n* }6 @* Y' }' ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 L, N4 V: N* h! \# S
  14. *
    ' A& D! l6 P. |: y( @  f0 C
  15. * This program is free software; you can redistribute it and/or4 @  J3 X  F- W9 a& T# Z9 x3 I
  16. * modify it under the terms of the GNU General Public License as$ L! }% G# L* [1 J% r
  17. * published by the Free Software Foundation version 2.1 _- Q. ]" d! e% s
  18. *
    4 k  t. L4 ^: A. x8 G0 j' c# O( Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 N/ O+ T1 H/ g5 P# s
  20. * kind, whether express or implied; without even the implied warranty
    ' Y+ ~- `& v$ X7 r' S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" F+ N% Y; T+ Z9 M- T3 L+ E5 l& \
  22. * GNU General Public License for more details.- _, o  E3 \% {# i  ^4 @
  23. */+ J# t$ X' t6 L( p0 p
  24. 0 I9 ~. J/ O: u0 Z* K$ Q
  25. #include <linux/module.h>
    9 c! L8 j: j# L% j  F
  26. #include <linux/init.h>
    * v* {# z! c6 G/ ^
  27. #include <linux/errno.h>, i1 }+ I! [3 a* T
  28. #include <linux/types.h>9 |/ ?( h) t. {
  29. #include <linux/interrupt.h>7 D( B: h! a& v) G1 [# n- C
  30. #include <asm/io.h>
    / n. G) S1 h0 v2 |+ q1 g, i. o
  31. #include <linux/moduleparam.h>
    + |, t! C% Z" U, E* @
  32. #include <linux/sysctl.h>
    3 O7 _  G6 e" J; a% |& L; p7 D" h1 _
  33. #include <linux/mm.h>
    : A/ f% w! C. A( V
  34. #include <linux/dma-mapping.h>
    4 R% Q8 f9 A) o7 E; }* b
  35.   k# J: ?- ?7 }! S. ?
  36. #include <mach/memory.h>$ A" j2 d+ k  T9 c4 p
  37. #include <mach/hardware.h>) E) F$ k/ O1 ]* G& G+ w
  38. #include <mach/irqs.h>
    , e( J7 h# K! c  \7 w
  39. #include <asm/hardware/edma.h>: y# V6 i5 b4 m+ D: G

  40. ' W6 c: E" b: }/ @% d
  41. #undef EDMA3_DEBUG
    $ K2 u2 D+ o+ o6 Q1 R2 U1 u
  42. /*#define EDMA3_DEBUG*/
    ' ?5 F8 c: V7 O6 J8 _# w" F
  43. # c' \6 _8 M' t+ J- J! C) f- v
  44. #ifdef EDMA3_DEBUG
    ; {5 ~% g* J. ]8 J: R) a7 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% i: N7 q( K$ ]7 {  {6 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( @" u- }, N) H7 C) y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' `/ D3 ^9 Q; D0 z! \. M
  48. #else
    5 v8 `  |8 L2 T9 m  ~9 s
  49. #define DMA_PRINTK( x... )- C1 a2 H7 H2 L% k( Y% N4 ]9 g
  50. #define DMA_FN_IN
    8 G8 _' |3 m1 y% ?/ `" `
  51. #define DMA_FN_OUT+ Q* ]+ ]# Z+ A, L- ^( M2 p" ^. y
  52. #endif9 T( ?; W% k( t! v) E0 s0 }+ A
  53. , c0 a' E' y* y+ [& I7 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # E5 v/ n, @) C" p  M
  55. #define STATIC_SHIFT                3
    3 s7 w( j7 h4 z3 h: S9 l
  56. #define TCINTEN_SHIFT               20( B$ `4 R5 \- z
  57. #define ITCINTEN_SHIFT              21/ Y" D4 @( ^! i" r# ]
  58. #define TCCHEN_SHIFT                22
    3 {0 O* m' z. U
  59. #define ITCCHEN_SHIFT               23
    ; Z6 n6 q1 o$ W* V4 s

  60. $ f+ L/ m, f7 p
  61. static volatile int irqraised1 = 0;& D( ?+ E( T. M, H
  62. static volatile int irqraised2 = 0;8 v3 }& L! H# P6 C$ [* F8 l4 \* O

  63. 3 D. n( g& T+ I) Q4 [7 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) o; \9 g$ V- V3 H. p/ w4 ?! S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 q; T; R, Z" k" S1 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S# Y4 l# Q/ t. ^! V

  67. + U1 \) a2 Z' [. p
  68. dma_addr_t dmaphyssrc1 = 0;
    # l0 Q9 `' ~0 c' I) @! ]
  69. dma_addr_t dmaphyssrc2 = 0;
    ) n& u$ Q5 k0 i0 i
  70. dma_addr_t dmaphysdest1 = 0;0 g- m4 V5 t  b; S9 Z9 O) t
  71. dma_addr_t dmaphysdest2 = 0;' r( J/ P6 Z+ Q+ Q& \" `& k

  72. . O! I8 ^7 o0 Q
  73. char *dmabufsrc1 = NULL;, `2 i2 \6 g; T/ b
  74. char *dmabufsrc2 = NULL;
      Q6 p( x& }. X2 n, U
  75. char *dmabufdest1 = NULL;% g1 T/ f: e- x+ R6 r8 B
  76. char *dmabufdest2 = NULL;3 j1 q. j9 U2 d0 e, S3 `

  77. 5 g- x, M) q. e
  78. static int acnt = 512;, r& n* u* O6 \+ h8 M
  79. static int bcnt = 8;- I* o" T  h2 S; L. n( H2 ~
  80. static int ccnt = 8;
    ; A! ]) A1 c* o* I

  81. 6 @2 L( x$ C' T, R' S/ L
  82. module_param(acnt, int, S_IRUGO);  C! c; \: t- D* b, N8 X
  83. module_param(bcnt, int, S_IRUGO);7 H! ?) D& w- y3 D, o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 P% g$ A+ {' v
9 ~5 ~3 a) U1 J9 c* K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U3 q- p+ g. z& y; j9 M, z. sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  q/ }$ }' h* P7 U0 w- B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 l: X+ ?% Y/ g$ Z/ l% k, R- U
% T' a+ L* C$ ?. G2 L7 J2 q
2 l6 M0 o! w0 l8 f8 q9 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-22 20:45 , Processed in 0.059685 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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