|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & O. g; R/ d# Z; |9 v3 `0 D
- [code]EDMA sample test application. v7 T5 N q) [& @% [7 {
- /*
k" \/ _0 k# J) N. V% J( D) u - * edma_test.c+ s) _+ C+ i9 M% Q- |0 x& V
- *9 U/ d) B" O5 n8 t
- * brief EDMA3 Test Application
/ C( v y6 ~( @ - *
r/ U% F" c4 J1 W7 I - * This file contains EDMA3 Test code.) w' W' B7 a9 y+ ~0 E
- *
+ r5 E6 r( s; N1 h7 ?, O) D: B+ O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ D5 f. C' [/ y$ I b8 O7 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. `2 W% f* s8 q- @! C2 K2 F. E" l
- * TO CHANGE.
9 L% w! W8 ^: N! B - *
) W( g6 z6 F9 D4 m7 u/ f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; V" {0 w* L; ^4 q1 u) @ - *+ j$ a- j/ a6 h
- * This program is free software; you can redistribute it and/or& Q, B$ d& [: x: {( U8 w8 }
- * modify it under the terms of the GNU General Public License as
( J1 J% ?; }3 x - * published by the Free Software Foundation version 2.! j4 M6 _! `$ {% A! s
- *
& @5 Q4 S/ Q4 V# a" G2 V# _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, H; H) w/ a, `& c4 H) j y8 z7 e
- * kind, whether express or implied; without even the implied warranty) F4 l- g, E' A! f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- v+ T- z# ~1 M1 Z/ K1 X
- * GNU General Public License for more details.; Y, N% A# ?9 V7 c! ]4 Y
- */
, b, {5 W6 V- z) a
+ ^" o+ ]- j# k0 M; J8 ~' w3 P- #include <linux/module.h>6 p# u3 P: _' A5 |$ T
- #include <linux/init.h>
# l+ R4 a8 e Z! o; @2 [( g - #include <linux/errno.h># W4 Q& m# R( U: D8 M# J
- #include <linux/types.h>
- {8 b* \! x$ c9 }7 q" `$ ] - #include <linux/interrupt.h>
- [9 N% @5 V) b% Z* S - #include <asm/io.h>
4 H1 V7 W7 F$ R' s6 S - #include <linux/moduleparam.h>
" q; r6 d$ c0 |: c |4 ~ - #include <linux/sysctl.h>* c3 V/ A. y. H1 `/ G$ |
- #include <linux/mm.h>
& l( _/ H# k# w) ?8 n/ H7 a& {0 Z - #include <linux/dma-mapping.h>
* [' H, Z% a* G: _, C: R0 ~1 U1 Y - 5 B: y/ z- p; C
- #include <mach/memory.h>" ]0 k; w6 f, j" w. |2 r8 e
- #include <mach/hardware.h>
3 X+ [9 a, f+ z! _8 E - #include <mach/irqs.h>
5 \7 h1 }4 G$ P- I - #include <asm/hardware/edma.h>
5 i: Q/ _+ N) O- d0 z9 B7 ?2 `
+ A A5 L6 q; i$ n# R% g- #undef EDMA3_DEBUG7 J, e& G4 ~ S
- /*#define EDMA3_DEBUG*/ Y6 }: [$ r" v: a: H
1 b& d# e( Q+ b- #ifdef EDMA3_DEBUG* F2 u- M' O1 u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 `* n' d& V5 i! J% J" G0 F! `
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Y/ j1 P9 M6 P8 S- r! n3 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( Z( i! Y+ d! C3 ^1 u5 R) k& i* P
- #else
$ v0 s" T- M8 D& u" ^9 R - #define DMA_PRINTK( x... )
/ I2 u& {* k$ _ - #define DMA_FN_IN6 ]; A/ R7 M9 @7 @) Q- c
- #define DMA_FN_OUT
8 S1 d: U* M0 [6 h) b4 |3 X - #endif
( e/ H" b. H. b4 d* a/ { - E/ L# @, G+ K9 O; l# Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( t) \( g* R0 d8 L
- #define STATIC_SHIFT 3
) j# ?# ~$ c- W7 g" _4 e% ]9 a7 c - #define TCINTEN_SHIFT 20. f- i$ k. c+ Z8 a
- #define ITCINTEN_SHIFT 21
% @0 [2 Y; X6 ]' G8 N3 a - #define TCCHEN_SHIFT 22. p- M! M0 z7 L% R9 k' X) A" A0 B
- #define ITCCHEN_SHIFT 238 Z) c, D5 L& p! s6 X, A2 M2 [
# T* q0 H5 X" e. b/ w6 L- static volatile int irqraised1 = 0;# H" \- ^" ^; _. m
- static volatile int irqraised2 = 0;+ n1 U7 F0 a8 R8 f& `- @1 a
) i2 p2 d3 }+ \* Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y5 A6 a6 v* W/ t) ]* K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^% E7 ?* x# e! V6 b9 o; h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 i; a- H* c( e& J1 Q8 f+ x7 v - 8 X+ U2 ~# R7 G. j7 `& @" E% T. x
- dma_addr_t dmaphyssrc1 = 0;
$ ]2 X) H7 k; e$ {' E - dma_addr_t dmaphyssrc2 = 0;
9 }+ b8 u0 ^2 o8 Y" n - dma_addr_t dmaphysdest1 = 0;
% Q6 D4 G& L9 w" g - dma_addr_t dmaphysdest2 = 0;
" j) J: g- v j% _$ J1 f1 Z
5 ?7 t% k" t# E7 P6 L2 p* l" C- char *dmabufsrc1 = NULL;7 n# j& q4 ]6 }
- char *dmabufsrc2 = NULL;$ s% Q+ M# V$ p# Z P1 X0 f
- char *dmabufdest1 = NULL;+ z _& l0 Q& P; \4 ]
- char *dmabufdest2 = NULL;/ G% o+ q0 Q% T% C/ ~, j, v' V
) K& a: {( p$ x6 A) w5 i# X- static int acnt = 512;
& Q6 C: E* p7 ]1 m2 c/ K' X - static int bcnt = 8;
o1 A' Q; L9 z1 l" `7 j - static int ccnt = 8;) T0 R- Z6 |. E& l
- 6 Y" w9 h T7 X; B$ ]
- module_param(acnt, int, S_IRUGO);
+ Z" z4 s0 n6 ?/ m - module_param(bcnt, int, S_IRUGO);
0 k7 P8 e5 O. X0 _6 _3 A: x - module_param(ccnt, int, S_IRUGO);
复制代码 1 V( V7 f# J$ ^6 O1 W
4 o/ D0 t! u6 c/ m9 f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- |8 Y6 {, {$ e4 |3 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 t( h. C5 p |9 z% e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 i7 o* m8 v7 H
: F) z+ N# J# m
1 k. S$ T1 ?/ [$ R& a |
|