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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( \8 _7 f+ u% N. f7 D' C2 `
  1. [code]EDMA sample test application
    ' S" E) C; z. }$ u% a8 _
  2. /*
    1 R3 ?" J5 f% T$ K' m4 z9 I
  3. * edma_test.c
    + \( x& y( I( W6 S
  4. *3 R2 W, Z# u* b! p# N0 ?0 i
  5. * brief  EDMA3 Test Application& }% |, N$ d' L% D( R& N) H
  6. */ ~! G4 [' O% ]7 f+ @0 c
  7. *   This file contains EDMA3 Test code.
    . x; y7 D3 I8 L3 C4 z" q
  8. *. C& r: R$ Z! T9 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ E3 ]" L9 F( q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ~, q: Y4 R$ Q* }4 w3 [9 w  ~2 @
  11. *         TO CHANGE./ `3 w, ]# q) `; ^' }
  12. *- u* N+ e7 Z) Y$ |- x1 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 X/ M  B! ?2 [9 r2 {! V3 w1 f
  14. *, q( O* R5 l8 _$ E
  15. * This program is free software; you can redistribute it and/or
    ( B& q; O, U: i- W8 @& P4 T
  16. * modify it under the terms of the GNU General Public License as3 J" ?9 Y/ p/ g' J+ \! g8 G
  17. * published by the Free Software Foundation version 2.2 Y4 N) M1 {& ?1 U" L9 Y; Q; ^, x
  18. *6 \- \( C# P# j5 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 f4 ~- x8 t7 f# i: B: Y
  20. * kind, whether express or implied; without even the implied warranty
    , R& Q. T& [5 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. Q5 [4 g$ x* V: i
  22. * GNU General Public License for more details.
    + Y) C. U6 {! X  k0 v% G' C
  23. */
    1 H7 G* ^! ?# B% u/ ]( t

  24. 9 p  g2 I: s9 W5 U# ]) L  Z
  25. #include <linux/module.h>
    7 _; A& V6 O' ^
  26. #include <linux/init.h>
    1 a3 ]8 ^+ ~, s' W" ]
  27. #include <linux/errno.h>4 V2 j, ]% b1 r3 s
  28. #include <linux/types.h>0 \6 N2 w1 t/ x8 o0 n
  29. #include <linux/interrupt.h>
    % @9 k2 W" h4 a8 V$ `
  30. #include <asm/io.h>
    5 [; y# B6 Q9 K# f# z3 O- d
  31. #include <linux/moduleparam.h>  [) M( U& |$ z' V, r4 G/ T
  32. #include <linux/sysctl.h>4 {" v0 A0 d4 e' n6 J7 H! E
  33. #include <linux/mm.h>2 \. }, U% N* ^( |- L
  34. #include <linux/dma-mapping.h>
    . g1 Z3 M) x2 K3 U2 C; n3 m
  35. 5 K" b; R2 T* z# D' s
  36. #include <mach/memory.h>( \+ q- G- r7 h0 `7 D1 r
  37. #include <mach/hardware.h>' [& m0 i. e2 x3 i/ T5 q" l8 N
  38. #include <mach/irqs.h>5 g5 ?: n6 [/ `
  39. #include <asm/hardware/edma.h>
    3 T9 J- r5 z2 X+ i9 B2 i5 D
  40. , f) _1 Y, K% p
  41. #undef EDMA3_DEBUG* B# ]. I7 R, K! e( X/ }5 N7 G3 S+ n
  42. /*#define EDMA3_DEBUG*/# _( t) M) N! e# ?8 Y( s
  43. . J8 J  w- Y6 N$ p) E2 W
  44. #ifdef EDMA3_DEBUG
    $ u6 S. Y2 m4 n. t# i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 D, q9 ~3 o0 u0 R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# f4 M! N6 p0 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; O% n: p' q) `7 s8 h, T  s
  48. #else
    " n0 M2 ?, ~* J5 F5 a% g6 \/ o
  49. #define DMA_PRINTK( x... )  {/ V5 r8 O: _( T6 `1 c9 w
  50. #define DMA_FN_IN
    + _% t7 a% f6 H% W
  51. #define DMA_FN_OUT/ p( o  l- j& [3 u7 Z$ K" P
  52. #endif
    7 ^/ n/ M3 D# S6 x% [# Z, q
  53. # Y7 y/ C/ ?# v: B/ a; a; ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 W3 b8 M2 O: H% p9 X$ w# v4 y- o' d
  55. #define STATIC_SHIFT                3: }, P) H+ Y! @' ]
  56. #define TCINTEN_SHIFT               200 @2 c" K9 ]6 s! o$ X; o/ q
  57. #define ITCINTEN_SHIFT              21
    9 O3 w# W* u* E1 N! S' M
  58. #define TCCHEN_SHIFT                22' o* }3 V) E5 K# h
  59. #define ITCCHEN_SHIFT               23* U  Y- f4 |+ J7 o% I& g

  60. ! w8 i( w& T' e  e) w! \) P
  61. static volatile int irqraised1 = 0;- b$ W# D  Z. W* b
  62. static volatile int irqraised2 = 0;
    6 ?/ J0 Y2 I* P# l

  63. , n: \  Z2 F: H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~- n% R" H$ v. t$ _, d$ a. ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Q- r& g; D4 N( U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 v4 s& }1 Z  z/ l+ T

  67. 7 S0 u/ h1 B* p4 _; p( }
  68. dma_addr_t dmaphyssrc1 = 0;9 K1 f$ `8 R. k  i# V
  69. dma_addr_t dmaphyssrc2 = 0;0 l, u- n9 i  y( q0 S
  70. dma_addr_t dmaphysdest1 = 0;1 @3 L- r$ D; M; c9 V& }: x
  71. dma_addr_t dmaphysdest2 = 0;- y( Z6 ~  _# {  y! u8 z

  72. 0 i1 V* U/ \7 G; I# Q
  73. char *dmabufsrc1 = NULL;# t/ I2 ]0 Z  U) R  P* ]
  74. char *dmabufsrc2 = NULL;% ^; \& @  ^$ h
  75. char *dmabufdest1 = NULL;
    8 u( r; R' S$ p; m
  76. char *dmabufdest2 = NULL;+ @5 F6 ~& N2 z3 m  v: @2 R( q

  77. 5 w) W. W1 S6 R, I2 ~0 y
  78. static int acnt = 512;
    + h' _- T$ U0 \+ U
  79. static int bcnt = 8;% U8 R2 n2 j' ]6 ?  s( r
  80. static int ccnt = 8;. J* w! O/ n8 {+ O/ @. E- ]& A  k
  81. % H$ K8 y9 Z7 t! j" i. d
  82. module_param(acnt, int, S_IRUGO);
    / I; x" m, Q# s, e' g+ f% C
  83. module_param(bcnt, int, S_IRUGO);# K% d* b* {8 ?; y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 y$ o8 h, R$ l$ E  F2 x% f, P; i+ V* W7 `# t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 r5 S; v; K2 I: M  j" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 {, v5 Z! Y! i; l; `& U& B0 R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ]! E: l; x$ S4 l& T

7 ^9 O  h6 c, [" B# ?3 d; O
% g3 a- O7 n6 T( L+ h  o7 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 23:17 , Processed in 0.039026 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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