|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# q5 g' t+ O: r$ B" x+ M- [code]EDMA sample test application5 o2 p/ a- ?; T" A% l5 t4 @# u% w
- /*$ p/ x# Y# z0 i* R; O8 a! F% x0 E
- * edma_test.c6 j8 w" Y) Z T3 w
- *" Q' e, C* b5 k [
- * brief EDMA3 Test Application
" H# v- M+ a4 p& X - *; M' s7 c. H$ N; ]# x1 y* V
- * This file contains EDMA3 Test code.) K+ v2 n: ?5 c5 O+ J" }" Z3 J
- *
9 t2 v9 g" ]" J, C! `6 K7 G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 D- Q s! i$ F, r: Y6 n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 k4 p1 S+ \# y' m
- * TO CHANGE.
R! f0 t' C) B, @# a0 P( j' c( a - *
- S$ M* {- }3 {# J) u9 {* m8 e) ^1 n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ T3 [* I$ T# a8 F; S4 e
- *
1 \6 b3 k+ ~8 \# b1 `% @: Y - * This program is free software; you can redistribute it and/or5 Q; ~0 V2 _* ^% ?7 `' W3 w
- * modify it under the terms of the GNU General Public License as6 k8 t& H9 T* l5 Z. B8 T
- * published by the Free Software Foundation version 2.( D- z3 x' d- l5 Q4 `7 U0 l
- *
+ F; N4 w0 l0 }+ X% H+ H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! C& ^: ?9 _8 x; M0 k - * kind, whether express or implied; without even the implied warranty
3 x" j- I" Z2 F. ?/ U1 R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ h8 L7 Q6 b5 Y+ O - * GNU General Public License for more details.: a0 g) _& h; b1 g2 w7 F7 P7 \% R
- */9 ]/ B$ p9 D/ n# w
- 2 _, H; X4 {3 J& L3 J
- #include <linux/module.h>
, W" s$ h" `. u1 m! V1 B0 _, w9 Z - #include <linux/init.h>
/ c/ [& m6 F# _2 t - #include <linux/errno.h>9 B% ~' j- z5 _1 P4 C6 g( ]
- #include <linux/types.h>* E: E7 e" o8 d) g! D, q9 W7 [
- #include <linux/interrupt.h>
' z; {8 R- y" [7 ^7 y) L+ f - #include <asm/io.h>
4 ^$ S: c/ h0 `! v - #include <linux/moduleparam.h>0 w! i. b5 O( j6 W
- #include <linux/sysctl.h>
5 ]. ~7 X( K/ K5 }7 l, M2 R% k - #include <linux/mm.h>8 _2 ^6 A. v- |( ^9 Q( r
- #include <linux/dma-mapping.h>
( ?9 N* V6 d9 l% z1 I \ - 8 w$ X; \+ }: P) m, E: C5 O
- #include <mach/memory.h>% o& ^2 r% ]" F& i, X+ G
- #include <mach/hardware.h>
8 ~4 x: ?% s" O4 ] - #include <mach/irqs.h>
. N+ u3 o* ?% m - #include <asm/hardware/edma.h>6 O. I2 F5 H+ V( x% g
- 2 H6 n; [6 @0 q L& q- \' _
- #undef EDMA3_DEBUG6 A- b u @/ C u
- /*#define EDMA3_DEBUG*/+ u4 A$ m) v2 ], C$ }, H
- ) p! g& p. t* H: y ~" _! F
- #ifdef EDMA3_DEBUG
, }& x- E: y4 ~# [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 S& m; \3 L7 _& M& Z/ {* g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 W* j5 q+ l! v9 ^' G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 c3 P7 o9 j; m% q
- #else3 [0 H7 f& o$ W' L5 Q$ [
- #define DMA_PRINTK( x... )
1 r5 K- \( @( u4 ~9 {. m$ H - #define DMA_FN_IN
+ x. |$ v7 i6 r - #define DMA_FN_OUT' W: ~* n1 e, x/ C
- #endif
8 {' k: B9 H& ~& ]9 Z - , I! o& M8 w$ ^0 t! V4 F5 h' S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ C! I. N( |0 e
- #define STATIC_SHIFT 3. c# X M& A$ D3 d, f
- #define TCINTEN_SHIFT 201 n! p4 a2 x$ p4 ]. C9 ^* o0 V
- #define ITCINTEN_SHIFT 21
. B5 P$ o; K" b9 h2 q' Y1 E7 s. s! J - #define TCCHEN_SHIFT 22
! |4 l5 X/ h+ u/ y& `2 r3 U - #define ITCCHEN_SHIFT 23
2 W$ ^0 X; S. |0 h) D& j
, N' y2 ?+ V8 x- static volatile int irqraised1 = 0;
% c5 l1 x' u5 h% F) B - static volatile int irqraised2 = 0;
5 p+ B9 d( G9 z: i
3 P/ G; d7 G/ F$ H+ h c4 Y. d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 y8 Z( P3 b- E. v* ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ M7 [/ v5 p- j8 m" o0 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 w# O; `$ x# a& @2 c) R - 9 _. G+ s! D( b# E9 r7 y) N
- dma_addr_t dmaphyssrc1 = 0;
' _, l5 s* i, _3 s! C+ e$ w" c - dma_addr_t dmaphyssrc2 = 0;3 n1 Z+ p0 f) |! g; h+ R) ?
- dma_addr_t dmaphysdest1 = 0;% I- u1 ]/ o, t0 z! m: k
- dma_addr_t dmaphysdest2 = 0; `! P3 Z/ u8 R9 ~3 L* S
- 2 ~6 @7 |7 A1 g9 j
- char *dmabufsrc1 = NULL;
: Z9 b9 h. U; p k - char *dmabufsrc2 = NULL;
1 I; U: ~" F8 d( Q2 c8 y - char *dmabufdest1 = NULL;
# r9 g6 J" K* G& t - char *dmabufdest2 = NULL;
$ |0 W2 b8 s0 b3 O' \" f" F - 9 `1 ^! U" Z7 t" r+ |1 H
- static int acnt = 512;% u+ S. Q- }2 _
- static int bcnt = 8;2 Y* [. f: x# [ z! S. l# V$ L3 E ]
- static int ccnt = 8;
/ g+ c9 j- D' J2 O F- j+ w5 o, c
$ U9 o: \4 B% ^# P( x5 k. ^6 @% Z4 P% d- module_param(acnt, int, S_IRUGO);" P3 J6 h. r+ q* N7 o: O/ Y9 `
- module_param(bcnt, int, S_IRUGO);7 _1 B3 R; A, I* d0 o0 M
- module_param(ccnt, int, S_IRUGO);
复制代码
1 q# i, @3 z* G; ^/ `; o7 S+ ?; d
4 N; g) I/ {/ {- p$ _) N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ]# j9 A3 ~( v4 K( [% ^5 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; o4 `2 W# { y( U5 _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ I& u2 N2 ?. i0 }! s a1 D& ~" M+ n
( d a# G9 }6 m0 }
4 [6 t% W0 W' @ |
|