|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : |, E- ]/ M& n: y) U& r" j6 l
- [code]EDMA sample test application
9 S7 e# j# V" {. D- g - /*
( t b( S% U- v+ r( r - * edma_test.c
& `, L. S; c% P; S; K. l) Z9 G - *. h8 W4 L$ u" [% R8 T# k- ` V/ _
- * brief EDMA3 Test Application% V6 \: O4 u+ p
- *1 A1 k E T" j
- * This file contains EDMA3 Test code.5 q; E6 \3 O/ G# T P1 A
- *) x1 `2 R' S' b& g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* A3 S. U2 p5 h# \5 |5 R! f% e3 _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 n- `3 C. G6 k4 p
- * TO CHANGE.
" a" G3 p$ E0 S. E+ U" w - *! L2 f# ?- d+ d s- V* ^$ n6 y' ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 e, e ?& ^1 x# s+ w - *
' ^' {" q2 e+ l; N, v - * This program is free software; you can redistribute it and/or
& T5 f, D4 f1 ^( A* d4 w8 E; X+ | - * modify it under the terms of the GNU General Public License as
1 d4 k+ w" I7 A - * published by the Free Software Foundation version 2.
* q, ^$ u: q8 k* \ - *
$ A' f0 m1 m; z8 C6 ]" i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- B; ?( Y. ]5 F5 W* k - * kind, whether express or implied; without even the implied warranty
0 R* }! ]3 {: z, w& p; V) w4 ~. c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' k- W1 X8 G* \# }+ t% }) \
- * GNU General Public License for more details.6 F- h9 L+ f0 @/ ~& m: {8 p% c
- */; [) Y& P) k \7 N1 m
- ! d. ^/ j; K$ f9 T" {- s4 K
- #include <linux/module.h>
2 `0 b; ^$ } T1 m, ]4 ^+ x* g - #include <linux/init.h>; w6 n+ l' s8 c0 R6 [
- #include <linux/errno.h>+ M7 F6 f' ]9 H0 ^# x( Y
- #include <linux/types.h>% H4 g0 F% j8 n% s P( B4 e# ~
- #include <linux/interrupt.h>
: y' k* H' E+ ~+ ?; F, e, W+ y2 { - #include <asm/io.h>
1 Z9 p! |0 F5 A+ a3 F4 S7 H - #include <linux/moduleparam.h>
/ b5 _* i+ f% I; K" o - #include <linux/sysctl.h>( X. {( H* y3 {/ V' O
- #include <linux/mm.h>
# j4 R- H1 u7 I& G# |0 Z \ - #include <linux/dma-mapping.h>
8 T# [' @+ j- W
2 Z3 L6 m. V7 ~# Q8 S- #include <mach/memory.h># h, @$ K, A5 d# h5 C: h1 v
- #include <mach/hardware.h>* U5 j- M8 i1 e2 ]) a( L
- #include <mach/irqs.h>! F9 a# f( I% |7 Z& |
- #include <asm/hardware/edma.h>
+ |+ d& I! [& A3 a# x0 ]+ f& t
, [. a' g* m5 ]4 q# X3 V- #undef EDMA3_DEBUG
4 ^# S6 U8 d% {* I0 H, L - /*#define EDMA3_DEBUG*/
: t, t! H* h5 M3 V2 I: ~ - 6 s4 p# Y3 D) q) c, I1 O8 z
- #ifdef EDMA3_DEBUG
4 `2 g3 m' q( Y! }& ~& L+ ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 y; V0 r" t: B* t H2 \, N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 b: S. j- u1 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ z i( \8 t7 m9 o: U' ~ - #else
6 z+ j; m6 m" s2 a, v - #define DMA_PRINTK( x... )
8 D4 P# z. u1 n+ E+ J% Z& v - #define DMA_FN_IN
4 N- v5 I" ?5 A Y% J" k8 ~ - #define DMA_FN_OUT
! ^3 w0 ~2 P, H/ l: Y - #endif3 Q3 t, M$ P: Z# j! N8 z1 e6 t
- # B0 C" {) i/ P' _% `! ?# V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* [+ ?4 `4 W. a$ F. o
- #define STATIC_SHIFT 3 Y- s( }7 z4 _5 _6 `) F+ _! b" t
- #define TCINTEN_SHIFT 20
P5 I4 `! ]6 E! m* d- s - #define ITCINTEN_SHIFT 21
4 q6 r$ M: r. ^ - #define TCCHEN_SHIFT 22
- X( X* V" v5 }; `3 J - #define ITCCHEN_SHIFT 23% `% N" H1 O: u& X8 |5 o7 k/ k
" S- i; H y1 p/ ]) n6 E1 {- static volatile int irqraised1 = 0;
/ g- x; X8 V% T- M - static volatile int irqraised2 = 0;
5 X$ P, R: }/ o/ t# E* g
$ Y) C# C* F2 t/ P# N( Z3 K0 u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& X' p; D" r. E' o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' `2 k, s4 l( G8 N. S0 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V6 }% y' n* \' q% L+ r
$ m1 w& r& c, J/ [: o8 A* W9 b- dma_addr_t dmaphyssrc1 = 0;" S# ~0 ]! h5 m/ V+ `6 ^
- dma_addr_t dmaphyssrc2 = 0;
) f# ]8 q& C" y$ M: E - dma_addr_t dmaphysdest1 = 0;
" N& c( G3 q, p9 t* F - dma_addr_t dmaphysdest2 = 0;
/ v& r3 N0 d( w5 I - 1 q" H3 W! z0 p
- char *dmabufsrc1 = NULL;
. f) `7 I" k( o$ n/ k6 ] - char *dmabufsrc2 = NULL;
8 \" _0 d/ }& V+ u - char *dmabufdest1 = NULL;
1 {& l; h* P2 |7 y, e" N - char *dmabufdest2 = NULL;/ P! s0 M7 S/ E" P
- 7 _* A0 F6 P0 V0 F
- static int acnt = 512;
) Q/ c" k2 L/ W+ {7 c - static int bcnt = 8;
5 R1 ?4 \: h" r; M; k- ^1 R - static int ccnt = 8;" v8 X( [% h4 h8 V* u
- * Y, q& x f+ Q5 Q8 U/ W+ y0 i
- module_param(acnt, int, S_IRUGO);
! A, e- y/ a7 y/ s1 w - module_param(bcnt, int, S_IRUGO);
. v$ }" W( u3 [8 s7 O9 t - module_param(ccnt, int, S_IRUGO);
复制代码
0 c. P0 `* P# w. ^4 g) o a
6 X8 N# D/ p9 d1 v6 h$ P* b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: y% k @- z5 b% E# j3 Qarm-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! `: }* v+ q2 y0 U0 x! f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) a4 S' c: c8 p8 a
( t4 d% S8 W! `) w! c1 T
- V! E& q' H5 n; `1 T! ` |
|