|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * [& M, d; E$ R" ^% L' g. k' k% @- v
- [code]EDMA sample test application0 |& K/ |0 h) `9 J* r! r2 N
- /*4 A, g. c( P' m7 r( v8 h
- * edma_test.c) K2 Q9 ]% L( d( z& d4 d* R
- *
( ^9 m: C- c3 k5 U9 s - * brief EDMA3 Test Application S1 \; O/ u8 A( G3 Q; R# b; }5 b
- *$ d7 x! Z5 I1 a# U& h8 @
- * This file contains EDMA3 Test code.% \/ j( K4 Z, q8 v" x" y( m& U$ ~
- *
1 u" e9 R! m* k' S. h( G# B D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 \+ n' D& @5 i7 D/ y% ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ H" _) {8 Z& |
- * TO CHANGE.) i+ _5 @" M# L
- *
+ N$ [; o$ R' S& k& l% G" E* {6 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) @% F5 K. u/ A y- ?9 \
- *
. P7 M$ b, _+ }4 P) I, p - * This program is free software; you can redistribute it and/or
' p! w0 G9 p3 y. p6 q9 ]9 o5 | - * modify it under the terms of the GNU General Public License as G) _; R3 W1 \1 t. ^# J
- * published by the Free Software Foundation version 2.) X6 O0 H! k P) Q! [9 W
- *& U4 g4 `$ t- |6 ^7 N8 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 O5 o$ V/ y p4 P& n% }% d3 p0 @ - * kind, whether express or implied; without even the implied warranty
; e* L4 j( y* |, [1 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ N, S. ~* H5 c
- * GNU General Public License for more details.
. i5 T" K/ b1 }; P* _0 g - */+ Q" s5 t* ]3 T% M% O F
- 2 b6 v! ]2 H5 Z. _( ~
- #include <linux/module.h>
$ D7 u. _) J3 ^$ m% b+ S - #include <linux/init.h>
# w0 H: ~1 `7 ~; C9 {) m4 U* R4 \ - #include <linux/errno.h>: K( R; p0 c5 R
- #include <linux/types.h>
8 g6 b* U0 I5 z; `$ J - #include <linux/interrupt.h>
- o2 Q; h( V& N0 H- c1 D- T - #include <asm/io.h>; Q" F0 j3 A3 } l7 `7 L n
- #include <linux/moduleparam.h>* ]% } D7 q. r$ M
- #include <linux/sysctl.h>
! j( N' w" N q @" F) s1 h - #include <linux/mm.h>
- L A% o+ `5 t; _ o% X - #include <linux/dma-mapping.h>
& u4 z* M$ q" N# M n) f7 U7 J4 E0 v. d
+ T$ j% A- k8 A f& ]: s- #include <mach/memory.h>! U. b/ e. z+ ~# n+ e- e* e- @
- #include <mach/hardware.h>
9 @( ?, ^0 a" _# B5 ~7 k - #include <mach/irqs.h>; @, Z; M" s) m2 A4 E
- #include <asm/hardware/edma.h>
) r- l' M% X/ i/ f3 u
+ l F! f7 I% p; i8 l) m$ Y- #undef EDMA3_DEBUG/ I% [9 o z. `4 R- K* B
- /*#define EDMA3_DEBUG*/
5 j5 @- h$ U, |2 q - 1 h" ?7 p: ~4 W% z6 O* H. d
- #ifdef EDMA3_DEBUG
% F$ g& _% p; G! J9 i" c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- {7 V+ j# V8 I0 v" t ?# _" K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& ^9 [: ]3 {- _- Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ {" ~0 [7 y/ H6 ?9 ^5 r
- #else' s. [ l, R! J3 D9 S
- #define DMA_PRINTK( x... )
: W. Q8 n, B" W- i9 t) ~ - #define DMA_FN_IN
& p3 j8 D2 q+ y3 Z - #define DMA_FN_OUT) \1 w, @" s" n
- #endif5 B% b2 l7 ]8 s: g3 q! `. V' q
: u3 l+ c( l7 l0 X) a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. C" M! W/ J# t, | - #define STATIC_SHIFT 3
6 T& ]( _- f9 k+ q! H2 ?' y - #define TCINTEN_SHIFT 205 l% O9 V, J- T6 L9 G8 Q6 z
- #define ITCINTEN_SHIFT 21
8 h. s1 `7 m$ O+ k4 ]( v4 Z - #define TCCHEN_SHIFT 22
* S: \) U( V/ R/ C2 B+ O - #define ITCCHEN_SHIFT 23
/ y/ {5 }4 c3 ?' Y0 H' ^0 W7 A
/ F8 e! R v. {, L- static volatile int irqraised1 = 0;
& P$ h' n# b+ `. z* ?& r - static volatile int irqraised2 = 0;
! k6 D% c8 F- X- l: G3 |5 m - 7 [0 x, I8 M9 J- {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 P3 Z. ~* V5 ]" y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: O3 P2 X' P2 K3 ]9 q5 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; M+ N/ U+ V6 c% f4 E5 [
- / G* o! L9 A7 _' w6 i
- dma_addr_t dmaphyssrc1 = 0;
( n5 [0 ?7 p8 }6 N7 J7 \+ l9 n - dma_addr_t dmaphyssrc2 = 0;
5 ?* ~7 v0 k* t+ n5 E0 e - dma_addr_t dmaphysdest1 = 0;
' _/ T& S& _$ {+ } h* E; f - dma_addr_t dmaphysdest2 = 0;% U! e: ^' J5 V% A4 V; H6 ~+ f5 Z
$ h, S0 \ n( D* Z' _4 D, \- char *dmabufsrc1 = NULL;
0 `0 ~) A+ `' ]. D2 Y - char *dmabufsrc2 = NULL;7 b9 Z1 j- W" O3 @7 X6 q
- char *dmabufdest1 = NULL;
) `8 H0 e0 w& S) J7 `4 w1 c- j# K - char *dmabufdest2 = NULL;
; _- O' W/ J5 ~
6 {, Z* ^9 h7 `+ X- B- n- static int acnt = 512;
1 E2 Z% ~1 Z9 L - static int bcnt = 8;
7 Y, H5 i9 l: h1 d% K0 E- N - static int ccnt = 8;) a# K( u( e0 x9 d/ G- Y! h
- ; t7 x' v! _7 M. {; ]0 e0 V
- module_param(acnt, int, S_IRUGO);
9 J: e+ X+ P& O+ @9 P: x9 U - module_param(bcnt, int, S_IRUGO);# R. s9 V- n2 _# U- V
- module_param(ccnt, int, S_IRUGO);
复制代码 ; c' o' T0 z% P' M1 \0 u4 f r# W
+ J) }, Q% u4 u( g1 C1 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {" j0 X% i$ {* R2 O, a1 a7 c9 H( R
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 N {- q% z, F5 c( ~9 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" X- |' p) j, }) }- z( Q% Z4 n
7 i) V4 z8 b8 k. o/ Q
" J. W0 p& n5 x |
|