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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 j9 _* b" B, {$ B0 H9 @$ p2 q
  1. [code]EDMA sample test application
    9 G- U% S$ _2 F. P
  2. /*# ^" w& k" ?" N+ p! }+ z- x  B5 W
  3. * edma_test.c  C9 L" d# V6 ^
  4. *
    3 n! a/ \) d- B
  5. * brief  EDMA3 Test Application
    & z" N8 L( g% U% p9 M; u
  6. *% |4 i$ m! ?  x. n! i1 Q$ k( t4 ?
  7. *   This file contains EDMA3 Test code.
    % h: f! a# e) m% a
  8. *
    , Z( a4 M, C3 q2 p3 `2 `' f( b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ p8 r  w) ?. g) k; R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& G* W$ O" f* w9 V( o: k7 b$ @+ B
  11. *         TO CHANGE.( V1 P6 e# ?9 G& r  @
  12. *
    , W; I% J. G; u' ~9 |9 _5 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" _4 U/ r7 N0 _8 c# @& \
  14. *
    / d: _7 D. c" @; x
  15. * This program is free software; you can redistribute it and/or% y8 F. s4 _! X" \: B, l5 }
  16. * modify it under the terms of the GNU General Public License as! }, R. v- Y5 P( P6 w- q
  17. * published by the Free Software Foundation version 2.
    ' d* z7 m0 `2 d3 z" C: \3 j. w
  18. *
    % A+ P: N3 ^2 @2 {5 W, ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      B) f& ?. Z1 v% c
  20. * kind, whether express or implied; without even the implied warranty# g+ F' F/ t  Z7 ?# I8 O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 i8 j0 L* b: A1 R$ |
  22. * GNU General Public License for more details.
    2 u& y4 X6 p  c  M( a' l
  23. */: J0 P; b9 [7 R7 A

  24. # @0 N9 g- y7 L4 T3 T( S
  25. #include <linux/module.h>
    ' k" F; {, y  {! X' K& T
  26. #include <linux/init.h>
    0 [6 c1 \* r1 f" s! F
  27. #include <linux/errno.h>
    * V, [! y6 ]" i4 }2 V' g( e
  28. #include <linux/types.h>4 T) f% d8 A7 _+ s9 [* U' ~$ l
  29. #include <linux/interrupt.h>5 |2 W- ^: ?! v+ X
  30. #include <asm/io.h>% f7 ~- o7 L* B
  31. #include <linux/moduleparam.h>
    5 d' [9 l% [# L5 S- F+ a* w
  32. #include <linux/sysctl.h>
    $ Q$ @6 g$ S6 T4 W$ B! u1 P8 y
  33. #include <linux/mm.h>4 o5 f  ^  f+ r+ t
  34. #include <linux/dma-mapping.h>0 d) A% {: g1 h: [
  35.   y- Z/ n$ o+ }; Y3 B
  36. #include <mach/memory.h>
    * |, O) S% R5 c  N$ Q9 |9 G
  37. #include <mach/hardware.h>
    6 b) N2 O# u: v  C6 ]3 t
  38. #include <mach/irqs.h>2 t$ ^2 P  k$ Z/ D% V/ |
  39. #include <asm/hardware/edma.h>
    & ^3 }5 \1 x; s! a0 Y7 u
  40. 7 D+ K* |9 t- g, o& \
  41. #undef EDMA3_DEBUG
    ' B: G; c& d0 V& w7 [8 Y, ]
  42. /*#define EDMA3_DEBUG*/" F- ]! E/ [$ ?4 Q/ j

  43. 9 m$ ~( W: ?5 @( ?
  44. #ifdef EDMA3_DEBUG
    % T% e# ]+ O2 \' k5 s+ P# Z& r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 I0 W$ O  G/ Z% F! O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 S8 i+ p: C4 f8 t! c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 @4 o  s( }; B  I8 X
  48. #else% E* E3 v+ g% c9 T
  49. #define DMA_PRINTK( x... )
    / A; A+ k, V( L6 ]; a$ V! X
  50. #define DMA_FN_IN+ H0 o: L0 a3 Q: n' x" g
  51. #define DMA_FN_OUT
    $ ~0 p, E  Y/ @9 A
  52. #endif
    . V: U( k) p2 o5 v
  53. : Q- R* p, g3 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , F* g' D( M; D- h3 g5 E
  55. #define STATIC_SHIFT                3
    ) _- z( A  V8 B. X( \
  56. #define TCINTEN_SHIFT               20
    6 s6 \2 @) [# ?# X/ x  j- E
  57. #define ITCINTEN_SHIFT              218 ]" [, q0 Y. ~7 J; E' |. W( A
  58. #define TCCHEN_SHIFT                22" S* K+ T8 V: t" h3 F/ E: D
  59. #define ITCCHEN_SHIFT               23
    $ z2 l, G; x2 U4 R' C5 |
  60. * k: ]; X7 f9 A) O9 S4 O: ^
  61. static volatile int irqraised1 = 0;$ X$ L  H' \  ?2 a6 e% s* M
  62. static volatile int irqraised2 = 0;
    0 R. i) G7 g- Y
  63. ) U- d8 g; G; W+ r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- z7 u0 h' j) _9 B+ V: e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : P- K) B2 q" n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 l" n) q3 E' b: @- [
  67. ; U/ \( [! P. V1 Y  \1 ]3 c# _- V
  68. dma_addr_t dmaphyssrc1 = 0;
    : {  V. S! Q- {
  69. dma_addr_t dmaphyssrc2 = 0;
    1 @6 s2 H  W3 g5 b
  70. dma_addr_t dmaphysdest1 = 0;
    4 T) @$ n9 {' q3 V# j
  71. dma_addr_t dmaphysdest2 = 0;
    * c% x- K- M: a7 j0 s- c& X
  72. ; s! f" L+ B5 A5 f
  73. char *dmabufsrc1 = NULL;
    ; I1 B5 a* F0 K% C% I! G, f8 N
  74. char *dmabufsrc2 = NULL;" m8 s: ?- L9 @' r9 M' v7 s
  75. char *dmabufdest1 = NULL;# r4 A. C1 P& w( _+ Z6 i
  76. char *dmabufdest2 = NULL;2 A* Z  d! d* W9 d0 g

  77. & t5 I4 M4 C) |$ r
  78. static int acnt = 512;( T) I3 y1 Q0 j. a1 v8 K, a1 y
  79. static int bcnt = 8;0 h; Z% [" E1 o$ G# s
  80. static int ccnt = 8;  X8 f& d0 Y% [3 y; l3 C* l
  81. 5 z0 w3 i& F- X( |
  82. module_param(acnt, int, S_IRUGO);& p: ^3 @: a% q" }
  83. module_param(bcnt, int, S_IRUGO);, O/ T* h- g- h! k' f$ Y$ F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 e- c. a, `  T
8 y8 P( c% s. G: b' B, h1 k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ s2 S! x, S) \2 F5 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ F& S% a3 R3 q. ^1 B( k9 o3 `9 i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 A0 P$ R: J: ~7 e( q( e# j' o2 z
  |( e. Q8 w" L6 I1 }. u! [0 B  c# g5 q2 c! v0 A' S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 23:08 , Processed in 0.046139 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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