|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; n- w0 }- T+ u! o! f5 X: w. [- [code]EDMA sample test application
7 L* x y- _" x6 t) l' f8 Y) a - /*7 b# t7 ?5 h* N( S; n
- * edma_test.c0 b7 D( V% z: k# l' L( C& r n
- *' O6 I, ~% e# H: A8 t* ^; k
- * brief EDMA3 Test Application
# \# Q4 ]1 W! }' l: ~ - *" ]- [8 y U5 ^" I9 N
- * This file contains EDMA3 Test code.0 O3 o& \+ V" \2 S7 E
- *! k, N6 a# }$ D2 C( y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" l, B$ L5 F% V D* ?. f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* z1 k7 U3 r3 X: V
- * TO CHANGE.% X6 d" \- s3 S ]& d
- *0 a% q! X2 x6 K7 N3 [% ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 [/ q8 |+ A9 H) R+ Y" _ - *
& W" X7 K& B0 I4 c - * This program is free software; you can redistribute it and/or/ E g. I* `3 \; L5 E0 L& Z
- * modify it under the terms of the GNU General Public License as- T( y0 x$ z3 Q; b. d
- * published by the Free Software Foundation version 2.
; \* {8 U% P+ ] - *7 e4 u8 b* v7 u$ m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ K. R6 q1 `% e; a7 W - * kind, whether express or implied; without even the implied warranty
- g6 j4 R4 |# z( s# ]6 x+ T! x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% s$ U& N( B( D# O! f, Y - * GNU General Public License for more details.& m! c& ^# w9 V" k2 g
- */
* A9 t8 f5 G. `) i) P+ e, } - 0 c' T/ C9 F) O& G2 A8 s- K
- #include <linux/module.h>
) f; j0 W8 v1 B; A$ K: o - #include <linux/init.h>
2 q7 }7 P% Z* o, z/ Q - #include <linux/errno.h>/ p) d& {0 c g# I1 h- @2 ^& u
- #include <linux/types.h>+ O: ]" `/ s" X6 v* d9 g* K& [
- #include <linux/interrupt.h> M( r9 T8 f* r6 _+ e. H. t
- #include <asm/io.h>3 _ y( b+ B2 U
- #include <linux/moduleparam.h>. U6 [* l1 L; s1 H3 H* w }
- #include <linux/sysctl.h>
9 i9 _% {+ y# L( B! ` - #include <linux/mm.h>
4 W8 }0 c: `1 S0 E3 D7 H - #include <linux/dma-mapping.h>* [, d* V; S, t! [" n7 g) O
5 Q9 i# q0 n( v( ^6 e, Z- #include <mach/memory.h>5 j; q. F0 s; b8 a6 s* r
- #include <mach/hardware.h>3 g4 _- c4 R" ^ T1 u
- #include <mach/irqs.h>; L3 R+ c7 d7 R" h m3 w
- #include <asm/hardware/edma.h>
; X3 G# ?3 ]: w/ k/ J
$ A3 g. G* ~/ |- n3 N- #undef EDMA3_DEBUG
$ f. |. _) O* d' Y/ @ - /*#define EDMA3_DEBUG*/
) r& W5 l! t$ k( |, d: N
: ]; j$ j) q, N- #ifdef EDMA3_DEBUG/ q3 n* B2 x, K, c5 l8 S- `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 T* N7 w0 Q- a+ C, b s, l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; w3 ?7 ~) W/ {9 X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; n0 E0 Y; K7 a$ m - #else
+ Q$ }5 `% f+ |+ D/ M% P& j) k - #define DMA_PRINTK( x... )
2 A; k* h& r2 m2 [$ K! ^ - #define DMA_FN_IN" r5 K- a( Y' e; N7 Q) s
- #define DMA_FN_OUT. |& v/ g8 _/ Z ]: q) |1 q6 X9 }, O' ?
- #endif
7 n# ?# `% E( S$ ]% d - 1 q. ?& j. }# j- z+ N) d0 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! d8 z7 b1 S; B3 U - #define STATIC_SHIFT 3
3 k" T5 o( `+ T0 V/ V - #define TCINTEN_SHIFT 20! I' t* A) t1 d+ s( @7 ?4 [9 h
- #define ITCINTEN_SHIFT 21
) d8 ^# C: c H; W+ ` - #define TCCHEN_SHIFT 225 [( V" V% _$ w0 b7 o9 y
- #define ITCCHEN_SHIFT 23% z6 g* u1 c# x# o7 K$ q7 [
- ( I% U9 |( Q1 L& n# T7 ~5 ^
- static volatile int irqraised1 = 0;
- P6 Q8 K1 f9 | - static volatile int irqraised2 = 0;
% V: `" _8 c. u ]$ |
! L3 e# b+ W6 A8 O8 L8 ^+ h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ^* I8 W p8 Z5 I. }5 U9 ]6 Z7 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 `, Z6 ~- w0 C( B2 q- [% ?0 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. e T5 b1 ?/ K$ {6 M. J1 ?' V - / E" r& t1 w5 j( P+ ?( q1 u
- dma_addr_t dmaphyssrc1 = 0;
/ J2 {+ Z' [ j - dma_addr_t dmaphyssrc2 = 0;' H( Z j9 Y& [/ [* ?6 ^3 E3 U
- dma_addr_t dmaphysdest1 = 0;
) N6 f9 F2 i, ^% n% [ - dma_addr_t dmaphysdest2 = 0;
( @; o( u+ N" a$ I+ h - 2 {; Q" i7 J. r% _) J
- char *dmabufsrc1 = NULL;7 \5 D1 G3 Y5 z
- char *dmabufsrc2 = NULL; f2 s$ e9 {6 R
- char *dmabufdest1 = NULL;
1 m" n) ~2 f3 \) H/ u8 L - char *dmabufdest2 = NULL;
% Q+ g; u! D1 o- @6 t' p - + ^. B& B' b# G8 o! u: U- O
- static int acnt = 512;
6 t7 ?7 Z% J! K* y5 q - static int bcnt = 8;' ]; }' t) D! q- T. G
- static int ccnt = 8;# {8 i7 W0 y$ P' {0 h& t
- ! R% `* d* ~0 o% A
- module_param(acnt, int, S_IRUGO);
9 _) u" ?" }$ u, m, | - module_param(bcnt, int, S_IRUGO);" n; h& R* d; C e+ X( z
- module_param(ccnt, int, S_IRUGO);
复制代码
, |% _* R% n8 p7 S
9 M7 h5 S! o; p! N) f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 e' f) y- ]( z( tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 ~5 m: u% }5 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; N: \' i4 \$ C' a1 s* P9 W
6 s; A' |1 ^; e0 S
; |2 z! o o" Q/ G& g
|
|