|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 v7 \; v+ {9 W* ?0 X- [code]EDMA sample test application
' F0 ]) o5 J! @5 S) a' p; O1 Y% X - /*
: R% x6 _- a8 b$ {$ K - * edma_test.c/ ]& M* m! q- Q Q
- ** _: j2 G9 ^. M: l& s
- * brief EDMA3 Test Application$ T* f. ]: A9 I# y7 M) F0 `5 @
- *
, R B9 {( W9 N" x1 O - * This file contains EDMA3 Test code.( r5 N5 x. U* v, A w3 b
- *
8 [* V5 o# h# B& @ k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ E: Q( g G; N% J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- d: N& u3 O ^ o# s% R - * TO CHANGE.. F+ h: t* I6 ^# i6 @: H! \( n
- *
. q# u$ z. f/ h% J( g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! T! ]: W# [) D$ a4 M+ q. i! t$ N$ d1 X$ M - *
+ ^2 l4 Y9 S2 h! X2 D - * This program is free software; you can redistribute it and/or( g) ]2 `- g( C6 {& E% a
- * modify it under the terms of the GNU General Public License as% D# r1 L, Z( A, W- Q$ {
- * published by the Free Software Foundation version 2.
8 x+ r) G/ K4 W+ a8 Z4 Y( H - *3 ] V+ v$ d, I! ]! v# l. [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 s3 l! \; a- f6 l$ _ - * kind, whether express or implied; without even the implied warranty
; X3 ]* J1 X) T$ x1 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 j- {! J* P' i2 B5 C
- * GNU General Public License for more details.
: h+ P3 D" @5 g& \& K4 M0 |' d - */, D5 H! O& G3 E- m# c8 Q
5 _0 r6 p: }2 W. h& z9 |- #include <linux/module.h>: E( _; w' j4 R4 i( P4 F8 @
- #include <linux/init.h>
+ o9 G l7 L# S. K0 C - #include <linux/errno.h>
, ^1 Q% J% Z- Z4 M% X( Y$ {4 z; T- a8 x - #include <linux/types.h>
8 N* E# S( a: [8 d1 ^2 r! N - #include <linux/interrupt.h>1 o$ h& S' H2 q6 D
- #include <asm/io.h>' O3 O0 ~) K& ]% ]
- #include <linux/moduleparam.h>& d- d! g& b9 v$ l, u5 W0 D, L
- #include <linux/sysctl.h>
3 h+ q M* U9 e# F. _% \ - #include <linux/mm.h>
, K$ m9 f: x. I0 ]8 r; \. d - #include <linux/dma-mapping.h>1 N6 p- y2 _' i+ ~7 d
- - b& B8 A2 D9 M
- #include <mach/memory.h>
- o/ ~/ W+ k9 q - #include <mach/hardware.h>
( m7 H2 |0 B: s1 G4 ^$ K - #include <mach/irqs.h>
4 l' G) q9 }6 a" ]0 C - #include <asm/hardware/edma.h>" y6 {, P6 D; I& ^
4 s1 }9 Y. {0 W$ A* a- #undef EDMA3_DEBUG
$ k3 Q0 G2 _: s1 \. ] s2 O$ U - /*#define EDMA3_DEBUG*/
; ^) y$ C" S7 \. s' ^" L/ L) ?" A& ?
: Q% b: G$ [* d5 w2 f- #ifdef EDMA3_DEBUG
4 t) K! _' s7 N/ C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 n/ \7 _" h/ n5 a a7 j$ ^( j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ t4 k1 A6 Z7 O: z8 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 |9 B/ O% r+ ~$ D" q, F - #else2 r( N& P3 v) _' _
- #define DMA_PRINTK( x... )* L8 c( s8 x n3 D" s% W0 b) {
- #define DMA_FN_IN0 f3 f" X, p; v0 t3 f
- #define DMA_FN_OUT( o, g9 M8 j5 r. [2 [2 g
- #endif
& ]; L, j: ]( U3 f3 a6 g0 M9 o - & q) ^: P! B) o* Y% B& s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# Z* H" P. `/ F' o8 v$ M - #define STATIC_SHIFT 3
. e r3 w7 J: ^ V# H# y3 q - #define TCINTEN_SHIFT 200 q5 G1 k5 {0 B9 e
- #define ITCINTEN_SHIFT 21* U" Z$ v: w K w9 M
- #define TCCHEN_SHIFT 22
+ q( k9 d' Y* w, Q5 d2 a - #define ITCCHEN_SHIFT 23
* m! n- t. H1 }6 r5 c
( v2 B4 @/ ^/ J; ]4 j: B5 j- static volatile int irqraised1 = 0;
! A5 g; a. J. D - static volatile int irqraised2 = 0;
7 q. I5 ~) a; u3 t8 d4 C8 u, Q$ N - % ?; b5 |6 H: K' z! t8 e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- v _8 M6 y8 L; H6 P - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 ?( e7 ?! A& j+ } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* D' h( `! k: u, o! _9 h8 Z: j! K
! \) M9 J& u. O. @6 k+ s- dma_addr_t dmaphyssrc1 = 0;
; n" d/ L% X: h' P) @2 v - dma_addr_t dmaphyssrc2 = 0;
1 Q! T3 M5 B0 }, E+ y( `6 q+ W( O4 ^+ s - dma_addr_t dmaphysdest1 = 0;" T! ?7 s! X( ~# h$ G
- dma_addr_t dmaphysdest2 = 0;
- O$ p9 V: i; }/ ^9 ` - # L( z2 Q f! M( s/ `7 X9 j
- char *dmabufsrc1 = NULL;
8 v; g z/ e8 L$ K! J# _ - char *dmabufsrc2 = NULL;
' m/ C0 I$ y$ k" [; d - char *dmabufdest1 = NULL;. ^: x; x% p( q, g
- char *dmabufdest2 = NULL;+ Q9 z3 Y# ~! Q" V
- / G( n, I. B" h2 l# P9 ~* |
- static int acnt = 512;0 @& g0 o7 _ @( Z' `
- static int bcnt = 8;
7 ^ |) `7 @& Q0 ~1 X" x - static int ccnt = 8;% x6 `, u* |& k, y" i1 H) \: T
& G; u- N9 ?+ \" o' |5 `1 |- module_param(acnt, int, S_IRUGO);
9 Y$ E8 y1 X" F& O+ L& z& i - module_param(bcnt, int, S_IRUGO);
% @ g( B1 X2 ^$ O2 l I - module_param(ccnt, int, S_IRUGO);
复制代码 0 b, C, ?. s: K+ R t( Z
1 F: K( Q, u' l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 |# X7 r. z$ i/ G0 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ v2 R- a/ S1 O: C* \7 ] w 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' B' S9 N, v: M* j9 N6 w7 m) P0 |7 W4 d9 W
! E* A6 Q/ j! r% c: _7 ] |
|