|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 Y( c: s- C! w* t* Y# x! t/ _* ?
- [code]EDMA sample test application4 O0 c! ]; R& H# I2 K! {8 W
- /*0 E5 b6 O. p; I' D, q& p5 B% Y m
- * edma_test.c
* d* F9 s' K+ S" A* D - */ M& J) L3 |2 g5 u
- * brief EDMA3 Test Application
- L1 n. _ Z' i# J' p @ - *
; N! E# ?5 ]7 l: o+ `8 O# g - * This file contains EDMA3 Test code.: r1 O$ V0 I: @% u+ U- `, t
- *
& a# w2 j) i4 Q- }" x8 j& N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; m5 X" ]9 P: i) m; Z/ O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 f6 s1 Q- @1 C: O1 H2 `# u* n6 p - * TO CHANGE.
. q1 |8 O7 U* S" [" }3 K, o- s. i' ]6 x - *6 J( \( R' |% f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// h$ W$ B% O$ ?' h6 n4 |
- *
; A' f4 x0 ?6 e! W - * This program is free software; you can redistribute it and/or, z& o+ j5 b; n1 v# g" S# {" I( x i
- * modify it under the terms of the GNU General Public License as: {, a) [+ U2 Y$ w; }& v
- * published by the Free Software Foundation version 2.
5 |0 o& r D* W8 `* k; c - *6 y5 z( c' `' ~- u+ A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 r2 I0 H8 B% I( P7 x
- * kind, whether express or implied; without even the implied warranty
9 \4 q% q% d8 T: ~, m0 w4 _& f" F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the B$ ~6 ~0 h, ?! J7 }: I. a- }1 F
- * GNU General Public License for more details.6 `# a9 G5 b5 d' K0 Z
- */& Q4 @4 {; C0 L$ m1 A& J+ n
: s9 g+ N \9 E- #include <linux/module.h>
, O+ x4 _& F5 g8 v - #include <linux/init.h>: O1 l6 b, d6 q! l4 Z; G7 s+ s1 F
- #include <linux/errno.h>
( Z. ?; e* @% |; [9 p4 j6 Z1 p - #include <linux/types.h>
: M1 f& P7 P5 H% e' e7 n* d3 u5 M( p - #include <linux/interrupt.h>; ^( v+ o7 w& t2 f7 s
- #include <asm/io.h>
) x' }( a7 I, H3 l- @5 H* H - #include <linux/moduleparam.h>- G6 H+ e r: c. M6 Q
- #include <linux/sysctl.h>" c+ M y9 I' M
- #include <linux/mm.h>
' I; c4 L7 v9 K - #include <linux/dma-mapping.h>" h6 ^: p0 F, L4 w. Y2 F
; C' Q9 v1 S% S* c" `: b6 l1 g- #include <mach/memory.h>
* ^( }2 i7 R* H3 G0 T* N; K - #include <mach/hardware.h>
) t1 G! }1 q2 o% y - #include <mach/irqs.h>8 |9 U& T z' s6 r3 k
- #include <asm/hardware/edma.h>
; n- h( S2 P/ ]) _
. s0 T, U% e- K- #undef EDMA3_DEBUG" S; d( ?- O6 D0 L f& c# G U' {0 d
- /*#define EDMA3_DEBUG*/( F2 A$ a6 u" z0 M3 l
& ~) Y# C1 |$ [+ d; V8 l- #ifdef EDMA3_DEBUG* a, U R/ t8 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* R# W' _% ^* ^; _- p2 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 a; A$ V2 i" n9 ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 I, h* c: g; ], \ - #else7 j9 ]" L F: C4 O
- #define DMA_PRINTK( x... )
, K6 z5 B5 k9 q `8 Y8 K5 _ - #define DMA_FN_IN
7 ]0 S, K% F/ B( w - #define DMA_FN_OUT
0 g7 O2 L( _2 P7 R1 s4 ^ - #endif
# E. ]9 |+ K8 D9 [" F* ^
3 b& O, x O. M5 |; b( k+ P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 ^( V! O' x' H' S: p. P* E - #define STATIC_SHIFT 38 s: S+ F# ^5 A* s, d" W3 i
- #define TCINTEN_SHIFT 20
. q) D' q7 z! o5 s, }0 O: F - #define ITCINTEN_SHIFT 21; v+ F1 d! S5 z; Y
- #define TCCHEN_SHIFT 22( I+ E2 o& v ]7 ]
- #define ITCCHEN_SHIFT 23
) Y) t5 {9 F p" g0 I, {3 c3 c, F6 q
# e' z# E% D+ i# x/ ]- static volatile int irqraised1 = 0;! ~. `3 d; S# ]' i
- static volatile int irqraised2 = 0;8 ~, E9 S3 f* H! ~: B, S7 g
- 6 ^0 d. [% M7 f% Q. c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ G& M% Q% R ~. ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
O$ d- Z2 G5 P6 B) ~8 Z; c0 J% o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ m, k# c8 P+ a% F. ^ F
- ) w% \6 r9 A" T5 C1 D. r6 Y
- dma_addr_t dmaphyssrc1 = 0;
# n8 Z3 ^8 l% l( g- S( F% c t - dma_addr_t dmaphyssrc2 = 0;
, G+ Q% g* d3 n# N. D$ p0 T% { - dma_addr_t dmaphysdest1 = 0;
+ g! \, {- t7 K' V' m; l6 ] - dma_addr_t dmaphysdest2 = 0;
- X2 L& L' b3 H- D - 8 J4 B3 R" G6 a
- char *dmabufsrc1 = NULL;
7 L* A6 e& m2 i& D* t2 E - char *dmabufsrc2 = NULL;* t1 U+ O4 T/ Q4 H' p) g; L
- char *dmabufdest1 = NULL;
) f, S$ s, S9 |. G" \5 U - char *dmabufdest2 = NULL;
* m! h5 ]. @* y, R - # R% G0 }* `/ H# l7 d8 u; c3 Z4 c
- static int acnt = 512;4 v( F6 H2 X$ ^1 S; u+ @6 z/ D+ F' k
- static int bcnt = 8;! t! Y' e! b1 S
- static int ccnt = 8;
- s# b1 s5 l4 u1 v$ a: c9 O - * y7 N6 ^. i: ~8 Z# n1 A
- module_param(acnt, int, S_IRUGO);
1 X# g3 o$ q/ Y" M5 |4 T" w - module_param(bcnt, int, S_IRUGO);- z& E0 V [! E8 x
- module_param(ccnt, int, S_IRUGO);
复制代码
: }" g0 j9 t% G$ e4 v( p, B6 D2 d
6 O; g H" j/ V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' X. s; l' q7 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) V% m* }( K" w8 q+ Q) _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 `* j( z1 r% i, {! F. D: _
3 m) ~, d$ G) D9 Z
4 }3 P$ U% k7 V7 e' p! I |
|