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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) ?4 s2 M/ Z# e8 k- f' u" z
  1. [code]EDMA sample test application
    # i8 N" V* h7 }6 }& w+ j1 d
  2. /*
    4 j- t. N2 N' f( V6 K$ j
  3. * edma_test.c, x& B$ c: P6 ~
  4. *
    . r) Z" {" C0 ?/ U, _+ _' y' L( V
  5. * brief  EDMA3 Test Application) B7 B9 R1 e' w* Q4 a3 `
  6. *5 t" F$ {2 e' d  H0 Q: I
  7. *   This file contains EDMA3 Test code.1 K% O% |4 ?- C6 ^7 t  E$ ]6 I% O
  8. *
    0 e" F. z1 g2 m' k$ I* q0 ^5 z- U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) P& N- l7 z6 C' E% _- L' Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( k2 K* H, P3 f! n
  11. *         TO CHANGE.
    3 d: \% I. a* _1 w( `
  12. *
    + ~. Q. w) H6 n4 t/ D& m. h/ K+ a# d, a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ~# T. Q/ I& |2 s) }( l$ u; F
  14. *
    $ Q: z7 k3 [8 F' i
  15. * This program is free software; you can redistribute it and/or
    4 R7 I/ m( ^- s1 k# Z
  16. * modify it under the terms of the GNU General Public License as3 u1 K( m$ ^/ W0 s# s  o4 Z& X4 s
  17. * published by the Free Software Foundation version 2.
    7 t! H3 i5 \0 D" j, D
  18. *1 e' n& o9 P3 q8 h7 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 e( K+ _1 Q0 N5 u
  20. * kind, whether express or implied; without even the implied warranty
    , x5 F! u* a: g, V$ C- h+ g' y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 I. r  Y4 U9 {2 H* c
  22. * GNU General Public License for more details.: x6 m4 F2 V  u, E  v, h! Y% d" {! t
  23. */
    . Z. [  z1 d6 t" z" N$ ]
  24. " E0 X% L/ T7 g2 s( t% w8 h8 Z
  25. #include <linux/module.h>
    ! Z# L7 v2 O' {5 Z5 o2 M8 t# f
  26. #include <linux/init.h>8 V) t1 Q0 Z  l) g$ O+ k% p2 n; I
  27. #include <linux/errno.h>' Y  t" F+ P) i- x+ Q
  28. #include <linux/types.h>1 Q3 A/ r' D* c
  29. #include <linux/interrupt.h>
    ; c1 h& X& e+ _4 ^
  30. #include <asm/io.h>
    2 Y. i' \* d! E$ C7 Q6 \
  31. #include <linux/moduleparam.h>
    # W+ x( {' P( P4 j( E" U; B. V
  32. #include <linux/sysctl.h>
    # [8 Y; Y: [# l  Y( ?! `, J
  33. #include <linux/mm.h>
    ; i, k8 t! ]4 ~8 m. |
  34. #include <linux/dma-mapping.h>- P/ D" K9 k, a! C

  35. 1 E( L/ s7 J& S3 D
  36. #include <mach/memory.h>& A8 P& x! q2 C; u
  37. #include <mach/hardware.h># {# M0 Y# c4 T, }1 a5 |7 g6 y
  38. #include <mach/irqs.h>
    , w- f; q; _  H  Y+ P
  39. #include <asm/hardware/edma.h>! |. {" h& `' a7 j! q

  40. 2 {7 ^. q0 m2 g) D9 j
  41. #undef EDMA3_DEBUG8 b; S% h( U3 j4 e4 ?
  42. /*#define EDMA3_DEBUG*/; L0 v& G8 |2 n
  43. 3 T1 {# x! b- K: a! J
  44. #ifdef EDMA3_DEBUG9 I2 t$ f7 I& S5 w5 p* ]" s' t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' O+ K4 D# h/ w& g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / ]1 V; J9 C. |5 S8 H( m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* `% ]- ]" g4 I* |- a6 W9 p/ U
  48. #else7 K3 p: v: D9 ~
  49. #define DMA_PRINTK( x... )
    + ~" p/ \! [) m+ O% z/ b/ O7 J
  50. #define DMA_FN_IN
    $ ~8 [& r8 |: Y/ t: b( q3 i
  51. #define DMA_FN_OUT! Z  U1 {( s" @9 J  ^* h$ X
  52. #endif8 T, [- B: D% O' M* E( J/ f
  53. 1 I" z  I# @; N0 P) j' c. \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 |& N' \' X3 c" I$ h6 W
  55. #define STATIC_SHIFT                3
    4 F6 d+ n/ A% o# ?8 N8 A) N; D
  56. #define TCINTEN_SHIFT               20
    ( [+ g/ P( i* i. y+ d: ^
  57. #define ITCINTEN_SHIFT              21
    % Y$ n1 n0 e6 L3 F) ^1 B( _  ~
  58. #define TCCHEN_SHIFT                22
    / M, C6 [0 t$ e! d6 v4 Z
  59. #define ITCCHEN_SHIFT               23
    ! L: g, d$ x; Y5 r; n
  60. 0 C) x+ t9 ^. W9 I6 z. n
  61. static volatile int irqraised1 = 0;
    3 p3 b( M, `# J. n% e0 {* M5 u' \+ P
  62. static volatile int irqraised2 = 0;- ]( F# k2 L7 B7 l9 J" H
  63. ) f' d2 m0 d1 g1 U2 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! |1 Y" f+ b1 d1 i4 C* [* V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) l' |9 n# F' Q' S7 [% o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 A8 i6 r6 r; K' t, I2 E7 j+ W
  67. 7 q, K) H! ]5 Y4 q4 M
  68. dma_addr_t dmaphyssrc1 = 0;5 x& \2 @$ J0 O& S* {( Z6 A; `
  69. dma_addr_t dmaphyssrc2 = 0;
    6 d- V. w2 G! q% a
  70. dma_addr_t dmaphysdest1 = 0;" s- m7 }0 _. L. V5 z
  71. dma_addr_t dmaphysdest2 = 0;/ O. ?) n$ m7 y; w' i& h

  72. . x3 j4 b8 F& Q- s2 q* B
  73. char *dmabufsrc1 = NULL;
    ' x. j$ o. e. s  q
  74. char *dmabufsrc2 = NULL;6 T" }5 e9 {$ r( r3 Y  Z+ m2 O  R. q  f
  75. char *dmabufdest1 = NULL;7 p2 X; ^' P4 j2 C  e+ g/ C. A
  76. char *dmabufdest2 = NULL;% H' Z% p9 `! L8 w. H8 t8 t; B- P/ Y

  77. . q1 a; l: \3 H8 ]7 k: h
  78. static int acnt = 512;3 B& N* D; t9 _+ R" f! a9 Y
  79. static int bcnt = 8;
    . ?) i9 j% M; W: G3 c
  80. static int ccnt = 8;
    ) U0 e* V# I8 n0 T* q
  81. , M# \% T) g- B) v  C, q
  82. module_param(acnt, int, S_IRUGO);. R1 I1 Y& A5 j. k; t: [
  83. module_param(bcnt, int, S_IRUGO);
    : l' S" B$ i) L- t/ b3 J; F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! N* g& E- H/ `/ [* R

7 z! ?9 i/ y( U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ q* y/ t& G4 O& tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: Q! Q# Y# y2 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( p- W& U5 b! ~  e! _' H6 \$ S1 C0 k5 Y) V5 |0 Q* ?4 c8 }

+ Q2 Y% N7 i* u: S; D/ v+ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 13:54 , Processed in 0.043061 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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