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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  b% A, Z& `) I' g" ~
  1. [code]EDMA sample test application
    - H9 V* s: O0 o, r: S' j
  2. /*
    % J1 t& D# W; ?7 Y
  3. * edma_test.c
    & r4 C- }8 [0 r- s
  4. *
    " k- M( x9 Q; j- Y6 h* W
  5. * brief  EDMA3 Test Application  Z1 D3 x' f. s0 |
  6. *( x8 S$ {. d% y/ y3 s
  7. *   This file contains EDMA3 Test code.) l0 ~5 K! j$ p
  8. *" {7 M/ E! T7 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( o; V2 V6 r4 d( K% g  z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ T5 a8 P9 T- {/ x
  11. *         TO CHANGE.1 L% M& `; p: q% X( e
  12. *
    8 V7 |; b7 n  A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& |+ f" X. X% k& V
  14. *. ~0 L7 D. P: F) b! _6 E& ?
  15. * This program is free software; you can redistribute it and/or
    7 R9 V/ V  q) P7 e" A% ]
  16. * modify it under the terms of the GNU General Public License as9 [$ D6 ]# n7 @+ r2 }' V
  17. * published by the Free Software Foundation version 2.
    + Y6 y* O3 D5 L2 |4 s% ^
  18. *  @* r5 A6 p3 |- t: i* L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 E7 b8 }* [9 U& G* _1 l8 C- k5 y
  20. * kind, whether express or implied; without even the implied warranty% @5 m3 d9 ~5 ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. x! s# I: X1 X1 Y) g
  22. * GNU General Public License for more details.* r, [2 l2 [/ ~" W7 U, b1 q  }3 ]
  23. */- V* S' M9 \) p/ q2 F
  24. # s, M1 `& q4 ]# w! m# [9 L
  25. #include <linux/module.h>( }5 V: t: N$ r3 ^2 D
  26. #include <linux/init.h>4 s1 A! N+ X* J* `9 K- X+ l
  27. #include <linux/errno.h>
    7 U8 W- G0 y6 `% ?1 C
  28. #include <linux/types.h>
    6 B5 F( Y2 j: j2 n* ^/ t0 m
  29. #include <linux/interrupt.h>
    # n( \" s; y" }' d) z
  30. #include <asm/io.h>
    , n+ \/ q9 y" C$ c$ y* x# ]
  31. #include <linux/moduleparam.h>
    - r# A# V  G3 U& Y% I1 D3 {
  32. #include <linux/sysctl.h>
    ( N! w* V1 {, B! w0 F
  33. #include <linux/mm.h>6 Y# g: N- F3 t
  34. #include <linux/dma-mapping.h>
    7 ^5 |1 J& u/ f% W- N
  35. ( r  D& m$ T, J2 o. K7 H; H
  36. #include <mach/memory.h>
    ; {5 ^; U; }* d& j7 x( a; L
  37. #include <mach/hardware.h>
    $ T4 H( R9 x$ `3 j* r  }( i+ r, ]  u
  38. #include <mach/irqs.h>
    3 m5 t. w/ B+ c& p# W
  39. #include <asm/hardware/edma.h>7 ?4 E  z3 ~. e- h3 V

  40.   h* P; Y  s- w1 \3 U6 T! ?# g3 g
  41. #undef EDMA3_DEBUG) A& A  Z4 Q8 {( _6 {2 _
  42. /*#define EDMA3_DEBUG*/; e5 d. d  @. U3 i1 V+ M

  43. ' U# T$ C* ~/ O& U6 u# m
  44. #ifdef EDMA3_DEBUG
    2 g, Y/ {% e9 |! ]( X! M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) b) i4 G6 v- a5 X" J, m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 D% E+ S8 v' s* J6 z& n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), b% K, @9 G7 P) O
  48. #else/ w) p) v0 K2 y2 C9 ?* S# a# o5 I
  49. #define DMA_PRINTK( x... )
    9 g. ^6 a- u8 \6 S# W
  50. #define DMA_FN_IN
    5 R9 i( ?9 [. H6 s
  51. #define DMA_FN_OUT
    : a4 K! p. r9 H( D/ v2 F+ h8 X
  52. #endif: C0 I) Z7 j# D& s+ u
  53. % t7 [: r# d7 W9 l) R$ r  z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 l; R: k& P6 \0 B+ T
  55. #define STATIC_SHIFT                3
    4 m( B$ O; B  z: q
  56. #define TCINTEN_SHIFT               20
    7 j+ z8 W) f: |) L$ `0 d6 }% z
  57. #define ITCINTEN_SHIFT              21
    5 ]& ]  y$ h; I% x. |) {; Q
  58. #define TCCHEN_SHIFT                22
    8 t1 K( v: V7 R# Z4 Y2 {
  59. #define ITCCHEN_SHIFT               23# I- M0 }! Q- U8 |3 Q  t4 l2 J! A
  60. / K3 c7 @. M9 b5 v. B2 f
  61. static volatile int irqraised1 = 0;
    0 e) a$ d& l. F- s
  62. static volatile int irqraised2 = 0;
    ; }1 r8 v. b, e* ?% s/ F
  63. 9 M% j+ x& f* ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - w  |" L2 h) v. T# a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  \* R3 q" \4 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 x% U. t* T; y' T8 s& ~' v
  67. ( p( G% H: C4 f0 e- [2 R+ A
  68. dma_addr_t dmaphyssrc1 = 0;
    , O" v! p8 ~, O5 n2 D
  69. dma_addr_t dmaphyssrc2 = 0;1 ]% F/ [" g# l8 q7 Y. F8 T+ o
  70. dma_addr_t dmaphysdest1 = 0;
    ! d# p3 f2 l8 Q  g9 }0 u
  71. dma_addr_t dmaphysdest2 = 0;
    . p! i0 }0 O, K9 f1 l( r/ q

  72. % C) C0 r% c# B; m" ~
  73. char *dmabufsrc1 = NULL;1 G& ^9 `$ q$ {7 t" E
  74. char *dmabufsrc2 = NULL;6 W# X8 P' V$ b9 s
  75. char *dmabufdest1 = NULL;: e! i4 \: i# t+ ~& D' L
  76. char *dmabufdest2 = NULL;- f8 k* }' @. w* T5 j
  77. , c+ j0 g+ H  {; F5 ?
  78. static int acnt = 512;
    , N4 m" v) r3 ?% y
  79. static int bcnt = 8;5 t% H) Q7 o$ [6 e3 S! f, Q  [
  80. static int ccnt = 8;
    2 Q" l5 A. X( w2 }* G
  81. ! u& R3 R1 \. x1 f
  82. module_param(acnt, int, S_IRUGO);
    . c1 t4 a; K# k- C$ P( J, q' }! ?, f
  83. module_param(bcnt, int, S_IRUGO);% Q; X! L9 x  N1 u: N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! _6 ^# g* E: D
5 S7 p7 H( f, I0 o2 f- _/ }6 V) t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ^8 c3 u; M. \) U; aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ y- G' ~8 `6 m, y) [) Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. ?9 r& I8 ]  m" p; p' `6 B+ m6 v
  w' R  I3 r! D6 W( |- z

8 S0 R8 m: ^# ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-3 05:08 , Processed in 0.043071 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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