|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* V' }' e0 h7 @) ?; {- h, Z3 H- [code]EDMA sample test application* l( z3 J5 {5 t4 W/ B
- /*
# R3 f1 |" K' i; j2 \6 D; Q# r - * edma_test.c
3 o+ _: t1 [7 P% Z0 o3 R# |& l - *% j( x/ P! F+ D
- * brief EDMA3 Test Application
5 _0 E$ z( w5 m8 d7 r9 u - *
/ B8 Z0 i5 G! }' w - * This file contains EDMA3 Test code.' r' [6 t: m6 K+ t7 V0 c
- *
$ K0 p/ E6 g- X3 i6 ?$ F' h* k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 }. e& G: i5 {% d- j9 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ N! [4 w" z8 P6 G
- * TO CHANGE.
; B; k4 J0 C' I1 g6 }; a - *
! Z" `7 @7 {3 a' u7 u6 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 A- k& f* D- M x5 n- z/ i
- *
" I+ B5 {3 ^ v% D5 G - * This program is free software; you can redistribute it and/or
. V% v1 A* K3 z$ x* E/ z+ g [$ L* { - * modify it under the terms of the GNU General Public License as
, x x# B* D* V/ f6 Q$ r1 B1 ^ - * published by the Free Software Foundation version 2.
4 e$ J) a3 L& [# O: k2 D1 a - *
! ~$ w) E, i' V3 L1 ]8 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 x( a# s2 Q0 ~- \$ `3 A
- * kind, whether express or implied; without even the implied warranty
+ O; c# r7 E) O; M% _" z. t: E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 x" [! {+ h' g* b+ X; q
- * GNU General Public License for more details.
5 n' u, S: f9 k6 C, e' I - */
# {, c* q. g/ W1 q5 O
7 \4 d1 i8 g q! t- #include <linux/module.h>' f: e5 N4 b, ?; w
- #include <linux/init.h>( x! g. C& b- ?: s
- #include <linux/errno.h>% ?8 G0 s# x% V3 N; P& |6 _1 S5 U
- #include <linux/types.h>! t( L0 g2 E2 Z4 T+ z: D
- #include <linux/interrupt.h>6 D) a+ e8 B P9 q/ ?
- #include <asm/io.h>: E) X) ?9 e& |0 k
- #include <linux/moduleparam.h>/ o+ m! E" ]# H! H- u5 J
- #include <linux/sysctl.h>, r c# {, u9 K
- #include <linux/mm.h>
+ {7 `' X7 e' a8 B* P - #include <linux/dma-mapping.h>
4 {9 L2 _0 E2 N# h
3 ?' d# W9 |* \& I, j! l$ N- #include <mach/memory.h>" q8 a( _3 R" I8 X3 u
- #include <mach/hardware.h>! t3 [) |0 D Z" X
- #include <mach/irqs.h>
% E: X& N% |7 Y% n) I' k- t - #include <asm/hardware/edma.h>& Y, O p; _; ^5 n, o4 l+ t
- # m5 c h0 {/ u8 p! `3 M
- #undef EDMA3_DEBUG
+ ?6 j" u) i; c m, T) m - /*#define EDMA3_DEBUG*/
% a0 m, X: I& y+ P/ o& A( h
" o# J7 d! @$ f7 `5 O- #ifdef EDMA3_DEBUG
0 ^& M9 b3 @, B# j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 Z( h4 V" d: F) F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' ~( v% C3 p/ C4 \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 z. G M) g3 K - #else* A# l: q1 ^1 Y& G$ A5 z5 ~/ z
- #define DMA_PRINTK( x... )
/ Z! ?! P# A' H! M1 } - #define DMA_FN_IN" I& R0 P! H- w3 }2 u
- #define DMA_FN_OUT
5 A- ?. L0 h' z - #endif- q5 E7 T R) I9 K; O
- * o1 z7 M) q6 O6 x! y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 T! @8 x6 j. w9 c& T7 f: R" w
- #define STATIC_SHIFT 3& W$ q3 ]( l/ K# [1 Q& M# H
- #define TCINTEN_SHIFT 20: }* x( R S4 n$ S; J% [3 O3 q
- #define ITCINTEN_SHIFT 21) J' J9 @4 c8 R
- #define TCCHEN_SHIFT 22
. a4 a$ F; U. v - #define ITCCHEN_SHIFT 23, J2 _& p( y9 l x% c- ]# n
7 Z& p& D! L% P& h ~& B- static volatile int irqraised1 = 0;6 \% m9 s$ S8 h) ]9 U- F/ V
- static volatile int irqraised2 = 0;
$ n1 F% ?" r9 m1 g& [
3 d1 K( O0 g7 p: P3 m4 p. H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# L0 s7 W9 Y; ~" ^' E9 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) U( U3 B7 }+ Q+ P; m& Q* w8 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- b/ c1 e! W9 c" _, P) @
- 4 w. u' A9 ]2 q- c& m9 Z( L) N
- dma_addr_t dmaphyssrc1 = 0;: f4 r+ S9 `8 K. @- \
- dma_addr_t dmaphyssrc2 = 0;
+ ^) W8 o( o: }9 j7 T - dma_addr_t dmaphysdest1 = 0;
6 d: J% l( y8 R" |( D - dma_addr_t dmaphysdest2 = 0;
$ J. r: X4 h) v$ ^
# ~8 t- a/ k* b" P) v7 p2 U3 T" E7 l- char *dmabufsrc1 = NULL;
0 V2 H: R8 a! G - char *dmabufsrc2 = NULL;
: x0 X. J0 @3 D) f3 C - char *dmabufdest1 = NULL;
0 S: q E W2 U5 j - char *dmabufdest2 = NULL;
$ Y- h5 j, P9 e" Q - ) U. J- Y* Q1 N0 s9 A" x1 A. f
- static int acnt = 512;- l7 J4 ^ C& F* ~! J. Y# L
- static int bcnt = 8;1 J2 W+ n, z/ {" e" s
- static int ccnt = 8;
; n4 k+ E2 a6 q h+ ^
/ L- K: d8 ]% T5 |! ~* J( A9 z- module_param(acnt, int, S_IRUGO);
1 Q" q9 H9 G) }% g/ e - module_param(bcnt, int, S_IRUGO);1 e8 o2 k5 W2 B5 D. s7 Z4 J2 `) s
- module_param(ccnt, int, S_IRUGO);
复制代码 5 N$ e9 q. U6 b& t# e) ]5 v
- L: k' b$ u0 s# g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 T" l, [) ~& \) w; xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 x. P4 P; Y. i5 f* G. T. b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, f3 c- D. \6 g9 i. ^' i3 `$ }; E1 M% d
; ~1 I+ m, J7 P9 L9 I |
|