|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 e/ K0 I6 H3 f8 j3 [4 m$ Q
- [code]EDMA sample test application0 N5 p$ V5 M2 y# s, z
- /*
4 `' ?) N H8 j* J/ { - * edma_test.c, @: A4 l! p( B) ]% g# Z2 g4 b
- *
: P7 t/ x2 _% r. s) j - * brief EDMA3 Test Application* i5 e' z- y. X: m" ~' o$ s3 O
- *$ h0 M% ]# r# k, z( ~% A
- * This file contains EDMA3 Test code.
& O2 {4 O" I$ K - *1 y0 ?4 Q9 _+ f m$ d( @0 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ c0 f- s: S# ^4 Q# a3 g8 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* d6 W5 L9 r1 i E: l! ^6 x - * TO CHANGE./ n7 e) Z5 n2 H
- *4 S" |. W0 K D5 y% n+ X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 T: _* f8 R" X - *
) N. }0 c3 N" V0 `7 V. E @8 Y - * This program is free software; you can redistribute it and/or
9 b+ E }- b. s, I- p+ d - * modify it under the terms of the GNU General Public License as
% H8 N2 B- T4 c5 v8 V" C h+ {1 E - * published by the Free Software Foundation version 2.: i& ^5 X1 X: ~' W2 Q
- *! s1 B3 [3 R* C3 P9 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& v; @2 i) Q7 L% ?4 y" E; d, }' j- U
- * kind, whether express or implied; without even the implied warranty7 M) B& ^# W( s9 n# }5 G% k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: K \( ^8 |$ L, P- i: B
- * GNU General Public License for more details.8 O& w6 \: u5 ^% w2 ?0 w# y( M
- */" |- v ~# R$ o$ X3 a
- 9 H1 B( u+ ~( H3 W
- #include <linux/module.h>
) ^% n8 l: c8 |! Z4 j$ o: o - #include <linux/init.h>/ v E$ `7 d- R2 K( i
- #include <linux/errno.h>% l* k( l4 g5 r1 D; y; ^
- #include <linux/types.h>
h- F8 l5 D5 X9 P) y; k( ` - #include <linux/interrupt.h>
# T; n' k4 }) d! D3 u& x - #include <asm/io.h>
3 J; |" v1 d( t. R2 F# @: X% K - #include <linux/moduleparam.h>
2 Q% }5 H5 q, J' Q+ j1 M; ~) h - #include <linux/sysctl.h>* j; J% q1 c2 c9 W
- #include <linux/mm.h>& x4 Y4 j) Z7 u
- #include <linux/dma-mapping.h>
/ V( o- T8 s9 a/ T - 1 |" c! `" k. S- B/ k; l
- #include <mach/memory.h>
h: P8 Y% \3 M% a4 I) e# r+ K/ _ - #include <mach/hardware.h>
6 D( [- \7 h! B- L/ ~( ^ - #include <mach/irqs.h>
+ g1 n$ F. t) o; j* Z - #include <asm/hardware/edma.h>
3 @, @% g7 [; p# Y& j2 ]6 q
: ~# W& v1 o+ F4 C, P( u& A3 s# g- #undef EDMA3_DEBUG
) l1 J; j/ F6 d9 y; m1 ~ - /*#define EDMA3_DEBUG*/
% \ ^0 W. |0 _' a - * X' x; h- D1 ]( T1 Q
- #ifdef EDMA3_DEBUG
0 ^7 ]8 s5 y3 i7 [1 K: }4 W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- s) D1 [7 j* [4 l* W( v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ `/ N# T. W) [4 q/ A8 c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) ^/ G1 E2 I* V- a$ y5 I - #else
* y, q; d, X6 N2 u - #define DMA_PRINTK( x... )
1 G* w6 p( S9 x2 C/ t8 C - #define DMA_FN_IN1 h1 }2 r9 v; t/ d; a
- #define DMA_FN_OUT$ w- y; _3 y* v- \+ s6 a6 s! B4 J) E
- #endif
2 ^$ W4 `. O5 U$ y* J
8 r3 v( z+ c0 `" p7 x; A. T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 z1 f y: B0 x$ Z* s% F: _+ ?
- #define STATIC_SHIFT 3
& D/ y( n. m, X - #define TCINTEN_SHIFT 20
* F. X1 u" g. d- ]7 q - #define ITCINTEN_SHIFT 21/ N1 n6 e) o& f; O
- #define TCCHEN_SHIFT 22
" f, w/ B4 V+ U- ^* x - #define ITCCHEN_SHIFT 232 P( z0 U7 Y2 g& p, p' E1 {
- 9 f0 w: X" I4 E. N9 C
- static volatile int irqraised1 = 0;
6 z- [2 g5 S) \ - static volatile int irqraised2 = 0;
+ M" ] V; `7 \" ?* a) u x
0 v% J) {$ H; G+ S# R0 m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ Y; L! ~, M5 N2 {* O" [0 x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* H% ?, m/ c: t, b0 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 }% q$ \$ m' G# U% M' T
- 3 d) U! C! G3 R, Q3 J
- dma_addr_t dmaphyssrc1 = 0;
( V: k* l5 W; b0 v - dma_addr_t dmaphyssrc2 = 0;
6 A$ r6 J( O" q- E, ?( w - dma_addr_t dmaphysdest1 = 0;; o+ f5 K* F' H. \# a4 b( ~
- dma_addr_t dmaphysdest2 = 0;4 M7 ]3 {9 }' \$ m: J
- 2 C; T# y2 m- j: R# h6 @5 v
- char *dmabufsrc1 = NULL;, H' ]' J# S7 X+ S
- char *dmabufsrc2 = NULL;
; B" [1 X$ e) ?2 j' S7 J1 w$ T - char *dmabufdest1 = NULL;
' `( w4 T( X! l% r( W4 `/ S. m - char *dmabufdest2 = NULL;& g: f) e0 N4 x* }4 h. [/ x
- 8 D2 h; T. i) ?( q k* i
- static int acnt = 512;
* j3 c2 o4 c; ]4 ~$ s. R, { - static int bcnt = 8;3 \, H& y7 M) u: ]+ t
- static int ccnt = 8;8 O( n6 ^& D2 t, ~* S
9 P& `- S# Q/ ^) w! ^- module_param(acnt, int, S_IRUGO);# O% C% Z+ f. {9 C& C# c7 e: D9 t
- module_param(bcnt, int, S_IRUGO);
r, U2 `$ H" Q" q$ `2 e - module_param(ccnt, int, S_IRUGO);
复制代码
2 o& V* \! F- [+ W0 N1 S; o! N! a, e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* A2 l+ Z2 _0 W/ p3 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 u- ]9 l9 F3 y5 D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 A6 [8 T6 J( k% G
, {) I8 i6 H4 `% v9 \: B& O# X3 b( j" Q7 ^
|
|