|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 h, C: ]1 ~( _( u$ G3 ]- [code]EDMA sample test application
* J- n) k. D0 Y - /*
3 i, L$ ^1 S4 D2 B0 J - * edma_test.c4 n. P2 N3 ], q( A+ ]
- *
3 }, I' H3 ]% G8 e) D6 X- ~0 C( | - * brief EDMA3 Test Application0 ^7 Z1 q$ {4 T% [5 M$ d
- *( I" i% F! U* D
- * This file contains EDMA3 Test code.
. r6 L' [, y; N: ` - *
0 x4 T0 {' p5 H4 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 [3 X" K- n: B- ?8 `5 e H" `3 d/ J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# u5 k; c: J9 g& _! J
- * TO CHANGE./ t4 E- c: t5 F1 P9 K$ U
- *% h5 m' q" n' n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ `; S( G3 o' Q2 N1 M; k
- *2 w) f2 n8 _3 y s* f
- * This program is free software; you can redistribute it and/or3 W6 j6 j% f; ]8 e; ?8 p# r& S
- * modify it under the terms of the GNU General Public License as1 Q8 g3 e) J! |
- * published by the Free Software Foundation version 2.
7 N3 S ^; [) v6 x - *+ z4 |, Q0 ^* G6 O# F r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& r7 |; h5 e; T - * kind, whether express or implied; without even the implied warranty
/ b- j; q+ Z, h9 ?& u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 |1 R; R3 f8 i: U' b% w9 m; R - * GNU General Public License for more details.
- @1 q% O) N& J3 d7 x - */, o" A7 @; ]% { c U! G
! B* ^# y7 a# b0 f; l# m4 k8 g- #include <linux/module.h>1 E+ c9 r/ P. S! V
- #include <linux/init.h>& |( B! t; m) f P
- #include <linux/errno.h>+ D/ I7 L1 E& b' }" M
- #include <linux/types.h>
- s; j4 a8 }* A7 U5 L) B( \ - #include <linux/interrupt.h>: R) ]7 P( i- t# C3 P4 X
- #include <asm/io.h>
& \! z( `% f( |% X4 m w. x% C - #include <linux/moduleparam.h>6 G! g" }" E( X- N
- #include <linux/sysctl.h>
, h& E+ y" |" I6 Z1 e, K9 r5 I: b - #include <linux/mm.h>
7 j' z- Y; l$ o$ e - #include <linux/dma-mapping.h>4 q6 ~) E; o* E
- q" ]+ |3 f) @9 e. @) b- #include <mach/memory.h>
0 H8 E: q1 _' }) ^ - #include <mach/hardware.h>
l0 V0 W. w1 [$ h: ]/ I i" V { - #include <mach/irqs.h>
3 {/ J7 o3 z! _ - #include <asm/hardware/edma.h># B% {/ Q- t0 y) m2 L
- * @7 F h4 U! R% d* a
- #undef EDMA3_DEBUG3 a# H5 o) ^: N* m
- /*#define EDMA3_DEBUG*/
6 j' t2 l' n+ I5 D6 ^
+ I0 a* n/ j6 f/ K0 ~- #ifdef EDMA3_DEBUG
& f6 Q. `7 K, x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# _ [+ f9 v$ d8 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 E$ O8 c/ F5 x2 O# y* p) C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- [$ _7 q; t1 \. p# \4 G! z - #else: F! [# w9 W' ?9 U
- #define DMA_PRINTK( x... )
* ?. W2 {/ Z' ^ - #define DMA_FN_IN
: p: P$ n9 z* b* }8 y f) Z - #define DMA_FN_OUT
1 B; x) s4 [' r/ V( q4 Y - #endif
$ b! s, u1 H* W0 q1 T( T4 a
) Z1 f$ b2 }) E; z5 I) [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! Y; F8 n; Y6 u+ p - #define STATIC_SHIFT 3
t; E2 v1 j# Y3 i8 w - #define TCINTEN_SHIFT 206 w( a/ E& u# [8 M3 z& U5 f; e
- #define ITCINTEN_SHIFT 21
+ h" b7 G; y0 p0 |7 e - #define TCCHEN_SHIFT 22' G2 T P X, f1 o4 S, X
- #define ITCCHEN_SHIFT 239 p& B" f+ L6 K/ ~# r9 s6 @8 C
; X0 | T& W) b" D7 k- static volatile int irqraised1 = 0;
3 W' q0 C& l7 d$ J. W ]& I k/ v - static volatile int irqraised2 = 0;
) R8 P ^3 f E6 R4 ^: [& _
+ |: C+ S* q ~/ N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* e, x* j% p$ g* z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 q8 A9 _5 ?* a+ Z; E4 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 `/ p% l4 c2 a0 Q( y - 0 n0 X4 \3 {# Z8 o
- dma_addr_t dmaphyssrc1 = 0;" H0 k: N& b- M9 D- [# u" s( r8 ]
- dma_addr_t dmaphyssrc2 = 0;
) Z4 Z& w6 R. S4 P; \/ b) I - dma_addr_t dmaphysdest1 = 0;% N. d- m" P/ P2 q4 L
- dma_addr_t dmaphysdest2 = 0;
6 h2 ?6 K0 J7 v& H% r" K* L - 7 g: ?2 {# [4 y3 Z; n
- char *dmabufsrc1 = NULL;
: E7 r0 ]1 Q" S. ~8 O+ b - char *dmabufsrc2 = NULL;
. |5 z9 P. C% k, }. U. z% I - char *dmabufdest1 = NULL;
2 g6 P. s& y6 {- v% r. ^! i - char *dmabufdest2 = NULL;$ C' I1 W! v' c- t3 K1 T0 o+ d
- ' W# {7 |- }8 P& l% L0 v
- static int acnt = 512;
) U9 W$ i0 K7 m n3 h$ C( z - static int bcnt = 8;
* s8 h3 ?4 H* K - static int ccnt = 8;
1 ^* \8 r+ c& W7 p. K4 H
4 O" K1 E5 j4 I# B J) P% k- module_param(acnt, int, S_IRUGO);+ F b! P/ `' i6 u
- module_param(bcnt, int, S_IRUGO);* G% g* f4 a- k# ]: H; z
- module_param(ccnt, int, S_IRUGO);
复制代码
% Z' }. t7 [5 X( X M" H
' i. ~$ t/ r# D1 `* ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ L9 \4 g0 c4 `: Q8 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" O# Y; X1 g7 C. E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 [: G5 F0 h0 e- B
O: F& @$ n+ [7 O- G- g
! I; j1 a$ Y: k3 w7 G$ L0 e |
|