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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + ?1 t9 S4 A: O$ t2 {& S
  1. [code]EDMA sample test application
    ; ^$ k) Z2 Y% A& h3 U
  2. /*7 ]8 b& o/ c: C% I/ S& r; }
  3. * edma_test.c
    : b& E# K4 n9 O: Z' A: J. A+ _
  4. *: |9 A4 Q# Z9 i
  5. * brief  EDMA3 Test Application
    % P- y8 y6 m$ l) u: f
  6. *; E0 b, D6 y( n! c" f
  7. *   This file contains EDMA3 Test code.8 Q/ C( ]) @  q6 E4 f0 D- U6 s
  8. *
    & F* l& l/ |2 x! R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 y+ j8 w$ I2 p" @) d' o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( P* }! u& E" m+ h8 l9 n" j/ o
  11. *         TO CHANGE.3 @' o5 @0 z: i( N
  12. *% g: H$ P$ A. \* D: z  N! c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! L  C) u$ l" Y+ G: Z3 t7 M
  14. */ y7 L0 r) q  C/ a
  15. * This program is free software; you can redistribute it and/or
    & ~) o) w: r/ y" V8 v# ~  e2 E
  16. * modify it under the terms of the GNU General Public License as
    5 k6 c% z% N+ o" ?* N4 O& \
  17. * published by the Free Software Foundation version 2.* ~) k/ Z( P2 L! a2 l9 O; s' Q4 x
  18. *+ r* z# ~* J8 p1 S$ d6 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% p/ J0 H0 E, y  D9 t
  20. * kind, whether express or implied; without even the implied warranty" @8 v7 u9 Z+ e% }9 |3 R8 ^5 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  \! |) P) W0 j; E
  22. * GNU General Public License for more details.
    # h! f( `; n% {2 H
  23. */
    / m7 i( e) n# q7 t2 t, e3 V

  24. : [" x6 F( u5 a  }) P+ n$ V
  25. #include <linux/module.h>
    9 W  o  D8 I( N: ~7 c5 [8 k4 |
  26. #include <linux/init.h>
    ; M/ f  B& N) h
  27. #include <linux/errno.h>* |- k$ x( G6 T8 a2 k
  28. #include <linux/types.h># ^: {  P. Z# N4 U- y* ~0 F
  29. #include <linux/interrupt.h>, }  J0 ?  @. b
  30. #include <asm/io.h>
    : B6 k! H4 c$ R3 ^2 D/ t6 P* {$ X
  31. #include <linux/moduleparam.h>+ i+ u9 q2 c( |( h
  32. #include <linux/sysctl.h>0 v1 {2 f" b7 x9 M# A1 r4 C( H: v
  33. #include <linux/mm.h>
    - a8 l* ~! k: P5 h, x, K/ L
  34. #include <linux/dma-mapping.h>
    6 i- E2 _7 n5 s6 k# w
  35. " e5 H0 e2 c5 a4 z5 o
  36. #include <mach/memory.h>
    0 a3 u& j: w- m, r4 T9 c4 Z% X/ _: O8 |  m
  37. #include <mach/hardware.h>
    7 f7 U+ H# D0 A5 p8 T
  38. #include <mach/irqs.h>
    , i$ O: E8 [* N$ h6 w/ t( @: q( e8 |
  39. #include <asm/hardware/edma.h>* r. _0 @$ I' d$ U  r8 Q

  40. 5 m3 y' ]. M: U5 a2 D. P* d/ Y
  41. #undef EDMA3_DEBUG0 C' e( k- [8 U
  42. /*#define EDMA3_DEBUG*/3 W1 B% }5 p& e

  43. ; K7 J$ t: b" D
  44. #ifdef EDMA3_DEBUG+ U: c, y& R1 c4 @3 a% M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 O* o9 y* m4 A: M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) N  ?3 _: d- J0 t2 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ N* u& n# `0 s% n+ ?
  48. #else
    6 \" g% E8 ~( U6 z, f
  49. #define DMA_PRINTK( x... ); I9 I% ?- e7 }, ?3 g
  50. #define DMA_FN_IN3 o+ c1 ^* F; L9 x6 F4 T  J4 R
  51. #define DMA_FN_OUT; _& [' V$ v- ~, ^
  52. #endif
    4 `( f* `  L5 Z8 p% s& m7 \

  53. ! \. N4 V7 h1 R5 J7 V3 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 @6 M# n9 }& b5 L& l( x
  55. #define STATIC_SHIFT                3
    6 s: K! v2 z: }8 f. ~
  56. #define TCINTEN_SHIFT               20
    : A9 t- r/ d& C) @1 x$ U
  57. #define ITCINTEN_SHIFT              21
    9 b$ n" k% M$ P3 }$ G1 }
  58. #define TCCHEN_SHIFT                22! ~, ?6 \+ r$ Y. @2 y- p# {( d: Y3 v
  59. #define ITCCHEN_SHIFT               23
    " S3 D) C8 b- r  O

  60. % g$ W0 A2 x, C* ?2 M% a* a
  61. static volatile int irqraised1 = 0;0 |1 q* P8 Y* W9 A) s5 J; T5 u
  62. static volatile int irqraised2 = 0;
    5 D% i1 j: T. p8 T3 E- _+ x

  63. 6 L: d; H/ |/ V/ \$ i$ `2 U8 r% @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " z% ^4 k% N1 {7 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - M5 y3 p- B6 x/ u1 H4 y7 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: [5 `/ f. r5 _! u
  67. % D: ?! m- i# t! U2 L% p
  68. dma_addr_t dmaphyssrc1 = 0;
    % L$ J0 H2 V% w: g: _# b" d0 o# G
  69. dma_addr_t dmaphyssrc2 = 0;9 D# o  g$ F2 M
  70. dma_addr_t dmaphysdest1 = 0;
    4 G* @/ ^2 V' p- O
  71. dma_addr_t dmaphysdest2 = 0;) p$ _0 Z) ]" Y# V* e
  72. ! b) B& O4 S$ Z' [, @
  73. char *dmabufsrc1 = NULL;
      L! }/ g% p" Y; b' [& t
  74. char *dmabufsrc2 = NULL;+ ^  w; {0 r+ P3 {2 N
  75. char *dmabufdest1 = NULL;
    ( k, h8 u1 e! U! @! {$ R
  76. char *dmabufdest2 = NULL;6 |* l$ l: h: {. b

  77. 0 |) T* {/ V" o! ~# o3 m9 z
  78. static int acnt = 512;
    2 _/ P  z" s* x% R
  79. static int bcnt = 8;, F  I4 u" e8 k
  80. static int ccnt = 8;( P0 D: D8 L" \1 g/ c

  81. 6 _3 r: ^( r8 w  Y
  82. module_param(acnt, int, S_IRUGO);
      b" g1 w  y- W* ]$ k! _
  83. module_param(bcnt, int, S_IRUGO);
    9 N: S0 Z& U4 r5 L" `$ J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( M+ m$ `9 E$ K! `& E7 r
( o- E3 Q2 h8 Q0 f, e2 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% h7 T' V3 m! c# b2 H7 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ H  Z( N! H1 R. W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# j5 c8 G. N9 P2 F4 G

3 `% i$ a% b  ^- x* F7 Q3 x4 Y' \1 w* D% Q4 ?0 ]5 y- C" w: Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-9 10:14 , Processed in 0.044568 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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