|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 y' v- _) d& S: }3 a8 H3 K S
- [code]EDMA sample test application8 h) Q r, d; P
- /*' p0 E9 T3 L% S+ U4 U1 \
- * edma_test.c2 _) w: ] @$ g4 e- \2 Z
- ** N4 U% f8 C1 }7 B$ v$ N
- * brief EDMA3 Test Application9 g- C+ O6 `" A4 P
- *+ m3 R+ _) N o7 B& a; s) q1 N
- * This file contains EDMA3 Test code.
% ?. ^8 o/ o% n/ m5 _, W - *
' [; H4 t3 j- w1 F8 N' V$ a4 p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' N- f9 n2 H% v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- d/ p9 x2 |0 _* V5 D/ [
- * TO CHANGE.
. S `; w, N" L* c - *7 h* X: S( g- R" B: R% a; L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 i9 W7 g* k! ?" c - *& W+ S3 v' }' H1 a+ N; n t
- * This program is free software; you can redistribute it and/or
4 K, E* R' s8 C7 P4 B2 l% J" q; y - * modify it under the terms of the GNU General Public License as
8 x8 m( q3 f$ `. H - * published by the Free Software Foundation version 2.! k- H K. r! n( c* X. O
- *
; Y$ a# ?) H6 z, r$ g3 z y& J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, O! O& a- u8 C9 C, B5 I
- * kind, whether express or implied; without even the implied warranty
! I t* g8 n" @" |+ B* Q: P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% |' l$ ]$ P4 I# X7 \, U+ v! w! C! d
- * GNU General Public License for more details.
8 P* f* u0 L* i8 L3 F: q" c - */
% A- U$ @; Y5 r$ C9 T, w2 h0 u
8 ~0 \3 }7 [2 d& _- #include <linux/module.h>
4 m7 c$ g8 |- P+ A - #include <linux/init.h>9 u5 h3 Y6 L8 r: D1 u
- #include <linux/errno.h>5 \5 T6 d& U) b* ^( p9 ?+ |
- #include <linux/types.h>2 }* x9 u a G, Y0 ?2 ~0 @
- #include <linux/interrupt.h>
3 Q2 M; W4 t& ^1 D - #include <asm/io.h>+ f' b& |" S9 k! I# q a5 @
- #include <linux/moduleparam.h>0 J- ]' n' P: b, _- P3 G" p
- #include <linux/sysctl.h>
* Q# @4 }: x3 ^: N - #include <linux/mm.h>
' `) @8 G; }' \% W. U' T - #include <linux/dma-mapping.h>
6 L& n9 x; n4 c% {
- ]+ z2 N" D$ W$ ^5 E- #include <mach/memory.h>
/ }7 ^+ ]3 y% s# L - #include <mach/hardware.h>
5 A+ I7 M9 Q' j6 K) W - #include <mach/irqs.h>
8 n2 j' v O/ Z1 l9 j4 t - #include <asm/hardware/edma.h>
3 _9 J$ ~ Y4 }( U - : U" l% Q* `7 B2 Y+ U0 U0 ~) F
- #undef EDMA3_DEBUG5 P4 B# m$ N+ _: ], E) |! q# ?# k( U5 r
- /*#define EDMA3_DEBUG*/
8 G7 Y) D: r9 N2 t2 o+ q! Y- | - 3 l {6 M) ]% ~* Z3 c. v
- #ifdef EDMA3_DEBUG
3 ~, r' e+ U( g$ C1 f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. b2 C& a. O- W' N, ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 @. X0 a! b! L" E* D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ G" C8 b$ [% ?& z - #else8 h2 G2 T9 `: y! z( z
- #define DMA_PRINTK( x... )6 C8 o! ~ l8 P+ a
- #define DMA_FN_IN- K3 Z+ H. \3 w7 M& k
- #define DMA_FN_OUT; I" p/ g% I5 k5 ^
- #endif9 j" b* n4 V) U- t, ]1 e% x7 ^4 h+ @% J
- # Y3 p3 _6 I% z/ W- r( [0 }, d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 p! v( S/ w' e) ^7 H; X M - #define STATIC_SHIFT 3
5 | G( x# O( Z% q" K" W! J1 z - #define TCINTEN_SHIFT 209 ^1 H( b% R0 [; O1 N
- #define ITCINTEN_SHIFT 21
" Y( v& ~% r; [2 W ~. \0 W - #define TCCHEN_SHIFT 22: ^, b& W2 ~1 N) E; h$ B+ r; ]
- #define ITCCHEN_SHIFT 23
1 |5 G& K5 D+ S* x
! w d4 V9 k7 W- static volatile int irqraised1 = 0;
0 ?% D5 H( g( a6 ]5 H' I - static volatile int irqraised2 = 0;
. F& T0 O/ i4 p$ @ - 9 _5 r. O. g8 \4 J, }/ z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- {7 c/ q( I( v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y* A( Q2 g, y( C4 x# l8 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- u0 b" h% z5 Z
- $ a. w- I* u( K* d3 ~" Z4 e
- dma_addr_t dmaphyssrc1 = 0;6 o8 G. ?# Y4 M `) {, R
- dma_addr_t dmaphyssrc2 = 0;
- @, c; V9 V# b) {1 |7 D - dma_addr_t dmaphysdest1 = 0;# Z, \$ H" J' \
- dma_addr_t dmaphysdest2 = 0;
6 h# R4 j6 c A) d5 B% P: G. B, ^" K7 [ - / j7 A( H5 ?% v( I5 L5 K0 i* K3 P
- char *dmabufsrc1 = NULL;
( Y p4 b4 R" @, i- D1 Z' s# u3 q - char *dmabufsrc2 = NULL;
9 x" A# E/ U! w- W% I6 v - char *dmabufdest1 = NULL;! y" P- U0 X0 {$ s% W. l
- char *dmabufdest2 = NULL;
# }' O3 E+ }6 H5 R
7 A+ B' r `" b- static int acnt = 512;- Q3 [8 j3 e+ c, J# O4 f
- static int bcnt = 8;
: l' O( K# u. C+ B6 u4 p - static int ccnt = 8;' f5 k \0 [3 g6 v6 ]
1 _! K3 g* |6 g( f7 n5 V e- module_param(acnt, int, S_IRUGO);
7 D ^/ o! N2 H - module_param(bcnt, int, S_IRUGO);2 E8 a. l' W' M+ S/ m- @
- module_param(ccnt, int, S_IRUGO);
复制代码 1 z) ]( C4 D* T2 H; D
1 [/ S1 r; b% c8 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) E8 s9 n9 R7 Y" f- s7 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 T: O2 u2 g8 |# G% d7 U' Z, w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ A8 |' ?8 a; M2 } D. x4 l! \7 R. y* A9 U: E9 v
' S5 X/ V* Q# n
|
|