|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, J8 Y9 i( M" X" U/ U; o1 I- [code]EDMA sample test application
5 M. V- M3 F3 s9 N7 {/ s - /* K8 F9 L$ Z4 O4 ~: h n
- * edma_test.c
, ~" U* q6 g; h) {* c% X1 R - *
+ Z4 V- ~' r) T N: c3 ` - * brief EDMA3 Test Application* [* m, D1 T% G6 E* E
- *
; b% r; o) Y: \+ N - * This file contains EDMA3 Test code.* n2 M: f0 m4 X. @/ I z, E* N
- *- s7 w" V9 S5 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 v, L% D- u2 f; b6 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- W% M+ N1 n( e9 F( {/ Z) { - * TO CHANGE.# l+ k n. o! s. ]( y4 |& L
- *; f% b9 p7 d. H6 W4 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 [: m \# `9 v- S8 x2 H
- *
1 P1 f$ W' k" F7 r - * This program is free software; you can redistribute it and/or% x9 V. [4 V8 A7 f' b; s3 C$ H& P
- * modify it under the terms of the GNU General Public License as
- w2 K, w9 R6 [) q2 |8 K - * published by the Free Software Foundation version 2.
( B7 N+ [7 R5 t( G. D% D" L - *
8 \$ ]5 F, I3 \) M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 ?3 K/ |3 E. L - * kind, whether express or implied; without even the implied warranty
% W) p' A! ~$ m8 j7 l4 x0 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: |( U6 h9 B% [& g+ f+ R+ t - * GNU General Public License for more details.
6 I1 z6 K/ y7 O9 } `5 O - */
7 n& v, t7 q! B1 L9 L; z( N2 H- U# R/ Y
# C" C5 X6 _+ w: j- #include <linux/module.h>9 }4 _- _- U2 V* R! C. G% Q
- #include <linux/init.h>9 s8 I( z/ X6 `, S! w8 R( N( N
- #include <linux/errno.h>8 A& a9 U g4 z2 I9 K5 i
- #include <linux/types.h>7 B) c$ E( v2 G5 y8 x% W
- #include <linux/interrupt.h>; |' E9 w! O, H0 V J" t
- #include <asm/io.h>
0 o3 x$ P; h8 r: O - #include <linux/moduleparam.h>2 N X; C% F& C+ J X, s
- #include <linux/sysctl.h>
$ |! v4 K+ a3 n - #include <linux/mm.h>
8 O1 g" p( W, c! k - #include <linux/dma-mapping.h>( P' H# c2 Y. p# }1 a6 }
3 z( q( B( c( Z$ y# d- #include <mach/memory.h>0 [ X2 a0 B/ @- _) S8 s
- #include <mach/hardware.h># G i O' J( i; s, |& \& t
- #include <mach/irqs.h>
6 l g8 z% ?6 C0 x* R! C - #include <asm/hardware/edma.h>* H2 O' c# p! s2 \8 e0 T. F/ D" H
- 0 X) K( T% M# T( x3 f m
- #undef EDMA3_DEBUG& ~5 h' C- Z3 a! t; t4 K
- /*#define EDMA3_DEBUG*/ @) h: X- D0 i- \6 q2 r
- 4 Q8 o" L2 l a( T
- #ifdef EDMA3_DEBUG
- ?- m. j! @+ |& k: P; X* _ f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 r6 T* v( l% P4 o1 \$ ]/ x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' k4 V# L! _" Y' |- h$ M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Z: f" }( S& x2 Q' e+ Q
- #else. c H. j) f" J* m4 `
- #define DMA_PRINTK( x... )
! B- L' w- ]3 c; J - #define DMA_FN_IN% g" ~% D( j! F/ G0 e
- #define DMA_FN_OUT( f3 a5 B. F2 x! D/ M) u
- #endif1 h8 H" P; b" Y; E
- ' G" G4 d% S* a2 Y3 ~" Q1 T" ]: Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: N7 B# U+ S. s - #define STATIC_SHIFT 3* m! [7 Q- ]' l1 M
- #define TCINTEN_SHIFT 205 }! x1 O# z- o0 _$ J7 n- w0 {
- #define ITCINTEN_SHIFT 212 U) `! d% O# ?! ?
- #define TCCHEN_SHIFT 22# i) F5 W2 Q$ a9 c( j
- #define ITCCHEN_SHIFT 232 K9 |/ f" x2 J6 G) s
- 7 Z) E$ C! N! l" _6 z$ O, |
- static volatile int irqraised1 = 0; H1 N+ H' Y- x: H& E
- static volatile int irqraised2 = 0;- C* Z* @$ `) M& e
/ Y" S0 f" O0 e& ^+ @* |, E$ {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 M* |* `0 ~; k4 Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y8 l+ `' G& \; h& e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% m- W- }& ^9 s8 g5 v6 N - * m/ Y) _. `+ R' M
- dma_addr_t dmaphyssrc1 = 0;5 f" L- j( E. d x* b
- dma_addr_t dmaphyssrc2 = 0;
/ P6 A2 r: y/ i' O9 P( d1 j - dma_addr_t dmaphysdest1 = 0;; ^: D' i3 [ y3 i
- dma_addr_t dmaphysdest2 = 0;+ l3 k& W7 {( b: n% Z9 r$ q
U; }/ a- E0 o$ b0 B- char *dmabufsrc1 = NULL;- j2 j! r& R7 h m/ g; c
- char *dmabufsrc2 = NULL;
`0 x; e$ e1 ?0 v) _3 Z - char *dmabufdest1 = NULL;
0 S! o. T- ^. C% Z0 P7 A - char *dmabufdest2 = NULL;' |, _5 @$ l3 I6 K3 c% R5 }
- 3 w$ b' I% w% k, ?
- static int acnt = 512;% M- \/ w+ O1 S6 y
- static int bcnt = 8;5 l% x1 g) E% Y+ k
- static int ccnt = 8;
# `- H# m; v9 ^2 l+ Q8 k - 7 c# R" ^+ c- w) C" }3 F: Q2 C9 L
- module_param(acnt, int, S_IRUGO);
, ~ z# c; ^+ p7 \ - module_param(bcnt, int, S_IRUGO);
7 a! T: l7 q2 \9 b6 C1 F: w* h, b - module_param(ccnt, int, S_IRUGO);
复制代码 & _) h+ \3 L: ]$ K m) h- D# Q" B* T
5 \* k; ^5 g' q8 W4 V/ V7 q& \0 ?* N s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 A$ @5 b& Y% g2 G, G& garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. ?5 I" N3 L' [. Q7 |, ~) J, \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O! D+ G# I0 ?$ N; p& J! q ]6 T1 _ c
' f. K1 l% ~% b6 |0 R% z; S! s
|
|