|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + [) G2 ?7 X* [# f
- [code]EDMA sample test application$ A" X8 P& H6 ]5 P
- /*
. T2 a- g O! T$ \" \1 v - * edma_test.c
4 s$ M( }/ i* o% _% X - *4 W+ o0 g! _# _ c$ R0 @/ p( C% q
- * brief EDMA3 Test Application
: M# w' H9 Q9 i, U, g3 X - *
. f8 Z1 m0 ? J/ E8 T" S - * This file contains EDMA3 Test code. D: _+ E0 B3 n4 _% e7 H/ r7 f
- *, {; b* X5 L' c" V: {$ U+ y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' x: L2 J8 G0 G/ {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 M& c m% k/ N+ k$ ` - * TO CHANGE.
4 a- a8 b2 C6 W( o - *" G1 X( Y/ F: e% V A# \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 O( F$ z8 }% P: r) }! L2 R - *
' \7 V6 z% V2 I8 d - * This program is free software; you can redistribute it and/or3 {4 T3 n: A7 ?. K; E4 H
- * modify it under the terms of the GNU General Public License as
( B% F! ]1 ^) E. t - * published by the Free Software Foundation version 2.! y7 Y+ @0 M2 l
- *
) _" v% w" `" @4 ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ M( U5 z3 P; O: ?0 L7 Q B6 I) M
- * kind, whether express or implied; without even the implied warranty5 B$ U# d" E/ X$ S* o) D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& d. R2 ?7 P2 G, E% ~
- * GNU General Public License for more details.( R; e7 N' ~( Q0 E5 v8 c( K# j$ e5 i
- */# b5 v% `3 a& p$ y/ R* d# W |) [
- a& j! F/ x% E5 x+ ]+ `
- #include <linux/module.h>! ^4 V1 C/ @0 J( J! b
- #include <linux/init.h>- u; l/ g6 D% N* N2 L
- #include <linux/errno.h>
% z) h7 j% P/ w B - #include <linux/types.h>$ ?/ m7 _ X; C1 ?" d4 p
- #include <linux/interrupt.h>
6 M0 @ V j; ^+ S - #include <asm/io.h>; l3 C. V* U* |7 x! w( |& ` B
- #include <linux/moduleparam.h>% r ^4 |. A+ L3 ~1 I9 @4 B
- #include <linux/sysctl.h>
0 ~' V6 ^4 b" A% j6 R2 b) E; ? - #include <linux/mm.h>
/ D' [& a- F d# C - #include <linux/dma-mapping.h>
6 c( f: [, N* U- Y - 8 B5 D3 s* E+ g- o5 q
- #include <mach/memory.h>
5 F" c0 d+ s. A6 L# ?; J1 Q - #include <mach/hardware.h>
) J8 b4 v, g# p, K9 O - #include <mach/irqs.h>
8 C0 j8 V3 _8 W7 n - #include <asm/hardware/edma.h>5 u- Q* G$ A2 s3 M& i
# Y) ]0 q4 I4 K+ C8 A1 [) T- #undef EDMA3_DEBUG/ b; e! w& r3 _
- /*#define EDMA3_DEBUG*/% t9 Y/ K+ ]5 T8 P8 T! Y1 s5 F
( P8 i: c* I' v" L- #ifdef EDMA3_DEBUG' l, T- i8 @7 g/ Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% W7 p y ?+ N' i# _ D. ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; ?1 [% U0 @" _4 K O8 q8 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' E& l. P" N) m+ n0 O/ f' w4 a - #else
: V& w7 `! f, H/ Q/ h$ s. b - #define DMA_PRINTK( x... )
# b9 G9 e% N7 P' {. ? - #define DMA_FN_IN
# L& [/ x3 _2 F- @7 O8 c - #define DMA_FN_OUT/ i2 d' S2 u0 c9 X3 P) G
- #endif1 \6 c0 @4 s5 M- B! ?- x
7 i; f9 d2 A3 h3 ?+ ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768): ^: f& t, V, P; I4 ?- e/ H
- #define STATIC_SHIFT 36 `9 u5 c% j% l" |! o$ z
- #define TCINTEN_SHIFT 20
6 i( @2 U$ a) M' M, n - #define ITCINTEN_SHIFT 21. y: D! w1 ?/ o7 J- Z7 y
- #define TCCHEN_SHIFT 22; p8 p6 W- m: q4 r t
- #define ITCCHEN_SHIFT 23$ C' i5 c. h4 T+ U0 E& ]" B
- " y4 ?7 Z3 P( L# B( k8 q9 A
- static volatile int irqraised1 = 0;
0 c( j4 [' L; _+ X4 o1 i' A9 s - static volatile int irqraised2 = 0;
3 G& h7 H3 l) `% H - , C5 t4 Z7 z' L; r y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 v8 K; f' j9 I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 d9 I$ G; k* j1 ^# u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- e) Q' A$ s( T b8 h - 7 d6 q+ B2 n$ y0 I# N2 ^; m
- dma_addr_t dmaphyssrc1 = 0;
. h* E% c9 `2 X8 z - dma_addr_t dmaphyssrc2 = 0;) C* A/ o/ {+ F. C [
- dma_addr_t dmaphysdest1 = 0;
) B; j, \! Y, n1 S) v# C - dma_addr_t dmaphysdest2 = 0;
7 q: T" ]' d0 ]# H) z' O
6 j# C( U8 i* `/ w, T3 n* ~- char *dmabufsrc1 = NULL;: L" p* V: n; r* @( R
- char *dmabufsrc2 = NULL;1 F# v1 l4 {7 y3 L
- char *dmabufdest1 = NULL;
: z! @9 g' [ N8 m$ F: s* A2 ?9 O7 M - char *dmabufdest2 = NULL;
. N" L& l4 Q) J( w
3 V# u$ M) q5 \$ u4 C- x' y" S: {- static int acnt = 512;
" [* E. N6 V0 }; d# R7 J - static int bcnt = 8;* s7 Q. n6 C7 G1 r
- static int ccnt = 8;
2 T$ y n4 t$ @9 H9 ?: O1 f7 i9 x6 o - $ j2 G" d' e% e9 s9 C) s
- module_param(acnt, int, S_IRUGO);
5 f" d c4 I- |0 R - module_param(bcnt, int, S_IRUGO);
. w- Z& f `7 \) p4 J" @ - module_param(ccnt, int, S_IRUGO);
复制代码 + d- }% w7 ^% L! a' E* R& o/ T
8 u0 ^# g* t1 i T$ C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ^" l9 }2 ]& R% parm-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 A4 G4 Z$ C7 v0 V2 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" k0 C+ f( o( Y" \! M% f$ v$ v( T
a# w# M0 r1 N/ ^0 B% C& D' W; ^. `$ D& o9 C
|
|