|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& q/ m" y; }3 n3 i0 \; W: [- [code]EDMA sample test application# z& D4 G, i' v( }* I. _% J
- /*2 F3 [- \; e2 g/ O6 u
- * edma_test.c7 s7 ?) @5 L" V/ p7 A
- *; b ?# l7 T+ @4 `, }3 |! s
- * brief EDMA3 Test Application- q2 g- R) E8 }4 m% B+ q" X$ Y0 L
- *
3 g4 e* q* x& a% c0 v - * This file contains EDMA3 Test code.8 R' L: e0 V+ H q6 ?
- *$ S. r/ @! c$ |0 o6 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" q/ e; I: p) G9 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ _$ ]+ ]' `* P$ e, D: |
- * TO CHANGE.$ }3 M: C, e! x
- *
) F+ p8 Q6 w$ A+ X. o+ X* q( L' } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; a3 W' }, s9 k b$ @' A5 a
- *) S7 j8 m" p9 D3 V; R
- * This program is free software; you can redistribute it and/or) F% r! U2 f' \4 d% J* x& g
- * modify it under the terms of the GNU General Public License as5 i' c- i% N( _" y( Q
- * published by the Free Software Foundation version 2., r' P, X7 w5 e! H0 X, ~1 d
- *( W3 Z- g. o: x! X9 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ Q- e5 o: o% L% |0 {% {/ S$ U
- * kind, whether express or implied; without even the implied warranty9 V8 v; w$ B% R" F2 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ d$ }) f$ [ u# Q/ B3 N - * GNU General Public License for more details.
) D: f) t5 ~9 X& ?' K - */
8 n4 i, [5 b. b' N' }' v2 x
6 z w2 I; H3 Q& z1 U; ~4 m5 j- #include <linux/module.h>
( z' j% f$ c7 Z) N' p - #include <linux/init.h>( L- A6 |) E( v' Z" D! Y
- #include <linux/errno.h>
* [& {! v& W) i, N* t" D- I - #include <linux/types.h>
6 ~5 j8 h% T H+ P9 U - #include <linux/interrupt.h>
5 M; d+ q$ o2 e) r - #include <asm/io.h>0 ~5 T- \$ c% z/ b6 @! ]- }2 [# f( f
- #include <linux/moduleparam.h>3 l/ a9 r) o( U7 P- R- C. L
- #include <linux/sysctl.h>4 P9 j o) E* e
- #include <linux/mm.h>8 S0 F) H7 C. T6 f
- #include <linux/dma-mapping.h>0 u8 O9 H' j) h* ]# x# i4 x! ~
- + O7 x% r% `$ H* W
- #include <mach/memory.h>
. F% U: b. ?* M- R - #include <mach/hardware.h>! h; }' Q- g; K
- #include <mach/irqs.h>! L! `( ~; w0 x0 P) l
- #include <asm/hardware/edma.h>; v6 e& W6 N9 s4 B0 R2 [
- ) T2 ^ b/ B5 N' d3 S
- #undef EDMA3_DEBUG) @! b) i7 h: O# j* ]/ G J3 z
- /*#define EDMA3_DEBUG*/
. \. ]' N/ B. I* B& M - % u2 a/ L; m! ?" d( C' R$ G+ z* b
- #ifdef EDMA3_DEBUG
3 K; z; J1 |3 U1 P; }% p4 ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 Z! w2 Y5 t5 ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" F8 E* n* L4 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" w p( T0 n0 [- P( S
- #else
8 S6 P0 ~- S" _/ c" _ - #define DMA_PRINTK( x... )- X- V" V$ g% M9 a: L
- #define DMA_FN_IN9 k- y3 l" c, N0 P9 T+ o/ f
- #define DMA_FN_OUT
& x1 u% d! J% f& _ - #endif
9 P2 Y( A, l- p2 ]7 ^ } t( b# T4 k - * M! c: \7 P& d1 l! B8 P# ^; C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 g- Q2 N; U2 j
- #define STATIC_SHIFT 3
, V2 \6 X/ l) C4 c% X0 z( v( { - #define TCINTEN_SHIFT 20+ A1 r4 z& d: u% X
- #define ITCINTEN_SHIFT 21
& S7 J. C9 L3 ]# s. p, q( g - #define TCCHEN_SHIFT 22/ i" }3 ]7 U% b& t
- #define ITCCHEN_SHIFT 23
" Z# o: g% S# h+ V& _& G$ v3 k i - 3 X! l( G0 H/ r3 D. o1 a- u
- static volatile int irqraised1 = 0;
8 a0 Y4 Q" T( l( I9 N - static volatile int irqraised2 = 0; O$ ]; R/ z% L( f0 X2 |
8 A9 V7 t8 \7 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 O! c k$ o7 B* h# h& k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 K; w2 ]3 ^5 O( j; @$ m2 j/ @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# M/ a* F8 L" D2 ~& s8 ~
" `2 _! o; M- `! v! Q- dma_addr_t dmaphyssrc1 = 0;: v1 H1 |% g$ X
- dma_addr_t dmaphyssrc2 = 0;
( A& v7 X, L+ ? - dma_addr_t dmaphysdest1 = 0;
9 t) P4 W1 b2 { - dma_addr_t dmaphysdest2 = 0;
+ T) a% O. v% s6 M" }# E
# q2 g+ t8 z3 \ N( I F1 l- char *dmabufsrc1 = NULL;
- k* W1 v0 v) a0 }2 l% C( h0 G) ] - char *dmabufsrc2 = NULL;
' R& |4 z9 A8 T( C4 \5 v8 P - char *dmabufdest1 = NULL;
) l6 }0 h6 r0 G: t% m+ { - char *dmabufdest2 = NULL;* k; n" V; `; x# i& ]6 q
- ; @9 `2 _% H) B7 D( }& g
- static int acnt = 512;" L! p. f+ F/ B/ ?2 A
- static int bcnt = 8;, i& W$ C5 k7 _ H& s6 H' G" C
- static int ccnt = 8;
" R3 A% S* y6 o- T - : i% W: Z& A: D0 U0 a) w5 y ?& b
- module_param(acnt, int, S_IRUGO);4 e7 k0 V1 s+ Q* ?3 ` S
- module_param(bcnt, int, S_IRUGO);9 A" K. |4 Y' j I
- module_param(ccnt, int, S_IRUGO);
复制代码 3 d5 N) s: ?/ M. I
- n1 `! ]3 g. l) P* B9 C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ i! X9 I. D3 M. O7 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) ~# a/ t% Z0 @/ }; i3 F4 g+ | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 a9 f# T7 O% @) \: W# U" H
: B8 g( l9 P/ x0 G" F0 @& s& N+ Z' d9 f$ T
|
|