|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& u' j$ A8 O7 u) `. C C- [code]EDMA sample test application" f3 ~ z8 F$ O7 b! w3 [2 C' H
- /* O' N* n8 i/ @7 C% @7 ]
- * edma_test.c7 N" N. P+ _1 Y9 H5 z0 u# K. }) h
- *
* G) ~. R* G7 t* B0 f - * brief EDMA3 Test Application
% K( [2 v6 I9 U - *
# g8 y6 u4 ]! |7 B - * This file contains EDMA3 Test code.! w! T( B3 S: h9 `1 V$ @& S
- *
$ L3 ]9 r! A7 ?3 _6 d, t8 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, U5 N4 D' q9 v. i8 m4 ^% o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& N# |# z* V5 {: G) G# ^- |7 a - * TO CHANGE.
/ j z( V4 m; V: d* ~5 e - *0 e& v" Q2 ?3 Q1 j" T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! e8 b; ?0 z0 W7 ?. _
- *
+ A4 l4 `3 \ F" B. B - * This program is free software; you can redistribute it and/or
* z: B# l0 T4 w" s d6 z - * modify it under the terms of the GNU General Public License as% g; g( K+ A6 y; ~
- * published by the Free Software Foundation version 2.) K* q v9 Z! {. ]. F; r; @
- *
4 A+ f3 `8 u, t1 O1 ^8 |! j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( `" Z% W8 o8 a$ ~0 e
- * kind, whether express or implied; without even the implied warranty2 x* ]. J/ B8 W& e E8 W9 k+ x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" v1 W K* w) N; T5 G' p - * GNU General Public License for more details.
# z; m' v1 h/ ^2 P8 g% u - */
+ H6 v3 H7 F R
1 K& u) d; z4 Z+ l. [2 h- #include <linux/module.h>
`# J& m4 c& Z; F1 V+ y - #include <linux/init.h>
1 q2 I" P. Q' ] K. T7 g( w - #include <linux/errno.h>
1 [0 D* @/ Z6 s3 Y4 e6 | - #include <linux/types.h>6 p. r ~9 O, F! v7 H) ]; b
- #include <linux/interrupt.h># `" |' W) d* V* H0 f* m" i5 J
- #include <asm/io.h>
. @1 S8 a5 f! u; n0 Y, P/ } - #include <linux/moduleparam.h>
% C/ ^3 s5 E/ X9 i1 p! h7 X - #include <linux/sysctl.h>
5 M* q: _. X4 U" P! D - #include <linux/mm.h>1 ^ W: K1 y6 {5 A
- #include <linux/dma-mapping.h>
0 q1 Z6 g) Q! c - ! P, B% o7 y+ L. P k. t% S# V' _% q
- #include <mach/memory.h>* u5 g) l3 N% x6 b% w1 z
- #include <mach/hardware.h>) ?/ [# x4 M& w2 ^1 d
- #include <mach/irqs.h>
1 D; |# v( i" l+ e - #include <asm/hardware/edma.h>
* Y. X5 T2 ?; U. k e( S
" q3 R4 j+ s3 u* D. A' N# L$ ]# x6 B- #undef EDMA3_DEBUG
5 S1 n+ [1 G* J! d - /*#define EDMA3_DEBUG*/
& a& J% {9 O5 i) C0 H8 {, ` - * e1 N3 N8 m# u ]! X: i
- #ifdef EDMA3_DEBUG
1 ~; p' ?! ~: N6 _ d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 y, q% l7 |2 O! U9 o' p. ~& y; Z, M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' A, }# A8 N2 c' ?. |1 T, g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( U) b1 m6 Z7 p( U- ] - #else( w7 p1 e5 z$ G; ^
- #define DMA_PRINTK( x... )
x& O/ C f+ [/ m, f3 b: P - #define DMA_FN_IN
2 ^% I4 w# ~( m l" R, M8 K# i - #define DMA_FN_OUT
3 I8 k& `# D& S; U1 `7 W: @5 Y) d - #endif! M- a3 k4 z' z+ T$ P
; {7 v+ g0 n% ?. _1 G1 S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 ?3 X+ n2 F) ~; W - #define STATIC_SHIFT 3
1 R) Y( |$ y8 Q! l) `) O - #define TCINTEN_SHIFT 201 f& u/ e; K8 U) L# b D7 t& }
- #define ITCINTEN_SHIFT 21
3 D" U. P$ A0 H) g' n2 ?% i4 U; O - #define TCCHEN_SHIFT 22- @9 n) d. I1 }) o$ N% @
- #define ITCCHEN_SHIFT 23
$ x$ r3 l: a! V$ G/ H& S% K& W* d - 6 l4 A9 V" l' w. \% ]
- static volatile int irqraised1 = 0;: |% B+ b' G9 f4 u$ m/ C! x
- static volatile int irqraised2 = 0;
& h8 |" U2 ~4 {; {% ]% q( ?5 z/ H. m
1 S1 g: }6 j$ s; }; o* @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) s+ Y3 K+ e& J3 b" q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 O9 ?* }, }: L: P! w. @- n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. S3 c+ M2 g; E) M R4 }
- ! k! B+ }. w' W
- dma_addr_t dmaphyssrc1 = 0;" }3 P: ]% t$ K) X2 ~. D
- dma_addr_t dmaphyssrc2 = 0;$ N0 X/ `) D6 S& k7 ~
- dma_addr_t dmaphysdest1 = 0;
$ q- V$ H; x5 D- v5 m) }, Q9 } - dma_addr_t dmaphysdest2 = 0;+ q4 ?) ~1 |+ i& i
+ P& Y# W3 l$ T' h1 `- char *dmabufsrc1 = NULL;
6 w' M# u8 K& ?4 C; i+ F O$ T& j - char *dmabufsrc2 = NULL;
* o( e( v# ~4 x, m @7 r" I - char *dmabufdest1 = NULL;
$ w; Q, f. D9 T, u+ I - char *dmabufdest2 = NULL;
1 Y4 |8 C8 N/ L5 X1 r5 C) w1 r - . ~& R3 t/ j; @
- static int acnt = 512;% O, M3 W4 i9 O8 j* u6 l
- static int bcnt = 8;0 r* |! D# x4 i7 N! c( y# {
- static int ccnt = 8;& i, |! B1 c- I
- % }0 J& q, j' j9 b& S. ^1 L8 y. W
- module_param(acnt, int, S_IRUGO);( B9 X/ l- a: Y% z
- module_param(bcnt, int, S_IRUGO);8 O8 w7 P) T3 }( \! z6 W2 H
- module_param(ccnt, int, S_IRUGO);
复制代码
1 q3 t4 R9 G8 |3 [5 I. w3 t9 R7 P! p2 {9 z. @* @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. `, ^2 [5 }$ z& C, U+ j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ^" n% T9 l6 j* ]% @1 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- w5 [$ Z9 E6 P8 I& z; s2 q/ ^2 j, t; Z( K) a* y) @
& K" X5 R9 m2 r7 z0 b |
|