|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ O* j1 Q% ?4 |& e2 Y$ M3 E
- [code]EDMA sample test application
. e. R8 ?3 J# M ~1 B2 P - /*
' b- e+ H8 f" \5 | - * edma_test.c; T1 {9 ]* b" J. ]$ C* z
- *
1 @; I5 _( N! R0 Z! J$ D - * brief EDMA3 Test Application$ F( U5 G% R/ K& E
- *, N, N3 D5 k* P6 w) d
- * This file contains EDMA3 Test code.) w7 F0 m, o3 q
- *+ d W0 W0 Z7 t9 P& T1 ~- F+ s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* B/ Y; ~: q/ p6 g0 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ U* E, I/ y0 s5 r! i) u - * TO CHANGE.
# U! y r* G5 j9 u% S - *: T! {4 q6 { Z( c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ f$ d* U1 I, I4 r, X
- * @ E1 @1 M" S' M. \
- * This program is free software; you can redistribute it and/or
9 v; A8 i5 |" \* d3 q - * modify it under the terms of the GNU General Public License as0 o1 [& s |3 o5 l0 g5 g9 K
- * published by the Free Software Foundation version 2.
# \( `, s( ]2 q) A9 E' N) ~3 O - *$ G/ `+ x" Y* y* t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- S3 s C5 L4 W2 g - * kind, whether express or implied; without even the implied warranty
* a' ~9 b/ ~2 V5 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 h0 `9 `9 U' p, V/ t
- * GNU General Public License for more details.
9 w: e& p1 u5 {+ ?* c - */
: e9 ?; P% \# n3 w
& `! B. O/ n7 C1 x' c5 s- #include <linux/module.h>2 Z! `) `9 `( N: z5 t! {; N
- #include <linux/init.h>, Z" h0 e# O* k# _0 z- A. K
- #include <linux/errno.h>) {1 c/ Q' a& ~
- #include <linux/types.h>: A# Z% Q+ f+ L$ r9 c
- #include <linux/interrupt.h>$ J! \' ]1 W: |
- #include <asm/io.h>& l& V! m8 f) l# P. i- r
- #include <linux/moduleparam.h> c8 k; P7 U3 ?) f; s8 b* D( ]6 _
- #include <linux/sysctl.h>
* }3 U2 K8 z% s5 m5 l5 K' g - #include <linux/mm.h>$ \. m$ c' X3 l! u
- #include <linux/dma-mapping.h>* U. m1 Z c% s/ R0 p
! R6 G& W% N/ W- #include <mach/memory.h>$ ?& I2 F- `% N- n5 z
- #include <mach/hardware.h>$ x# m3 v% K1 L$ E% J
- #include <mach/irqs.h>- r- ~3 O1 x+ K* W& k/ u j
- #include <asm/hardware/edma.h>
' A- y9 b& [. B
]* o* [. v3 n7 t6 V7 ]- #undef EDMA3_DEBUG
8 h! q+ l$ G- l - /*#define EDMA3_DEBUG*/
/ v* G3 x" g$ O% g- C - 7 g& i' ^% P6 k& E- w3 i( c
- #ifdef EDMA3_DEBUG9 C8 t8 Z. ~ P! i' P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 o8 r& g6 U( {" V: S3 \# E8 J* s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. B: r% h8 f6 ^) R3 U: t, ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 k3 N9 T7 L8 v - #else& x. M9 F, o# W9 q* S2 u I
- #define DMA_PRINTK( x... )
3 b) r0 f8 d& E' c - #define DMA_FN_IN
% A4 f# T2 Q" A6 d6 T; ~ - #define DMA_FN_OUT
1 _- S/ d1 F6 n/ `3 l. i - #endif# }9 j7 M" v, y( k# Y$ g
- % s, G7 ]/ J4 y* z& D& i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& z4 T. l, U4 {3 `- Q3 j+ e2 s0 _- A
- #define STATIC_SHIFT 31 d: P. s5 X6 J% ?4 y Q& J: V
- #define TCINTEN_SHIFT 20
" ~/ ~7 E" \1 Y8 L4 i1 @. X1 ~ - #define ITCINTEN_SHIFT 21
/ Z. k& p4 U2 B V7 v G( b - #define TCCHEN_SHIFT 223 _: f! X- O/ H- o, ?& e7 {7 O
- #define ITCCHEN_SHIFT 23
0 O% w4 a% }( d7 A6 l
3 M! O1 f* o; |1 F# E8 s. Z9 c- static volatile int irqraised1 = 0;" T8 b! r7 F: D9 n: O
- static volatile int irqraised2 = 0;0 ^6 `/ N4 C L' |6 L" \
' M3 g' \& w" t( k) v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); z' j2 O0 E: b" J# J2 X L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 r. N }( T) |+ R" {; `4 y! ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 _) Y" h! D* r) t
- c1 O# e/ J$ y; O6 j
- dma_addr_t dmaphyssrc1 = 0;! F. H5 K$ V8 R
- dma_addr_t dmaphyssrc2 = 0;9 H0 U1 a; D2 A! c) K1 K# ?
- dma_addr_t dmaphysdest1 = 0;
8 W' X7 O# U8 I% l8 S* W- M - dma_addr_t dmaphysdest2 = 0;
: L- C8 ^: G2 z' b - ) g: J& K0 m3 Q
- char *dmabufsrc1 = NULL;
, ~/ S6 ?! i9 w: L% H - char *dmabufsrc2 = NULL;- h1 P- G& R }# Z
- char *dmabufdest1 = NULL;: h4 Q3 q7 b5 j
- char *dmabufdest2 = NULL;. V' h! M8 k* y
- 1 {7 I7 V t" ]0 h
- static int acnt = 512;( { X5 t8 E8 b, }$ x4 f
- static int bcnt = 8;
2 A* m& \$ S7 T. U" v - static int ccnt = 8;
C$ v" ^3 ~! G) |4 B/ p! F( i - ( ~& J1 Y+ c7 N' ^( d7 i1 R
- module_param(acnt, int, S_IRUGO);+ P1 v6 \9 e5 v: T0 J( ]
- module_param(bcnt, int, S_IRUGO);
( X9 H/ Q& k: f: C, q9 T - module_param(ccnt, int, S_IRUGO);
复制代码
1 d5 _6 A+ N3 q' p8 D! C0 Y3 q$ V
3 O% F# N2 j* [ g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- k5 I% l, y. r0 c4 i( {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ o8 x8 [( q4 O' S; N. g1 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ l1 M: }' E' k4 @
) ?8 P8 O/ l0 s( t9 j( W7 g' E( s6 U; i, C
|
|