|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. n" P# I+ Z/ l2 z- [code]EDMA sample test application
3 m& u Z" n/ k' v" C4 m - /*7 w0 j2 [+ P5 Z5 o+ c B
- * edma_test.c
& g; J8 _( d! m p! Q( Y% o - *9 H5 b1 Q: Q* n# H; j
- * brief EDMA3 Test Application
4 T( k- ~0 k- d" ^- ?3 Y6 m - *
1 i: `" ?( }$ n5 K3 p, X# r4 @ - * This file contains EDMA3 Test code.& F- c( [/ F8 l q
- *: z; [' B6 b- p" P: @2 L1 q" q( T4 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! u8 y N' s1 k) ]3 h7 q$ A" b' K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 \# x1 H( V0 U6 ^4 E' ^* x- X+ o - * TO CHANGE.
2 N3 z) l7 v7 |, C: }; `* ~ - *
5 X2 u/ A/ M2 U2 e/ L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ p! x- Q# X- b& z: k
- *
7 J$ \# N, W7 j3 y* |$ o# z - * This program is free software; you can redistribute it and/or
8 R8 H6 s* Q+ B; y% i - * modify it under the terms of the GNU General Public License as
( x7 C* }: U) J5 S5 r9 @/ @# V - * published by the Free Software Foundation version 2.
" [( | s/ T7 K# ^! c1 ? - *
6 A, T' G+ a0 S) l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& b7 {0 k) @& J* c. y/ b
- * kind, whether express or implied; without even the implied warranty
! h* z& s6 \/ n' W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& \2 G& w5 u+ b9 L$ ]% T# r - * GNU General Public License for more details.
4 {( I8 K* S2 v7 ~+ ^4 m - */
9 Z) |% q& k" |2 G
1 b6 y; d7 C+ x P7 u1 Z- #include <linux/module.h>
9 N: b1 o9 f4 m2 b6 w- d9 \ - #include <linux/init.h>
8 p( k# D; L% }6 ~6 r - #include <linux/errno.h>% L3 n' T/ G1 Q
- #include <linux/types.h>
& U& C- V; ?6 x$ W - #include <linux/interrupt.h>
& \; E6 _: j; m - #include <asm/io.h>3 J+ v+ z" b7 u: G
- #include <linux/moduleparam.h>6 P9 M- Y& P% k
- #include <linux/sysctl.h>6 A' l: E3 h& q: f1 W! n
- #include <linux/mm.h>0 a( C+ Z5 Y1 j8 U7 h
- #include <linux/dma-mapping.h>
! o6 }) w6 i- Q) X0 w+ r - 1 f" q& [' E( d9 E0 X$ |
- #include <mach/memory.h>
4 ~ [. F- O8 T: @6 c, Y" f - #include <mach/hardware.h>
5 l% T% |. V$ z. k - #include <mach/irqs.h>
: L8 `6 Y4 u& t1 J/ F& i% g - #include <asm/hardware/edma.h>
5 ^4 {" C2 S& T' Q [ - & \4 Z) Z7 q" U+ ~
- #undef EDMA3_DEBUG
" a, y6 }' P+ O$ j7 V - /*#define EDMA3_DEBUG*/) D2 l+ D4 c5 c# {
& P3 O- ^- j; M# w5 Q0 X2 R& @- #ifdef EDMA3_DEBUG
) ~, H" _4 l* V# F& n/ Q& x. C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 }$ q u" g( q5 b3 P# g8 @5 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D& K- ^. J; Z, ]3 D& s& K% D8 L7 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ n; w" M! u% u+ t0 ^2 p% O - #else
$ |2 a3 l9 |/ l+ E - #define DMA_PRINTK( x... )2 i; i6 o; ~; @1 z L* R1 j* Q
- #define DMA_FN_IN
2 w6 ]5 U2 O1 R4 q8 n - #define DMA_FN_OUT
e$ }9 I2 a; X+ w; ^5 x - #endif5 l: D3 A! V$ O, G8 Z. l$ L8 d
# m4 e3 @4 B3 F+ G5 m. T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 t, @7 h x7 C V' M% K7 b% i
- #define STATIC_SHIFT 3
" W, B$ H) m1 n7 w - #define TCINTEN_SHIFT 20! q8 k, ^- S. Z' U
- #define ITCINTEN_SHIFT 21
/ k8 s( n' ?6 j - #define TCCHEN_SHIFT 22
0 J; `8 r; z' R5 V - #define ITCCHEN_SHIFT 23% j. b" b% v/ L% @
- - X; Z& K1 h4 h( v) r. ]
- static volatile int irqraised1 = 0;
; d% Q" z F+ A+ R! U7 s; V: G7 E - static volatile int irqraised2 = 0;* L7 b9 ]$ D& F U, s0 p& s/ z
' k/ |4 Z1 M" [, N7 n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 F+ @' H$ I8 X% y: R4 n$ W4 V9 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& p2 i$ i* p( E8 D+ ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. P6 k1 e9 Q" T) Q - , Y5 s# z" o2 y: S, M/ K
- dma_addr_t dmaphyssrc1 = 0;
* ^! W; t. V! I/ x9 x - dma_addr_t dmaphyssrc2 = 0;3 e+ J; c! p: X! N! Y+ [- B! |
- dma_addr_t dmaphysdest1 = 0;1 _4 k2 `- M d
- dma_addr_t dmaphysdest2 = 0;
- `" i( W2 a3 {& T0 F* p
; K4 [; R3 B+ Z- char *dmabufsrc1 = NULL; i) x: C; V# {1 q- c6 N8 Z
- char *dmabufsrc2 = NULL;/ }: ~8 w6 X5 r4 r
- char *dmabufdest1 = NULL;6 u, k3 o3 A/ u8 j/ F5 X: z8 p
- char *dmabufdest2 = NULL;2 a& [8 W. w# ] f6 Y
- ( X# Y& Q' f' x8 d, H5 f3 v+ B v
- static int acnt = 512;
% q5 }# U1 e& N2 P - static int bcnt = 8;
# }' U+ ^% R2 A, o/ C - static int ccnt = 8;+ D6 e" Y; F( |; h
4 E8 d& ?$ n7 h. b! C- module_param(acnt, int, S_IRUGO);
. a. I1 P6 g# F% L- a. s - module_param(bcnt, int, S_IRUGO);# w& U9 v/ V# n7 U, C
- module_param(ccnt, int, S_IRUGO);
复制代码 ! J4 a2 S* t$ h8 B0 ?
! ?% Y! S$ P2 e5 ?2 A0 B C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p' X; @" j \' o1 X! i4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# Y4 g7 u* v! D; A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; A1 d; v; X; l: d5 ^/ G
! E, y+ ~, P0 ^) x# H- B
' k9 [ P* g' H, E6 C |
|