|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % O6 b6 i F1 X5 E
- [code]EDMA sample test application
5 }* W6 E- L& m( O7 p - /*1 S2 i H/ y3 \2 M, y
- * edma_test.c% S" ^2 q* h8 D
- *& Y! W1 g- }+ m& O/ Z1 H
- * brief EDMA3 Test Application
- H$ z% A* z/ }; Z) F - *
4 u1 R& j$ Q4 q! D0 u; F2 k5 S - * This file contains EDMA3 Test code.% z; p- O) ^3 {0 b9 `
- *& @( }7 m7 V- \9 R. S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" \# U9 F1 m+ w. [. ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, H# Z& w" X D# E# w9 `" e- C& _6 M0 A9 q
- * TO CHANGE.+ E) b O5 c |: o
- *% z/ i8 G. o1 X2 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( s3 t5 S, ?0 d
- *7 g9 {: l2 g4 c4 i0 x
- * This program is free software; you can redistribute it and/or
9 o) N. r0 D: q9 F. I6 V4 @& r - * modify it under the terms of the GNU General Public License as3 @: \3 L u5 s. E/ Z. U7 ]: u
- * published by the Free Software Foundation version 2.0 \2 a9 ~4 a* ` K! R# m+ S8 [
- *' P" \; w2 q& K% ?6 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 U. i( p: V% z3 E& e - * kind, whether express or implied; without even the implied warranty
: X8 J5 }$ P- ]; L6 r9 B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% D/ g9 L$ j. M7 T
- * GNU General Public License for more details.( j2 k5 f% p1 h. o+ f* B
- */
# U# E1 l5 [7 D - ' b( J1 [# s8 N+ C6 L" a
- #include <linux/module.h>
5 n. c% j S4 G; {5 T - #include <linux/init.h>
# p ~4 y8 r" O) v8 _ - #include <linux/errno.h>
, ?9 a/ Z$ z d1 h) E1 a. ] - #include <linux/types.h>
; _# F! Q, v; i/ R: F U - #include <linux/interrupt.h>
7 U, J) i9 h i6 q" d4 _" K - #include <asm/io.h>
( ~' t. @6 s$ i' n, c4 h - #include <linux/moduleparam.h>
7 [- q, l7 g' w, x" d - #include <linux/sysctl.h>( l5 `$ V& k7 f2 J
- #include <linux/mm.h>
7 _/ f6 u' |/ b - #include <linux/dma-mapping.h>" R8 [/ m6 y7 O4 M4 T
- , g9 O% m* q9 ^" ~. J
- #include <mach/memory.h>& _4 Q: r3 r6 ~8 r2 B
- #include <mach/hardware.h>9 p$ c' f2 \' q$ u) n
- #include <mach/irqs.h>
" \+ h( t% n- T4 E0 P( k* ] - #include <asm/hardware/edma.h>
1 x) K6 b4 G2 E1 `* Y
, t4 P. p- M7 ~; ^3 M- #undef EDMA3_DEBUG
* Q* D$ c" L1 A - /*#define EDMA3_DEBUG*/, k+ k' {. Q2 K$ o& C# o( x
. f$ ~( H* E5 l7 ]- #ifdef EDMA3_DEBUG$ P4 u" Y8 T g/ O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& t5 s: R/ a0 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 c2 h3 a; b: w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% I$ E* _6 [4 {9 b( k8 T3 S - #else% m7 @$ d, A/ z+ W1 m: h# Y
- #define DMA_PRINTK( x... )& g: g! |2 M5 L1 F1 m+ _
- #define DMA_FN_IN! I& D) ~# X: S
- #define DMA_FN_OUT
$ |4 h) M% s6 P/ ^0 O" `+ A - #endif
8 B) X) ~: a% F9 n8 F
( R6 D3 q6 M, P2 Q. v# S3 |- #define MAX_DMA_TRANSFER_IN_BYTES (32768): f. d, O7 L3 k2 Q, X3 p
- #define STATIC_SHIFT 34 m& q8 |! k9 I5 a4 ]( g- r$ x
- #define TCINTEN_SHIFT 20
5 C9 J* e j& {2 N - #define ITCINTEN_SHIFT 21
2 L: V+ m% d8 k8 B& `) R - #define TCCHEN_SHIFT 22
* {" e' e$ c2 ] o9 ^) x3 p& r - #define ITCCHEN_SHIFT 238 j+ C/ n' c l3 B# d) _
- 0 A( ~6 D( f/ Y. O& G$ m4 N
- static volatile int irqraised1 = 0;
+ |& T/ \; P0 R& T5 k* c6 H! F - static volatile int irqraised2 = 0;$ M9 T$ C7 q# p0 i0 i9 c* `
- 7 K' v6 P: e, X( ?$ F4 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W- d: z5 s: L( l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^& \8 v6 a2 u$ F/ I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 U7 ]* h* P: Y, D0 ]# i
- % W Y! a' ?) l- d+ p' N
- dma_addr_t dmaphyssrc1 = 0;8 l+ E5 v* {1 h
- dma_addr_t dmaphyssrc2 = 0;
, S! \. q4 K" d - dma_addr_t dmaphysdest1 = 0;4 `+ ]1 C) j) X8 v# ]9 a6 g2 U
- dma_addr_t dmaphysdest2 = 0;
, j) a; \9 H! j/ v
: N5 W& } S5 ]& i) L+ Y) Z- char *dmabufsrc1 = NULL;6 ~4 s0 d0 I' c/ Z0 w7 E0 j3 b
- char *dmabufsrc2 = NULL;
2 K" G* Q3 A3 @/ L" T3 i - char *dmabufdest1 = NULL;
9 N3 I, ?8 O7 C& h5 t8 _ - char *dmabufdest2 = NULL;
0 I: O5 W# y" m4 M% B" w. j - " p4 S0 V% \. A1 ]$ e7 v5 ^- ?
- static int acnt = 512;
) j6 u$ p, Z3 q/ p# r3 I - static int bcnt = 8;9 C- o. R1 Q" A+ E M
- static int ccnt = 8;
$ ?% R) F! H+ T- P - / h" f- \4 N; U
- module_param(acnt, int, S_IRUGO);
" ]& d& y7 x1 A6 s1 b/ s - module_param(bcnt, int, S_IRUGO);& k. o, x/ R; T5 F9 h
- module_param(ccnt, int, S_IRUGO);
复制代码
4 _0 l* @) w' y, T9 h3 n" ~5 S. h- r$ ^5 j8 e0 j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' o7 D: J" X( v 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& w: K6 J) J2 P5 p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" x2 V8 n9 z, D' D) f* z- e {/ ^9 d6 d) m4 k. r9 _
; C* R9 p7 W! W! m; h |
|