|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! A P) Z; R+ Z# J7 O/ n
- [code]EDMA sample test application* Y: x" s5 L" \+ `
- /*
% a, {% A& u/ W! `; S - * edma_test.c$ J: Q( q1 f+ X4 i) }
- *' ?6 v1 S; l! p7 c' {
- * brief EDMA3 Test Application
& m) M7 k# \" ^3 R4 F - *4 ~3 ?7 n7 T- G/ H# b" i
- * This file contains EDMA3 Test code. ?: u& b E7 {+ l: d- Y
- *0 [9 \/ |6 n- g; E* n5 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, o: \& q6 N' Q& `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ k8 c$ P- _- [) t$ G3 W
- * TO CHANGE.+ v6 l" v: ~, E2 ] E) Q' P
- *! B: ^5 G1 S7 ^4 {/ v) W( p$ G% t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ G/ {) o* c( @5 M- ?. T1 u/ c7 `
- ** Q' e0 t% }3 f' w# y
- * This program is free software; you can redistribute it and/or
) n$ H }( l8 C R4 u8 [0 D8 U - * modify it under the terms of the GNU General Public License as7 s% D2 `5 j" m( \) a
- * published by the Free Software Foundation version 2.
7 ~; \1 o, n9 C8 H# \6 e - *0 L* M( ?5 u2 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 w0 j$ R8 _, x8 o - * kind, whether express or implied; without even the implied warranty0 x; x2 e( w/ h" F1 ^2 r% t5 o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 E" D6 T- N. f - * GNU General Public License for more details.5 @: W4 ^3 _/ \3 n' X2 H; v
- */
" N2 C) O: P2 N
/ F, E5 g |2 ?$ D9 E' C- #include <linux/module.h>! e& S- N2 ?" B. ]. {: S
- #include <linux/init.h>
1 B0 M- P8 h. R2 L - #include <linux/errno.h>
; z/ j8 a* B; X4 a# r/ i2 ] - #include <linux/types.h>4 p+ H- \' }" d. o/ x; Y5 j8 p
- #include <linux/interrupt.h> r4 A$ [; p" E- u. a$ I
- #include <asm/io.h>1 T- l; X3 V: d) _7 s* y$ T
- #include <linux/moduleparam.h>( Z: _2 F2 S) K. F/ {2 K
- #include <linux/sysctl.h>$ F; r; J7 N {# W- {4 ?: V
- #include <linux/mm.h>' Z% R$ d8 m" _; {
- #include <linux/dma-mapping.h>
8 p& X2 a5 l+ o8 C
. z& c1 P: Y! \! v9 m) a0 N f! \- #include <mach/memory.h>
" E, s$ q7 {4 b - #include <mach/hardware.h>
! b6 _! n; T- W - #include <mach/irqs.h>
5 @2 ?7 G$ f6 N* r& _ - #include <asm/hardware/edma.h>+ O- g: b# F; Y3 a* n
+ d' Z8 a- x* A2 v6 {- #undef EDMA3_DEBUG
8 V R/ W& l( K. e2 A - /*#define EDMA3_DEBUG*/
- H' c+ S5 t7 q3 h/ O- i# U, V% m
% o0 j0 {0 J# t1 Q- #ifdef EDMA3_DEBUG
" p/ k. z, B3 S' s8 P' `: \* K# Z$ v. N1 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. s5 C0 g6 ^0 D! r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n2 m+ ~' ?* B: Z/ w9 u3 x' c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ~4 u/ i8 O& F$ X0 u3 Y9 H
- #else2 w$ A: x7 W( Y( c4 `- F
- #define DMA_PRINTK( x... )
9 \$ I0 y" u6 E7 J* Q - #define DMA_FN_IN$ o/ R, t: d. |* E0 E/ p I
- #define DMA_FN_OUT
! y" h# b$ @" F$ H1 Q - #endif
5 |; R* Q, O2 S$ H% O
+ b# v: m, A" w0 Z/ J+ c* D8 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- B: v" F" A' _* S3 m* F; F6 S; v; a
- #define STATIC_SHIFT 34 I' o" r5 K: n
- #define TCINTEN_SHIFT 20
8 {2 G* k2 G% i0 W; @ - #define ITCINTEN_SHIFT 21# ?# L/ j* g) ?
- #define TCCHEN_SHIFT 22) o4 ]) {7 `8 G' `2 m( W
- #define ITCCHEN_SHIFT 23
: k; j5 z1 D8 @6 c
& c. Z- U5 j5 |) H- static volatile int irqraised1 = 0;$ o% h# j" E2 e7 W$ J( {
- static volatile int irqraised2 = 0;4 ^; a5 M) T# \ H- G/ f# e
( P6 [* Q& w' M( Z9 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k& E- f6 Y0 p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s3 E1 U9 Y# [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, z- z7 O+ x7 f' Z, |, J - 2 K" O. t1 o6 A3 F4 \* S J
- dma_addr_t dmaphyssrc1 = 0;# R* ~! u& R9 w8 `2 v: P
- dma_addr_t dmaphyssrc2 = 0;7 L3 f ^( T1 c
- dma_addr_t dmaphysdest1 = 0;
( D* w; k3 Q' O# Y* M - dma_addr_t dmaphysdest2 = 0; L1 N H9 q1 N6 B* P
$ A/ I* H& A$ C% _$ V- char *dmabufsrc1 = NULL;
7 u! _1 [8 p# |2 [ - char *dmabufsrc2 = NULL;8 r" g$ Y9 P5 Y* S' o
- char *dmabufdest1 = NULL;) p4 d$ a' M: x1 p1 o
- char *dmabufdest2 = NULL;& l0 M4 [4 K' t% k
& L) n5 {0 ?6 @4 B- static int acnt = 512;% Y( z) W9 v& F# Y" d8 |
- static int bcnt = 8;* ?7 O& v( _. \2 W# ~* Q1 g# L
- static int ccnt = 8;( [/ b, C0 Z6 `! L# ]
- : j% `" a. S( v6 V# G' e
- module_param(acnt, int, S_IRUGO);
7 N- y3 k( j4 d4 J" |& ] - module_param(bcnt, int, S_IRUGO);
+ W) @2 {+ T4 w& I4 Z9 d9 q# P( q# n - module_param(ccnt, int, S_IRUGO);
复制代码 0 f0 H; ^1 ]; q3 r4 I6 x8 x
" R7 y5 f, B9 c' s( t" r# T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 q8 Y. T E, G' a* \* t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 B0 I) f: }+ f% r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) D: L8 B" R8 Y
9 u" R8 }1 x4 A ?- j/ ?: g4 d \2 C3 u9 o% e
|
|