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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * M  n* J1 |6 D' D8 O. ^4 O
  1. [code]EDMA sample test application
    # P+ M7 c3 y) S- \- A/ @( b
  2. /*! Z- q  l2 J7 H$ {0 A  V0 ~8 w
  3. * edma_test.c8 ?! t8 a; F8 Q& K$ T2 H/ D3 t4 S
  4. *
    9 m" X8 |8 o' s
  5. * brief  EDMA3 Test Application
    5 v: M" |; g& \3 T6 C9 ~) m( y4 i
  6. *$ h& Q- F6 s2 `
  7. *   This file contains EDMA3 Test code.
    $ b- s  i  ~5 M
  8. *' @. z( ^# @. B' T! ^& c6 S9 W. `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , t+ Q* D" @: I+ ~( j3 ]3 ~% s$ v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. l' j# v/ p) b8 R! \& z
  11. *         TO CHANGE.* C6 c: \% A5 T8 R) W8 {
  12. *
    : L3 _. _' c1 I% P! E) ?. P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % }8 \0 Z0 }3 c) w- n& l
  14. *
    ' k2 T% D( v) g7 k
  15. * This program is free software; you can redistribute it and/or
    ) D% o' X- Q+ G/ n- V
  16. * modify it under the terms of the GNU General Public License as8 F1 }% O8 k0 n: w
  17. * published by the Free Software Foundation version 2.: k+ V$ z- {' A" X& D& y
  18. *
    $ z& S* n1 g" D: ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ R  x7 _! X% @, o8 Y
  20. * kind, whether express or implied; without even the implied warranty6 ?. F) {& t. K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : H0 q+ ]$ x! o$ W
  22. * GNU General Public License for more details./ ?( z$ p' ?  w& w3 W
  23. */& w# B4 _; t% f% ^3 `# F1 \* [" k
  24. ' q+ {6 X, Z) c( I  M2 t& @
  25. #include <linux/module.h>
    : ?$ W) F5 _& P/ ^% S- R
  26. #include <linux/init.h>5 B, |# M' l3 J# b
  27. #include <linux/errno.h>
    : P2 e/ i+ H! h
  28. #include <linux/types.h>( S8 A" _) c# }6 H& c) Z
  29. #include <linux/interrupt.h># n5 w% @3 g' x2 T) a
  30. #include <asm/io.h>9 Y2 G1 F; I3 R& g( f' K  o1 G
  31. #include <linux/moduleparam.h>
      p* U5 b/ R6 R8 T( E8 P( @9 j
  32. #include <linux/sysctl.h>
    - m- @0 o5 k# M( E2 b2 f
  33. #include <linux/mm.h>
    5 v$ q8 ^; o8 k& A
  34. #include <linux/dma-mapping.h>2 d% `. D' g' u1 M$ M

  35. 6 b3 R( C2 ^1 p) W' a
  36. #include <mach/memory.h>
    & P4 O& j  T+ a% z9 z6 x
  37. #include <mach/hardware.h>+ G' Y, u- W# m/ }0 z5 n
  38. #include <mach/irqs.h>
    " e# m& f0 ~0 r) V  ~
  39. #include <asm/hardware/edma.h>
    3 E- \' K- n% P/ h

  40. 6 V  _# b" ^& e- Y! A
  41. #undef EDMA3_DEBUG4 |0 s1 _; k, A
  42. /*#define EDMA3_DEBUG*/
    : ]' _3 j- Q5 ?' @
  43. - ?3 i8 c1 A* j& d7 d; Q+ J  y+ I
  44. #ifdef EDMA3_DEBUG
    3 p1 [) M3 d( ~9 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 n) Z) _2 M% Q0 j! M. Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- {- U* z9 [9 F! y+ a8 y2 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) s) m$ X% c3 q2 y) X4 A
  48. #else& z% K+ G; E: t: Z9 V; X
  49. #define DMA_PRINTK( x... )2 u3 y- [' t, j+ \  n0 ^" ?) F5 @9 y
  50. #define DMA_FN_IN
    # P, u7 N/ D, o9 s9 r' ^
  51. #define DMA_FN_OUT4 T& H+ I' ]1 C1 X/ H, D
  52. #endif
    ' e6 G, \3 P# R

  53. + G- T' S) B; U3 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - b$ t& Z: Y8 `% R% V- h( g7 \
  55. #define STATIC_SHIFT                3& [: M1 Z2 T' h+ S& h& r: T& r* `
  56. #define TCINTEN_SHIFT               20; A. ~' N) ]0 u1 f6 ]/ d, @3 C
  57. #define ITCINTEN_SHIFT              212 B. V8 _# V% Y' n7 a8 n5 P
  58. #define TCCHEN_SHIFT                22
    0 E& ?) x" Z2 {; q' E5 N! ~
  59. #define ITCCHEN_SHIFT               23
    / {  d/ N% B. N% z! M

  60. " C- V/ D3 M: J) m7 y! K( ?- s7 D
  61. static volatile int irqraised1 = 0;
    " z+ C# Z" J1 q; L9 h4 F1 d
  62. static volatile int irqraised2 = 0;
    + ^$ M+ W$ J6 }8 T- ~* D9 N- Q

  63. , T$ l) o( l  q0 t2 h) r2 R0 j( K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* g) v! M- }, T4 _- z# z& i6 N! {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ U/ S. @3 S% L0 P: B* [2 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p1 y+ e& h* J/ K

  67. % @+ L; n" B7 G+ J( p5 m# k
  68. dma_addr_t dmaphyssrc1 = 0;
    & c6 R+ f% |" `7 n2 X
  69. dma_addr_t dmaphyssrc2 = 0;
    5 P% z" T# B8 J
  70. dma_addr_t dmaphysdest1 = 0;3 f  D) B3 @$ c& a  X; A: _
  71. dma_addr_t dmaphysdest2 = 0;
    " k0 u, n0 d" v  W

  72. ) w2 G- s& R( v- w) d$ P/ j0 n
  73. char *dmabufsrc1 = NULL;. Q; E/ h* P- O
  74. char *dmabufsrc2 = NULL;
    1 A' }7 n/ [! R: K2 Z% _, E
  75. char *dmabufdest1 = NULL;! B' u# W3 l: n! T$ P
  76. char *dmabufdest2 = NULL;7 f4 Z# u( z# c3 w# B" u( S
  77. 4 K( h2 G8 T3 ]
  78. static int acnt = 512;
    $ d; O) w" B" {" j% U" v8 {
  79. static int bcnt = 8;
    , w6 Q) \7 T' b* ~0 i# w2 h( J
  80. static int ccnt = 8;# B: V0 v! z* |

  81. 2 Z7 X- b; y+ B: Z
  82. module_param(acnt, int, S_IRUGO);- l# K$ v( b8 N4 L% n* j
  83. module_param(bcnt, int, S_IRUGO);. r! P( L1 u$ `/ D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( j9 z* }) o3 n2 E. R" E) a
6 N- i, W4 y, G! h1 i. L; k/ n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. d5 F/ f' S- W+ r) g) B# L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. Y1 D4 [- t" B: b0 R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ~" ~* W' C* }% u+ J9 g5 U1 r" C: X+ K

1 b; U4 F# B" e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 05:37 , Processed in 0.047507 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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