|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) s9 P; ?7 p- `: T- [code]EDMA sample test application. U2 x% \# Q4 }. G0 Y+ N
- /*: J7 Q" @+ Q4 r7 C: l% P
- * edma_test.c5 \ }7 ?1 ~8 q& ^- ?/ k5 W
- *# h8 s" k$ L. _/ u% q$ U
- * brief EDMA3 Test Application4 d0 S F* U( |- Q6 P
- *' U9 c0 r! m Y
- * This file contains EDMA3 Test code.( C" U, @8 ]6 ]! n: n" n
- *) C" @" ]; n: R8 m- W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; O9 \: \- U1 h- b' Y$ M5 r+ t' @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 h1 o x R) L. l |- X6 k9 y) J
- * TO CHANGE.: j8 {# }; h5 M6 Z# u
- *8 A* k; S8 Y$ {$ D' \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) v" `6 g: I9 H4 v - *$ ]6 M- m5 z1 g; F; I% m2 j1 j" q
- * This program is free software; you can redistribute it and/or- `0 p, Q5 Y. Q0 s
- * modify it under the terms of the GNU General Public License as
9 O* S; `* @5 E! l4 W: v; S j - * published by the Free Software Foundation version 2.! |7 Y5 X! U6 u& R8 \7 U, j
- *3 l, ]+ V% {0 |: F7 ?1 I' L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% A W! P6 V4 K/ Q - * kind, whether express or implied; without even the implied warranty
- g; ]0 G# o: k( D% w1 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) P @6 S2 g% O' j) X
- * GNU General Public License for more details.
6 N8 m% L. [; J9 `: B% \: m" F2 I - */8 p2 b- j. j% V' x) y
2 ~) b" Z) j @ F0 A5 ?( p1 U' G- #include <linux/module.h>
% k- ?! x) I- P4 d" ]/ ~* T - #include <linux/init.h>
( j6 f0 p6 H0 ^' ~ - #include <linux/errno.h>
3 l! a" A5 d6 f1 D - #include <linux/types.h>8 [5 z$ |9 \ v; a4 Z
- #include <linux/interrupt.h>9 X* ]% H0 U1 ?- R( Q
- #include <asm/io.h>2 x% }# [' p6 z6 i s; y3 u' `
- #include <linux/moduleparam.h>: L% M. L) W) X
- #include <linux/sysctl.h>: D: m- t" B! P, Z/ i
- #include <linux/mm.h>
) I D( e% z7 u8 G - #include <linux/dma-mapping.h>7 H% a' ~& x" ?0 J+ E: c: C
, U& o3 f! T8 v- #include <mach/memory.h>- ~5 J. |0 i4 e: a; N* X1 d4 \- X7 N
- #include <mach/hardware.h>; a4 l4 ~7 O g/ A* |
- #include <mach/irqs.h>
1 [ p! _7 P( U - #include <asm/hardware/edma.h>
, E$ u& U# ^3 g: b. O
5 w. d/ @1 M6 y. H% Y4 c( K- #undef EDMA3_DEBUG
* Z8 x" ^# u7 p, R0 u- ` - /*#define EDMA3_DEBUG*/
* P A: z- b/ R) k! ?( [ - + m, l! @' E$ \# ]+ M# p5 @1 i
- #ifdef EDMA3_DEBUG
4 m- q& a$ B; G' L' q- d; s* d$ y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). b" y8 P$ O2 ^9 i2 D9 t( `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 Z9 W8 A9 {, i+ K( I/ e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* m( i. Z* [' o3 i - #else' p4 c/ ~, H! c1 Q$ D
- #define DMA_PRINTK( x... )
' ]) Z. `3 e5 ]) U, n& l! V - #define DMA_FN_IN
: G. D ^9 l9 |# }9 F. r - #define DMA_FN_OUT# h! C) u* {5 \, }5 \
- #endif
, r& N* e# I5 s y9 H3 @8 M - : H9 O& ~, |0 C( _, c( B' l5 {" M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: z r0 X, U" u6 @1 { - #define STATIC_SHIFT 3
/ y- Z8 T# w: w: t7 d5 p - #define TCINTEN_SHIFT 20
( F) H( r! m+ x - #define ITCINTEN_SHIFT 21( I5 e! C6 y8 u
- #define TCCHEN_SHIFT 22
' O% A+ Y$ j7 |6 K - #define ITCCHEN_SHIFT 23: Q- M4 v) E+ U+ V) w. W0 K
! q0 \8 _5 b* d: e/ ]6 E, m- static volatile int irqraised1 = 0;9 \2 Q2 I5 o: R- O( p% W
- static volatile int irqraised2 = 0;
: d7 T8 t( X# B6 w6 G5 v( H: p0 C
# J0 u# ^9 ^3 @' s# R* P+ L+ v1 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! K: t: g( ]! A8 u, L2 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" c1 t3 V6 S# t! a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% G+ o* L8 H! C3 E% r
- ) Q9 Q: P6 ]. E
- dma_addr_t dmaphyssrc1 = 0;% S3 _" R H& F$ x- r6 b
- dma_addr_t dmaphyssrc2 = 0;$ c7 b6 \! g; X- |" W
- dma_addr_t dmaphysdest1 = 0;9 e) d1 e+ o* f# z, U
- dma_addr_t dmaphysdest2 = 0;
6 u& Z$ K: k; i# ]5 i$ b: F% F
* e# K2 C! m/ D% K0 r- char *dmabufsrc1 = NULL;
! ?/ c [% E: h7 a+ f/ H5 W - char *dmabufsrc2 = NULL;4 e* o! s8 u1 o4 t$ B
- char *dmabufdest1 = NULL;6 Z/ Q9 L* Q# }$ q' B
- char *dmabufdest2 = NULL;! x$ s) r* o8 O1 x
8 H, ], m1 w3 o! b- i! K5 r6 P- static int acnt = 512;! v' }) J/ {" c2 \. N: o
- static int bcnt = 8;+ S: ]( l6 Q( }/ V( O' z
- static int ccnt = 8;
9 Q" R4 F- {1 o
- I( x- o! B/ e- module_param(acnt, int, S_IRUGO);6 E3 T' D3 a3 f
- module_param(bcnt, int, S_IRUGO);7 m' T9 M9 W" H) ]
- module_param(ccnt, int, S_IRUGO);
复制代码 # |4 b' e, U* D4 H" \
5 w+ L+ j/ a: A( ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# i- U" S6 j; G: z) i: L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; H0 H) K& M6 ]- P' h$ x- g% K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 n. j8 A c& J8 v/ c; ^. G0 t* W! K! G4 L) _6 i5 f5 h* x
8 h& m8 m$ S; E( j9 `4 U |
|