|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - q( M1 U5 L% M7 `/ K4 Y
- [code]EDMA sample test application
% |! y l3 V* ^0 p$ z - /*
7 l- q9 F! H% M* {; _. o - * edma_test.c
) L# y* n4 [$ }% I7 H! R: [$ F% o - *
) h+ {1 s8 t; X8 y - * brief EDMA3 Test Application0 ]* n8 q; Y2 e' w6 m: g# E
- *
1 y9 C2 {4 W4 Y0 u4 O2 W6 w. e - * This file contains EDMA3 Test code.
# p+ O v1 y: N - *
' y9 j( z" k' T7 y0 p, \' Q. M" \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" d s3 }; B% u1 R) L: b8 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ N; Y" V( K, @3 b2 _7 [: u
- * TO CHANGE. |9 l/ I- b8 W: C7 }+ s4 c c
- *
8 i& g3 e8 n; b6 F% F0 S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; W, r' ~6 T; `: V* n
- *
/ H, W2 X- x; L: [( F7 f, i - * This program is free software; you can redistribute it and/or( S3 Z7 N+ e# o, m, g
- * modify it under the terms of the GNU General Public License as" ~" l8 e- O* W b9 {& U
- * published by the Free Software Foundation version 2.: n! Y# g7 J% _
- *+ g1 s& s6 ^0 O$ c _0 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }1 P7 T+ L7 p R$ E) P
- * kind, whether express or implied; without even the implied warranty
3 V8 I \" S, n6 w8 y) p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* h2 u1 M" C L; R% t8 K
- * GNU General Public License for more details.
7 ?) a' O: R& d# X1 p( n1 n - */
5 c' e: H( s8 c8 d% q* j {6 @6 C
, E" _$ f" t+ `7 U% G* O- #include <linux/module.h># m+ w1 l' A; _2 _2 z
- #include <linux/init.h>
+ a! G/ g0 h& B" J2 R5 \# w7 l1 ]. \ - #include <linux/errno.h>0 \9 g* n$ N. `" P- j/ G
- #include <linux/types.h>
q6 p) u6 D6 E$ X' n/ b# b - #include <linux/interrupt.h>* |/ d; f, W- ]. b l/ Q
- #include <asm/io.h>6 r* D2 A/ D+ @5 r
- #include <linux/moduleparam.h>; j0 _9 ]1 Z' P, Q2 A- b
- #include <linux/sysctl.h>- M( Z( w8 ]; u( J& Q, j; Q5 o0 M
- #include <linux/mm.h>
% V N$ f7 f3 V7 T( K - #include <linux/dma-mapping.h>* F2 w ?$ d' ^5 D) U( l1 d1 F$ N( G
9 f+ ^' p( Q+ r) M! C- #include <mach/memory.h>1 o7 e) p& w( Q6 F" U
- #include <mach/hardware.h>6 }5 S! `7 R: t
- #include <mach/irqs.h>/ k& o$ C; I: v/ G
- #include <asm/hardware/edma.h>1 n0 \0 A6 u% }# D% Y/ I
4 Y6 l2 O) l! n; i- #undef EDMA3_DEBUG
( V1 {% r% [' l' V$ i; b5 t1 C - /*#define EDMA3_DEBUG*/
. g% p, E: y2 O3 H
, \" S9 Q- c% C/ c# c- #ifdef EDMA3_DEBUG
3 m+ `: F& c+ Y& T* K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 ?$ v& B2 [* ?2 ?9 f# W' } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 \% R0 @9 o- W' }' h$ Y9 F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# ^3 N5 e' F1 |# I7 Z - #else
" x& ?4 B4 h, n( n# r9 y: I9 }4 i - #define DMA_PRINTK( x... )& w, b# b4 q9 m3 o2 C4 \6 \5 l! h) |8 q
- #define DMA_FN_IN
% Y, o: S/ _( c9 D8 q - #define DMA_FN_OUT$ H5 M) X6 [3 P
- #endif
! f0 g# }9 c% J I
) w' P' m) K# [4 b- L1 P/ h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ G7 R5 [* G, C! @5 T
- #define STATIC_SHIFT 3
# U9 Y: h0 J. c! A5 M0 L - #define TCINTEN_SHIFT 20
. q9 R# a- c) A" ~9 i1 R - #define ITCINTEN_SHIFT 21; |$ k, g4 K5 u5 `* J0 f5 Q& c
- #define TCCHEN_SHIFT 22* n$ g7 h2 N. d% ~
- #define ITCCHEN_SHIFT 23
3 y# ~$ |% T: q. D0 w - 8 G- E$ k7 w. C, h9 R
- static volatile int irqraised1 = 0;
6 [" l! `/ J' j( `# t" E - static volatile int irqraised2 = 0;+ w. n+ [+ y5 x& w4 y: B! j
- + N* m* \. y0 a+ n$ m2 w! ?' h! s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) f' |" n( H$ G, I& U' d/ y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& S. A+ V H: s2 a$ ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 `4 Q9 H# N1 W2 C% \4 O$ Y8 a
1 @6 K. Q+ J/ Q! e6 B# } n- t; |- dma_addr_t dmaphyssrc1 = 0;' K1 f) c) G7 N: i- D( d
- dma_addr_t dmaphyssrc2 = 0;
$ [( t5 n- a& J& @; ^# Y3 X - dma_addr_t dmaphysdest1 = 0;6 ?- J8 a) N* A
- dma_addr_t dmaphysdest2 = 0;
+ `$ a, C' a4 Z0 d& L# I' x
' C# W( F- P- x; ^# U- char *dmabufsrc1 = NULL;
1 U( Q# z; n# y/ g6 W3 S - char *dmabufsrc2 = NULL;( e( [0 T! K2 P* k: j8 A* t
- char *dmabufdest1 = NULL;
P5 F( ]& O- L# X* m3 Y! z3 D" F- J - char *dmabufdest2 = NULL;
& C3 x) W: F" H; O/ |& R. d( Y/ c
$ U J N+ L- _* w2 i- static int acnt = 512;
% r9 c( D) R0 n/ h6 d+ @ - static int bcnt = 8;
8 d/ [, ]0 ?6 C - static int ccnt = 8;
7 d8 H0 n+ |3 m( R" t3 w
( o; \9 u5 K2 |' b' Y& d/ ^- module_param(acnt, int, S_IRUGO);
& `+ v4 G5 t6 }, }5 Q1 ` - module_param(bcnt, int, S_IRUGO);
4 |; r% c! n" m6 \& @ - module_param(ccnt, int, S_IRUGO);
复制代码
) P1 d+ {, }9 |( Y/ h3 h3 o
9 U; M% I9 v# \9 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {" m5 ^) x" q% t7 _% Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 C* f6 I) M! d, z! F: ^- H4 J; T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" X8 |* S* @. h9 f
/ j# r( o- r- m' F; M/ w
& w# v- _3 D& V" n |
|