|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 m8 c6 n8 j5 u" ]- Z' t& p/ _" Y8 g- [code]EDMA sample test application
# s8 L% G- J- R ^ - /*/ F( z, D& k7 }3 r8 ^9 U9 N
- * edma_test.c
6 P1 K) a! J s2 { n9 P - *) _* |( W# u) ]5 e0 m
- * brief EDMA3 Test Application
4 t, R) K8 _- X - *% G2 l3 {) \; G
- * This file contains EDMA3 Test code.
7 h$ [% b+ D8 `4 }; E/ _* c - *5 L( d2 O6 S' n: U5 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 @; ~0 n0 |8 d1 D/ `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 R, q: t/ O2 a( Z7 z - * TO CHANGE.0 h0 g+ }4 V8 _ |% w
- *$ [& {- J- K! Q% [) ]7 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 }) ]2 {) q1 {2 R; M& L+ x- D" C
- *7 K+ @7 C2 n% m* w' N0 H
- * This program is free software; you can redistribute it and/or" _/ r; ?: o, d, U* W' ~
- * modify it under the terms of the GNU General Public License as6 t% d- O* g: C/ m7 H/ e4 Z2 f! @
- * published by the Free Software Foundation version 2.
1 u, w6 c" X# T; F8 F$ p; w9 | - *
! v& ]8 F8 C0 g' i4 ^5 r c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% h- ~/ v/ c& b3 A% d9 t
- * kind, whether express or implied; without even the implied warranty
$ p8 s) T/ b9 o: f u7 z( R& S8 Y1 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 c: g& d8 w1 {' Q* z. W1 D6 X
- * GNU General Public License for more details.( b$ q% b. T6 s4 @
- */- w' M9 [, ]) _# q# @" j: e
- V7 z6 A; ]9 | q$ g
- #include <linux/module.h>
' d* Y* {2 }- {; ?# ?' | - #include <linux/init.h>5 O# j% \0 x2 b9 {' c' b
- #include <linux/errno.h>' E- b+ e" R# |
- #include <linux/types.h> W. H8 ?- O; D M$ ?
- #include <linux/interrupt.h>/ ]* m& g9 x7 f* t
- #include <asm/io.h>( F( x# o( H1 S# I: Y' p# ?
- #include <linux/moduleparam.h>2 C! F7 e: N0 m5 l. |( n
- #include <linux/sysctl.h>) Z/ H$ N( F( l4 g9 r% S1 ] Y ?
- #include <linux/mm.h>
0 H& O% l# G; t. k4 {* [$ H - #include <linux/dma-mapping.h>: ]+ s9 q8 E& p- P/ M7 N
; B+ ]6 p5 ?9 ]- Y# _' U- #include <mach/memory.h>
9 p; s4 n! |& c/ G F - #include <mach/hardware.h>
4 k F- N' a# \% \, z8 V6 [ - #include <mach/irqs.h>
$ E5 ^) _& y) u6 k: { - #include <asm/hardware/edma.h>, H( f2 r/ [6 O
- % Z6 C. F; _4 g+ T% T+ R: U
- #undef EDMA3_DEBUG% Q9 ]' I9 Z7 }6 ~
- /*#define EDMA3_DEBUG*/
$ Q( _$ j4 c5 q2 ~& _ - ' f/ t1 o. N% L$ V8 T' x8 Y
- #ifdef EDMA3_DEBUG% U6 Q* C5 p& m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 J& D0 c" m: J6 ^/ E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 u: @* d+ d0 F; i, W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& n) q. u. B/ {! V - #else
3 W3 K+ T# {* Y9 t - #define DMA_PRINTK( x... )% O- u, Q* o' B- j
- #define DMA_FN_IN
( F ~% A$ L& {0 a - #define DMA_FN_OUT/ K* R/ O0 ]; l$ S) v; ^1 Y
- #endif
* s6 R( Y: s7 H$ T# F, f% S- P - : o5 N- z& h5 J% S& _0 z% h% `7 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 n5 C$ _! P( E" A! U/ E$ ?
- #define STATIC_SHIFT 3
3 c! ?% `) I7 L4 |0 q' r - #define TCINTEN_SHIFT 20# p+ r: F0 X0 F f% w+ j$ w& ]8 I2 p
- #define ITCINTEN_SHIFT 21
$ u/ @2 g c1 u: \8 |' L y - #define TCCHEN_SHIFT 22/ x' X) y& c/ q& l8 ?0 z# P
- #define ITCCHEN_SHIFT 23
0 d) t4 W9 U4 |7 N1 e$ y- _ - 8 g z" [( T' K9 z, _
- static volatile int irqraised1 = 0;
" w/ H! S( f! L/ J - static volatile int irqraised2 = 0;
3 |4 t* {9 T! W2 Y# f - g Q6 L8 s7 N' R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ _* a* ^( @/ `: q& V! \9 J) ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 h' w# k- a4 I& T2 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~6 H0 _0 ], O2 f
* o$ B* e8 b n- \ p- dma_addr_t dmaphyssrc1 = 0;; {+ x& ~. e/ e! l
- dma_addr_t dmaphyssrc2 = 0;
- p' e5 W+ _% l8 a - dma_addr_t dmaphysdest1 = 0;
: T$ g8 j0 Z* o* b' b - dma_addr_t dmaphysdest2 = 0;
* ^# k5 @: Z6 i1 m4 T5 R. d - 9 Y6 ~' Q: g8 f/ c0 t* q
- char *dmabufsrc1 = NULL;& J$ K! o: e+ |
- char *dmabufsrc2 = NULL;6 \( I: M+ i0 M8 M
- char *dmabufdest1 = NULL;# f. I( F) q/ f- C# I5 ^# R
- char *dmabufdest2 = NULL;
q. W# O$ k+ ?, Y$ A - 3 }9 y' n/ I2 M! ?% j: H
- static int acnt = 512;
: o+ N4 c0 q% p/ M" I" V3 K; P - static int bcnt = 8;
$ u' P/ w o' f* v/ l6 t" { - static int ccnt = 8;
+ i; [2 h* Q F* J( ~2 g. \* d( N' | - - |+ d: y" r2 D ^
- module_param(acnt, int, S_IRUGO);3 Y& T/ a1 e# j( X% e
- module_param(bcnt, int, S_IRUGO);' p m+ g- W8 v) v* {
- module_param(ccnt, int, S_IRUGO);
复制代码
3 B, c! G- g5 Q) R h1 s& H2 ^. |; a4 U% W5 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: {; W' z) Q* x, F) E: d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O, s- t, e* V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 @9 J5 S& N6 q9 q" m: c7 B/ k) h6 g/ ~
$ M; B. j, E3 E3 g
|
|