|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # d: o9 Q' T/ R7 s9 o
- [code]EDMA sample test application
# Z+ ?0 Q" e T9 S7 V) n - /*0 p! o" J5 m5 y0 a# X
- * edma_test.c
& j5 P; n9 _; n, P: E - *3 x6 _' g! u& Q
- * brief EDMA3 Test Application
; I1 }- }6 v, O+ V - *. a, }* z' R9 C5 q8 W9 X3 u# [
- * This file contains EDMA3 Test code./ R# n+ _: W6 X, V) r
- *
% Y. Q9 h1 k- n: _$ O. N8 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* V! d' ?0 Y) l% d" V8 ?: N' F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( j7 X: X/ s2 R1 g4 w
- * TO CHANGE.# \ y* M7 c* H! Z- _8 r# D
- *
: G$ D' R! V+ |+ F9 C, }4 X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# B% B+ N3 M9 i d - *0 E9 A: V! |; Q" [5 Y1 X- [4 B3 s
- * This program is free software; you can redistribute it and/or5 Y3 @$ i& I' _; k, t
- * modify it under the terms of the GNU General Public License as
) K8 m5 X5 g4 ]7 G* c - * published by the Free Software Foundation version 2.
3 Z* o$ @; ~' A/ l - *
1 d' V& x8 n( Z7 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 A( y) g6 G$ P - * kind, whether express or implied; without even the implied warranty
5 k6 _: @/ \. ]/ {+ Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 C$ M2 z$ M( C# K( f - * GNU General Public License for more details.
, j* ]( N% E( ^8 f, z/ P - */+ o5 E* k7 {* p( k _/ J. d
- 6 c* ~* x8 t1 r3 G
- #include <linux/module.h>5 R, g6 o6 V- ?6 Z7 P$ G/ x
- #include <linux/init.h>
f8 G8 h9 t% l- n0 P - #include <linux/errno.h>7 i: W8 k6 R* o6 L0 f; Z0 ~* D
- #include <linux/types.h>
- i5 Y& L W' L, e+ @ - #include <linux/interrupt.h>9 x, K* L7 C" [& t ?8 L- M! X
- #include <asm/io.h>
# v/ o- z( v$ z# r - #include <linux/moduleparam.h>* v8 z2 d1 Y" d& Q
- #include <linux/sysctl.h># L& l& Q. K; U, _& P! p
- #include <linux/mm.h>- L: m) u% g5 L; x: L8 t( }
- #include <linux/dma-mapping.h>
" I1 c* R" E8 q' r' ]
# J9 s! q: K2 a' ~- #include <mach/memory.h>
, e1 H' g: h% V- F' R5 a - #include <mach/hardware.h>1 N+ T0 ^* h; w* U+ g5 D
- #include <mach/irqs.h>9 x% z ]" W' j9 J; |7 S! w1 Y
- #include <asm/hardware/edma.h>
7 w* M! I+ N% R" n7 Q7 c% ~* S - ) A( [9 b% E1 l+ s9 G
- #undef EDMA3_DEBUG
- f4 F$ V* A4 ]' j# i# V - /*#define EDMA3_DEBUG*/
; N& q, K8 Y P) H8 l
/ F7 N" f( r- m- #ifdef EDMA3_DEBUG
; \' C8 V3 |$ q+ I6 ]$ t# i1 ^# | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- J) n; k% g1 @5 F+ p1 ~& S) D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ T0 c" r5 V K4 b; Q$ B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& J7 W- M! |. D/ p: h7 j - #else# b' B4 w3 q1 J9 I- C
- #define DMA_PRINTK( x... )
( z2 O1 y1 b3 n c - #define DMA_FN_IN) v- V( m2 j# z2 k5 Q% \7 R8 I* z" i
- #define DMA_FN_OUT
: V0 b0 s* r9 w. K - #endif
8 r, M- W+ F3 n9 p - 2 i+ E r# t7 c% q7 s, K) z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* L: i6 p/ ~" V I% ]: \5 `+ z/ E
- #define STATIC_SHIFT 3
7 q; j1 y7 L) ]' w2 Q - #define TCINTEN_SHIFT 20. u) E' ~; }" J
- #define ITCINTEN_SHIFT 215 Q! Z& F: s/ W* V% l; ~+ o
- #define TCCHEN_SHIFT 225 s4 [( [" h/ m2 f" w4 s
- #define ITCCHEN_SHIFT 23 O# |: t! F& N# U
, e5 C, ^- e* g7 d- static volatile int irqraised1 = 0;1 J1 l7 s; |4 C' b' Q
- static volatile int irqraised2 = 0;
: Y3 d; M& \% h/ e
3 F# T8 x) `' w/ p6 q8 `* q+ ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) k* T0 P- C" T4 v) Z2 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 B9 L- r1 m- T; I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ D2 F4 L' _! z1 Q9 E& o
" M+ k {5 k" T6 e- dma_addr_t dmaphyssrc1 = 0;
& }/ ]3 N7 ^3 ^* a$ t6 j6 \ - dma_addr_t dmaphyssrc2 = 0;
. u _+ I: J+ [ - dma_addr_t dmaphysdest1 = 0;
3 [- s5 {4 Z% |- @& O3 G. ?5 H5 Y - dma_addr_t dmaphysdest2 = 0;
+ z! j; H" E9 O7 [, X4 T0 u4 Z8 j
2 [8 D; m" L0 J# V- char *dmabufsrc1 = NULL;! g Z2 Z. g0 P7 a" p
- char *dmabufsrc2 = NULL;, J4 x: c9 D% R' R+ s3 p% f
- char *dmabufdest1 = NULL;
$ X* r! T9 |$ y5 N+ |3 ~$ c - char *dmabufdest2 = NULL;
w: D, Y. |: Z7 D- \/ e7 g - 5 w8 }0 N& t5 y ]. t2 j3 h
- static int acnt = 512;
% ~ e. J" u. a/ n+ b% ^ - static int bcnt = 8;
; t* L7 ]6 z0 x( U( P) r" i - static int ccnt = 8;3 B8 B! l) y# V7 U& ]5 x! r
- 4 u. M t, }6 E1 P, f* F( S6 m9 ^- Z
- module_param(acnt, int, S_IRUGO);
' q. B# o9 {+ P# E1 H - module_param(bcnt, int, S_IRUGO);8 k |; Z8 B# q& u0 |* p
- module_param(ccnt, int, S_IRUGO);
复制代码 ; q; R0 R/ c8 Z2 k( |8 Q; c# ]% d5 O8 m
1 t+ w/ a( n; w- [ \. y; v4 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 [* P1 q. `9 q
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 @" m0 j" Y3 \0 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 z- x5 W m3 p0 { g
3 p1 A2 @6 {6 b, Z8 N' k
; [4 i( o" s) \) G7 k/ ] |
|