|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" h# P4 x- _) i' |0 t" r/ B3 `- [code]EDMA sample test application
6 Q7 Q0 a7 x5 } - /*
: g" u+ o6 R; [/ f - * edma_test.c
- Q1 ?! w$ n4 k) @ - *4 e5 l! \. `4 R' C. h; E. F
- * brief EDMA3 Test Application" g/ N" G3 N6 X0 ~9 J0 c% P
- *+ r w L7 h+ \+ P' K* D3 j
- * This file contains EDMA3 Test code.
' Q5 T6 f2 K7 {3 M4 i6 r - */ u" R2 \( m C0 v q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ F. o, @, g' c; G5 d9 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ f4 |9 @& \, b8 D$ G. u
- * TO CHANGE.
2 ^& E1 Z) c9 y! C J - *
% G: I! i% o2 y& d( K6 F% M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, l0 U7 i" \9 N2 K1 p
- *: U$ n1 c- M% E; {
- * This program is free software; you can redistribute it and/or; l' t% c \7 s& m+ J) S
- * modify it under the terms of the GNU General Public License as# A! P* d( O0 D' z2 M u
- * published by the Free Software Foundation version 2.5 p( V% Q' K; |3 \! v! Y/ \& n
- *
' ]6 V$ _+ l/ i: y9 f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any z; w1 [7 v: b: ~8 E0 F
- * kind, whether express or implied; without even the implied warranty
. F- ?' Q* E5 O/ A! y5 J9 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( F# Z7 S9 K- y
- * GNU General Public License for more details.
, f( I; N) w- P - */9 M8 n% W9 u9 O7 B3 N6 @! s6 k
4 ~$ U4 r D: d% o; r7 T2 u5 u- #include <linux/module.h>
/ {/ D3 C* Z" j) Z2 s6 l' b% K6 J. L7 r - #include <linux/init.h>, f* P$ ]" J! [& L0 J4 ]
- #include <linux/errno.h>3 a$ o7 a8 N0 H2 B0 B( R( W
- #include <linux/types.h>
" `! L6 r; [- s8 F - #include <linux/interrupt.h>
& a+ u2 \% i* { - #include <asm/io.h>7 w4 [7 X: R& w4 W" J) Q1 x
- #include <linux/moduleparam.h>
* Q& F# u- s& i: q% | - #include <linux/sysctl.h> `' w( @% H: ?! h- `7 p
- #include <linux/mm.h>/ t' h& s1 ~3 G( U
- #include <linux/dma-mapping.h>
! ~4 J; b7 H1 p' l
0 `, e2 L7 t# j0 v- #include <mach/memory.h>
$ J. v& V. u, \& U0 b9 u% \ - #include <mach/hardware.h>
* o. m" y+ r" A" p4 J: Y# _ - #include <mach/irqs.h>
. _# V k! l5 z - #include <asm/hardware/edma.h>* h* [- F' k |6 R
- 2 M# o4 x$ o- k, E; f! y6 h
- #undef EDMA3_DEBUG
- K g# ?9 V& G+ O/ S; X - /*#define EDMA3_DEBUG*/8 ?2 t8 r- n5 v, k* D2 E
1 A3 l- s! p3 k3 V- #ifdef EDMA3_DEBUG/ s) Q" Y4 D! Y: A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 d4 ^7 f* L5 |4 ^# V# V3 j0 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), f7 I( Z8 T! v* a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! @3 n% p- z- u9 y$ j/ u/ |3 H, Z7 C" ] - #else
& t- v9 e" ` g9 ]% | - #define DMA_PRINTK( x... )# Q: `! `2 A3 c7 t
- #define DMA_FN_IN
5 T+ ^" d6 r6 h5 @4 G* ] - #define DMA_FN_OUT$ m4 }, i5 T! d1 o8 R# j
- #endif
% e- j# X% o9 R) K# g; O: j5 H - - o; b, d5 E6 Z3 U# b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& H5 V3 ]) B5 K) Q1 {
- #define STATIC_SHIFT 3
: w# m' M8 M& P5 o9 E3 V; R% |% D - #define TCINTEN_SHIFT 20
& i" X( F. M9 ~/ ^2 j$ Z - #define ITCINTEN_SHIFT 21
& `) h7 }' C. n* E& ^1 }3 r) m - #define TCCHEN_SHIFT 22 H; R7 Y" [* |1 S
- #define ITCCHEN_SHIFT 23
, Q$ y8 N% `$ ?& k4 M7 k
t- o1 N& `) B8 i, q& X( C- static volatile int irqraised1 = 0;( ~" q8 }( p8 g1 R: o
- static volatile int irqraised2 = 0;; X5 ~1 I- f' r+ \1 ^) F! _
9 O. Y6 {8 ]) o$ n9 s, ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 L4 ?* s$ A3 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 d' @& S8 K9 o, K- W+ P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( z, Q; O/ _3 G) f+ q9 w - 3 ?/ s; s! l D
- dma_addr_t dmaphyssrc1 = 0;5 [( X$ z$ @" a
- dma_addr_t dmaphyssrc2 = 0;
3 b$ @; R1 L; C+ Z7 ~, Y: J/ G - dma_addr_t dmaphysdest1 = 0;) n( [. ^: |2 M! ?$ X; n+ X' l
- dma_addr_t dmaphysdest2 = 0;
. R7 g Y* K' K2 Y0 }
+ x* o' M9 ~1 y- char *dmabufsrc1 = NULL;: F: [! g8 u" C' j( F/ r0 o
- char *dmabufsrc2 = NULL;
/ S2 f% L" a$ x5 C - char *dmabufdest1 = NULL;" g# B) U. T1 x. w2 F6 @8 B
- char *dmabufdest2 = NULL;
8 z2 ]3 g( A( |6 Z& j% H - / m! z' ]/ T1 _% F9 G+ g
- static int acnt = 512;
! @: I, ?* s# @6 y: S$ q0 s - static int bcnt = 8;
6 G/ H$ H- U1 G2 b8 S) @, v7 f - static int ccnt = 8;; D# o# c$ t+ n3 A, X1 \
9 F4 G7 r- o5 I9 O% Q/ A, \: v4 q- module_param(acnt, int, S_IRUGO);
7 D$ D+ r9 N. o, w2 e - module_param(bcnt, int, S_IRUGO);/ _7 o/ @" A# A% Z( N9 S- Q& j
- module_param(ccnt, int, S_IRUGO);
复制代码 2 e1 ]8 E! S' Y, _7 [. u
5 p0 W% h) V" r- B$ ]8 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 w& A8 V0 A4 K5 q! J2 u: n' barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Z6 U0 _- e' O, N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, Q1 R) H0 p! X7 H
7 v% k$ d4 o: x
1 N, k' |. z5 W" w" M1 D! m- f
|
|