|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 j: \2 ~. P" s: ?8 Q2 Y( f! k" a* Z2 B
- [code]EDMA sample test application& ~ w, W0 e% p% i) V( [
- /*6 b3 Q- F- ~3 R* j
- * edma_test.c- \" c9 O, I f) a7 [
- *3 C7 ]' i9 B* M% r& T& o7 E; P
- * brief EDMA3 Test Application
+ e9 @2 S$ B6 V! f1 _! D - *# {+ P4 \2 Y' |% t+ h2 l
- * This file contains EDMA3 Test code.0 o! R+ p' i* m9 \1 g4 y
- *
0 \( @) {1 f. {. P4 N9 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% M% s1 _9 u( r) X P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! G) S4 \& X+ Z& R+ r7 K4 m: g& X
- * TO CHANGE.; y$ \+ o ~) r) p- w& {& d
- *" K' V$ p. x7 s5 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 X+ f5 z& [( y: K* p6 l5 M - *! r8 _6 Z! w& Z' z' d+ D1 c2 v
- * This program is free software; you can redistribute it and/or$ R8 W: G u% b3 ^- q& S
- * modify it under the terms of the GNU General Public License as: S0 R% K0 x4 r! J) `: v' _* w
- * published by the Free Software Foundation version 2./ s9 E: N; R s9 W
- *5 M0 ~1 F7 c2 T; `* m2 I' @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 m; \! H1 g8 I! }* o6 S2 \8 |3 w - * kind, whether express or implied; without even the implied warranty
! P0 F u0 K, ?6 R' t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( i _2 e$ U* S% f9 |9 O - * GNU General Public License for more details.# @- c0 J& x0 ~+ |: F
- */
" x, K. Y! Q- N6 d - $ c5 z5 g# ]: I5 O
- #include <linux/module.h>& }. x8 j; k7 r) E' w- \: z
- #include <linux/init.h>
: S p( C* K+ U1 r - #include <linux/errno.h>
! f/ n, m7 l# L/ g - #include <linux/types.h>
4 ]: c) p) L( z( x5 I) t; n% d - #include <linux/interrupt.h>
, K- u" T* u7 q5 ?7 w* @ - #include <asm/io.h>
$ d+ r2 u7 I& o8 l" x - #include <linux/moduleparam.h>
$ ?- n! j5 A |+ v! Z1 @# E) W" N6 ^ - #include <linux/sysctl.h>
- g5 J( v( G( k" e, |2 T6 e: z( T - #include <linux/mm.h>
# M% ^4 J. i: Z0 S) v7 s. L - #include <linux/dma-mapping.h>
0 ~4 c% V! o4 O" o
& _! i+ c% i# w/ A- #include <mach/memory.h>
/ [8 O: l8 R1 e% q% B5 S - #include <mach/hardware.h>
6 }+ x! s( }' q; d1 s7 V - #include <mach/irqs.h>- N) O3 M$ F, h, l4 b8 E8 G
- #include <asm/hardware/edma.h>* O& N: {4 i$ ~
- 8 j" K: U4 c* v( Y& P
- #undef EDMA3_DEBUG" V& ?, j ~8 o* q: q4 ~8 v `2 W9 V
- /*#define EDMA3_DEBUG*/0 Y; J0 P9 E1 m; |* Z2 ^" x
3 N" M4 n( ~ A9 O" V2 }- #ifdef EDMA3_DEBUG" I5 {% G1 b2 e! @$ G/ ]
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# a) a6 m5 S% y6 K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ l& T6 @( F9 e1 M5 n& {) r3 j% Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# f: y. z: f8 n# w! g0 V. k - #else0 @4 Q# h( F- g1 `3 M- ]2 [. i/ p
- #define DMA_PRINTK( x... ) Y( y! e o1 D3 U+ F0 L, T
- #define DMA_FN_IN
: [$ L7 Y! U3 a5 D* M* n/ [( | - #define DMA_FN_OUT
- U5 b- H. U7 _7 N4 E2 K1 o - #endif7 U( @5 D( k4 c% C/ ~ F
1 o9 t/ g: @* W( q; U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 @1 _3 L5 B8 t- H: O, ? - #define STATIC_SHIFT 3
* U9 H& m0 j+ r - #define TCINTEN_SHIFT 20
. t4 F1 X ?# n* W3 P - #define ITCINTEN_SHIFT 21
6 u8 b1 @) x( V! p9 V - #define TCCHEN_SHIFT 22
8 A' I, }1 D* I0 j - #define ITCCHEN_SHIFT 23+ O% T8 V$ U1 e& ^+ |
+ n6 O/ V2 Z1 E* c7 M& c2 ^- static volatile int irqraised1 = 0;" t% \% @- i) C0 P2 g$ l; M
- static volatile int irqraised2 = 0;
+ v0 j4 W# D: ]" n' v9 ~
" E! c5 Z6 e) O6 W+ p" b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. o" K. l7 N9 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ?7 j7 F. l& L3 g$ P+ q) Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 U8 k3 I5 Y' p( V& [
" ~+ h$ D7 n, J0 @7 u8 j- dma_addr_t dmaphyssrc1 = 0;
A4 q$ O$ v' }: X! c5 l ^$ i - dma_addr_t dmaphyssrc2 = 0;
R* r% f' ]5 R" o- M1 Q - dma_addr_t dmaphysdest1 = 0;1 {/ i/ h8 |, C% s9 C+ _
- dma_addr_t dmaphysdest2 = 0;
& ^' H' a+ \2 B+ t7 `) H5 A/ d
9 ]( t; n& j; H- char *dmabufsrc1 = NULL;
0 E( w2 K+ h' m8 u, | - char *dmabufsrc2 = NULL; _3 T3 E; X% I$ e
- char *dmabufdest1 = NULL;6 Y* H# d9 q+ `, t* o' D3 C
- char *dmabufdest2 = NULL;
& S/ w) ~; a! ~7 Q
+ C+ m* n* \8 Z( ?% o" ]0 V1 \- static int acnt = 512; M% A. ?" _+ v4 n( C* @/ y, S! i
- static int bcnt = 8;
! }0 S: J7 `6 h, L. }+ h( c( C- C - static int ccnt = 8;
+ B9 V |! N9 l: q8 ]
9 Q. \/ [, W) X' _- module_param(acnt, int, S_IRUGO);) F+ ?* }% ]) L+ e T
- module_param(bcnt, int, S_IRUGO);
: S/ M: B- O: b5 K* n k1 e - module_param(ccnt, int, S_IRUGO);
复制代码
9 y! i# {! Z* A* q3 c. d
' |) G$ T; i! q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) a* T5 n) z9 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( r( T2 \4 p, V$ C; O, z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; X( _( w/ |4 Y; j; d. J- s+ {6 p# f _! x
/ x# w* W1 e3 f8 S- f& u2 k |
|