|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ q; ~1 e+ v+ S- K. _5 Q/ a7 v- [code]EDMA sample test application& \; J9 [& A( J
- /*
- T7 |, \- v' t( o - * edma_test.c/ U2 B6 m- j- N* a0 S1 d- a8 C6 U
- *, d' \, B r4 A* S8 P9 b! H: y
- * brief EDMA3 Test Application
, I& C5 ^ n" n - *4 u8 q5 V2 `7 L" l% _, U( r
- * This file contains EDMA3 Test code.
7 Y4 s) M/ C+ x" t) k" e - *- B, m4 M* h- ^+ H4 W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ u$ J& X! R7 _0 V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ F7 t! Y% c3 r3 d6 q, U - * TO CHANGE.
# o; }2 D) j1 H3 |6 e& f" s - *
4 D6 h# L0 }& `9 Y2 O, R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& }0 q/ h3 W: H" Q% D$ l - *
' y. S) L3 F3 v g( R - * This program is free software; you can redistribute it and/or9 q; e2 y, L" w' |0 g5 R' l
- * modify it under the terms of the GNU General Public License as
& [2 c) g4 E5 }, b$ R - * published by the Free Software Foundation version 2.
5 P4 R# x% U$ j5 W- R* h - *2 [/ X$ S* |- i }3 {- A& c# a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. z1 I' S3 v3 ]3 _ - * kind, whether express or implied; without even the implied warranty
& R0 p. a* O" I; O- T/ A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ k* `6 d s8 p8 l8 e, L4 }
- * GNU General Public License for more details./ i$ e9 m' f& c' i: U
- */. I! }9 O* I$ Z3 U
- + e$ V1 k% ?" z9 y: D( X
- #include <linux/module.h># e- {2 O6 R# [/ Q% N2 X3 R$ u# A
- #include <linux/init.h>. `0 ~# L, I" \) |6 i# [
- #include <linux/errno.h>
$ A" h3 o: a7 b2 E* i3 k - #include <linux/types.h>
; g' f! r* x( E5 |; U - #include <linux/interrupt.h>5 w% \6 m. d) \' C2 }9 T" [
- #include <asm/io.h> S7 ~6 F+ z& a
- #include <linux/moduleparam.h>
; O' o$ O4 a1 t6 q - #include <linux/sysctl.h>) M9 h1 s) i% h) q1 h0 x
- #include <linux/mm.h>
. W( P0 k: k9 d - #include <linux/dma-mapping.h>; a1 _9 H+ x8 \1 f
- # |9 X6 j q( t3 D
- #include <mach/memory.h>6 y; ?% U0 a/ F. m2 g
- #include <mach/hardware.h>: L8 i. d6 ?, P t' U$ K* G
- #include <mach/irqs.h>
# b% y I1 Y2 N8 D L5 ~ - #include <asm/hardware/edma.h>
0 R0 G c7 W- t* J; A5 D* b
) s. z% _0 P* c& n& r- m2 H% l- #undef EDMA3_DEBUG
: W0 V$ e5 E* d( |- Z - /*#define EDMA3_DEBUG*/
7 Z) p0 \$ P' b) _7 n. u& z7 _
$ ^3 Z2 q, v+ B% y* D- #ifdef EDMA3_DEBUG
. h$ P2 }, ?- ?9 _3 ~( I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* P6 y8 S" E7 z: t) j0 O/ z! K( z( [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. L* u p1 \$ |1 N9 H( D* x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* }' f' i, |7 `8 S, G7 Z1 M5 | - #else7 {! r. `. n% G" V j: m! n( Q; o, o
- #define DMA_PRINTK( x... )8 s6 O1 f. J8 d: Z
- #define DMA_FN_IN
$ ^# s: j0 q. M4 z0 Q - #define DMA_FN_OUT( q+ ?, B% w, j, c+ Y* W
- #endif6 C! H) T/ [. E8 B. @
- 1 ~* E, b+ h# M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' p! d0 N& _* Y5 I3 N& I
- #define STATIC_SHIFT 3
* R- \0 X+ Z/ M. x8 d6 s - #define TCINTEN_SHIFT 20; ~; G! G6 q" k5 _+ B* b3 V! U8 ~# a( O
- #define ITCINTEN_SHIFT 21. O; n0 V2 x8 P" {5 |4 B2 ^* ?
- #define TCCHEN_SHIFT 222 F( U0 B- |- `8 t E4 E
- #define ITCCHEN_SHIFT 23
, b' ^; w! b" {0 t/ z; V1 l
r) Z& m4 {: c- static volatile int irqraised1 = 0;
}+ ^% Y! W) Z: M1 d - static volatile int irqraised2 = 0;3 N Q- ~6 l: x4 a( r
% L0 O0 ^- q" f* D/ {0 t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" K, M6 T; m0 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) i. Q% D7 @: n" V/ h. O, _, u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r' u* N/ X! p2 @$ l9 C
) z# w/ z. }9 W) _- dma_addr_t dmaphyssrc1 = 0;
/ _0 X& T/ Z1 ]% t - dma_addr_t dmaphyssrc2 = 0;4 ^9 V' M9 O5 d' p8 H" r
- dma_addr_t dmaphysdest1 = 0;
( e# G: n( \, U" z5 E7 C" U1 x0 z3 t+ H - dma_addr_t dmaphysdest2 = 0;
# \# Q6 ]1 F, Y9 n6 e* v8 O I
9 K0 e( {( u+ J8 N- {5 A2 z- char *dmabufsrc1 = NULL;1 s2 g/ w$ s% h( V4 p$ d
- char *dmabufsrc2 = NULL;; H6 n. H% i- w( s4 K( ~+ O; F3 K8 s
- char *dmabufdest1 = NULL;
) S+ f( R) ~6 A8 H v - char *dmabufdest2 = NULL;# W" r4 t2 |5 \) L% o, m
- 9 m$ O" V" D# G* p6 ]& e2 {
- static int acnt = 512;; g, N& f- H9 I6 @) P m' R
- static int bcnt = 8;4 A u8 C) t l2 b A8 j
- static int ccnt = 8;
4 Z( r6 S7 P' Y7 e6 b! p' b0 m1 K( e9 K - _* y7 v; V6 Q6 Z" K. ]
- module_param(acnt, int, S_IRUGO);
# k# P! u3 W+ e6 v; k$ C e - module_param(bcnt, int, S_IRUGO);' z$ V9 r5 D% `% s* a
- module_param(ccnt, int, S_IRUGO);
复制代码
2 q& H) k9 C% r# m% r/ G; f5 B5 r8 m! V5 E, d/ i Y0 t5 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 g- L( j0 o* a7 o' e1 X) E2 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 `" R. V: S# H. H* G5 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 p: F. G0 ]( g. h3 F4 C" U4 T' H
! u4 c8 M' m. O5 Y+ y |
|