|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 O _) ?" q- _% v* u0 [
- [code]EDMA sample test application
6 o4 q+ e. H5 T1 i - /*
h4 O( C. T# r6 n - * edma_test.c, s" [, X! c% \( W
- *
; i0 [1 E. c& H; c7 ` - * brief EDMA3 Test Application
4 u6 x+ W' }; P4 e3 k! E - *" b% O( ~6 [" V
- * This file contains EDMA3 Test code.
# p# j- |. D& s2 A* h - *2 I- A3 X/ ?: w- a! d+ ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ S% o( _& F' k9 G: L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( u! C( t v, z" v - * TO CHANGE.8 Q: Q; t0 B- x9 r" R z
- *. [: j" F$ |" Q8 u- L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// u% t, |: u6 s, S. D8 A3 M
- *. {1 q/ Z5 f1 N* u7 b/ Z& j. o. m
- * This program is free software; you can redistribute it and/or9 f3 T3 K! g Y! N3 L. {
- * modify it under the terms of the GNU General Public License as: O- x7 o1 r# Z9 l/ `
- * published by the Free Software Foundation version 2.. S8 y9 ]1 P3 i
- *
1 s4 b1 l. Z2 q" ^ A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( V- t) m* s0 e4 r - * kind, whether express or implied; without even the implied warranty. h5 G2 V5 J/ j5 k; e- P2 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- K# ~3 ~4 Q6 B - * GNU General Public License for more details.
4 e% `8 z! g9 L* X* W: D/ x3 C - */, ]" W8 N4 ], W* Q1 _( u+ z$ v( L
$ G7 d4 I4 T' @5 Z) W, X- #include <linux/module.h>
7 A0 T& y; ^% w2 B% A' h7 e - #include <linux/init.h>( I( A# l) l% v" _" h% m) |8 j9 x
- #include <linux/errno.h>
" p5 d1 f8 n; S1 p/ U' } - #include <linux/types.h>' g. ]' ]" }) F
- #include <linux/interrupt.h>
2 O+ q0 A: e5 K# T* | - #include <asm/io.h>; d* z6 h# v( s- P
- #include <linux/moduleparam.h>% ^6 _2 `0 A, L
- #include <linux/sysctl.h>
* n" B0 z8 A* c [- w- t% m - #include <linux/mm.h>1 A2 y. l- \ }, a) r, ~
- #include <linux/dma-mapping.h>
& ]3 {7 r# I: `* r6 a. P
V: l/ _1 k6 e/ _# `' z P4 I- #include <mach/memory.h>0 T+ e, Q* j% D) \4 |
- #include <mach/hardware.h>
' ~0 r% D6 {+ N) o9 Z. Z/ |% Q - #include <mach/irqs.h>
1 f' v: o" P" G4 L- q - #include <asm/hardware/edma.h>
# k: g f7 P9 S* n& S - 6 ?5 Q5 M3 d6 z( E2 N
- #undef EDMA3_DEBUG, L$ z: ^9 p# l6 E
- /*#define EDMA3_DEBUG*/. K' ?. e* N8 d9 c1 Q3 E0 [2 w# _! Y
* U- u0 I+ U5 o, u+ |- #ifdef EDMA3_DEBUG
# Y5 I: [7 E" ^, A+ t2 ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& k0 O: R% U6 [ J% n5 k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' U2 c$ m6 z7 Z" E& B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 W5 i% j. L" | J
- #else
& d" l% e$ f+ v% i7 x# a( E - #define DMA_PRINTK( x... )
( n: ]* S) g8 f* I - #define DMA_FN_IN6 m5 H: @' q. }) E8 M) T9 x
- #define DMA_FN_OUT
: u/ r( O& _8 Z7 {& V6 A$ d - #endif
2 H) p8 q6 ^+ j
+ x7 `, F$ g3 ]" z5 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 w8 R. Q' \+ {2 p) r( z( E: }
- #define STATIC_SHIFT 3
3 L" E9 d6 O t. ^8 r! E* o - #define TCINTEN_SHIFT 20
6 t& R) R3 E! [. I* a# G- Y, ]; \' a - #define ITCINTEN_SHIFT 21
Y5 j. c8 E) q D6 g% H: p - #define TCCHEN_SHIFT 22
5 e C' x9 l+ W' `2 |2 L - #define ITCCHEN_SHIFT 23' L q8 F; `# f7 R
7 c0 R; h9 W, E# H4 I7 j* V7 K- static volatile int irqraised1 = 0;
9 ?3 l9 y' P* S( @; t - static volatile int irqraised2 = 0;
2 b# Z& W2 s+ ^) [6 Q
/ _2 i' l: `7 ]( Y2 r9 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' w" o7 ~, b& e3 n: x% p9 s; F" _& M# ^% Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 [' G( w5 P- P: h3 | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# p6 a) i# x2 K1 P: \/ I# }+ g7 n# g
- ' b; U% w: O0 e: Q- o
- dma_addr_t dmaphyssrc1 = 0;
0 b8 S" a/ z5 N h: J0 \( W - dma_addr_t dmaphyssrc2 = 0;: M5 ^5 o) w6 [: }( J+ q
- dma_addr_t dmaphysdest1 = 0;
* i$ ^) U$ ~% n" P; M3 p* { - dma_addr_t dmaphysdest2 = 0;
2 `* U& `) |) \. G1 K2 G
. h! ?0 ~/ J$ S& ~, }8 ^) Q% M; [2 `- char *dmabufsrc1 = NULL;6 B9 B5 b! `$ C* C) a9 ?; M _
- char *dmabufsrc2 = NULL;
) h3 J! o- {& `/ N - char *dmabufdest1 = NULL;
; i& _5 _! |9 G6 x - char *dmabufdest2 = NULL;
8 y3 U/ C6 w$ E5 J2 F - & n* |/ Z9 a+ Z, d: X% K) N
- static int acnt = 512;8 Z8 ?) A& W/ Z7 f: p. o5 I5 H1 [
- static int bcnt = 8;! j O5 V9 T# e; T5 s5 j
- static int ccnt = 8;1 A; \+ O5 \7 [
- & `5 v9 O; l$ k A @( R( t
- module_param(acnt, int, S_IRUGO);
" R+ x& F/ @* g - module_param(bcnt, int, S_IRUGO);
* f! ?' O- [( m9 a: ], p. v8 r - module_param(ccnt, int, S_IRUGO);
复制代码 1 P" w1 y3 {0 X* r5 o" W. _3 g! w
2 X% P1 _# i" F5 d" `3 T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ a/ Q& ?9 ?/ i7 C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 r `0 K: u- }8 o2 q- J; k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# t0 s2 _4 x* E* e% H
6 H& _: o# m6 u! |$ w( n+ s# x4 ^! I) y8 n- D5 B; v# g$ C
|
|