|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ ]8 p. `7 @2 @2 Y$ {- [code]EDMA sample test application
; U k" K5 Y2 X5 R9 A* Z, b! K' r - /*3 Y; F; u' v% N, I& c+ j
- * edma_test.c
7 D8 ?6 I" c$ J+ e! ]' @ - *
" V& t7 {: Z* ~ - * brief EDMA3 Test Application
* a& @/ v! j! \! Y+ i: g7 {! u - *+ k# S2 @8 J; k1 w( C# s! }2 p6 D
- * This file contains EDMA3 Test code.% W" `" U' k2 q/ K: l1 X2 }* F
- *
! K" R5 c$ K9 Y( |1 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
f+ s3 W4 a# W1 d G! t( | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ B& d2 A$ b: A) q- D0 y" w
- * TO CHANGE. h: N: f- E, T" B; f6 `* r
- *
4 Y# p3 A% R% | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' E! A; R/ y% l
- *
! s% q+ K4 K- o - * This program is free software; you can redistribute it and/or' o! S5 M o g: h) r0 Y
- * modify it under the terms of the GNU General Public License as+ ^# F2 B+ C" R. g: Z$ u9 O
- * published by the Free Software Foundation version 2.
* I) [+ J5 a/ U: E7 n - *" x( }& j) I: O9 b3 X+ |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 W; g- }; B8 e( n
- * kind, whether express or implied; without even the implied warranty$ u- D+ r; x! K/ N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( i7 ^) g/ B/ P! t - * GNU General Public License for more details.
' t1 ?! S- q/ A j - */( b V$ l4 z i* ~3 T$ a
- ) [: e% B* |1 q3 w
- #include <linux/module.h>- ^$ r7 R' v; Y+ ~
- #include <linux/init.h>
) R8 O3 r. N* p" {3 H2 E0 w$ V - #include <linux/errno.h>/ n4 L7 q8 v& m& n: s
- #include <linux/types.h>9 e/ S+ a/ B( d- \ {
- #include <linux/interrupt.h>
: _7 G2 o! X; B) P1 L - #include <asm/io.h>
6 O5 f# ~ e- Y1 Q9 H! u - #include <linux/moduleparam.h>
' I5 [ d) U {* d1 ~: s* F - #include <linux/sysctl.h>
D7 v# A- G: `: V1 E* q0 r - #include <linux/mm.h>
* ]5 C0 l* B( S3 g - #include <linux/dma-mapping.h>
$ g: j8 o& ?: Y, w
) G, i; p* U( ~$ k. Y6 O& J. y- #include <mach/memory.h>
, x8 O4 h; X4 D4 V- z7 p8 e8 c! O) y - #include <mach/hardware.h>
7 k' W0 e: [' i3 a+ P0 _/ G - #include <mach/irqs.h>
) g3 p7 K6 j$ o5 n, J6 d - #include <asm/hardware/edma.h>/ a, ~' j& Y3 O/ X
; y% c9 F2 t0 c' d- @, E- #undef EDMA3_DEBUG0 O% s$ Y2 [7 j4 k: L
- /*#define EDMA3_DEBUG*/- O w8 X3 Y% Z. r+ N
- " M7 _, A# ~2 r; `
- #ifdef EDMA3_DEBUG
% z: R; s9 G8 V: `4 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 m, B7 P% w/ C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( y+ J ~ e8 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 o1 K3 s5 [6 D; j
- #else
9 |' v+ G4 T9 X' A - #define DMA_PRINTK( x... )% B: C5 i) |5 }9 }! [* e; x; |' G
- #define DMA_FN_IN
0 k: M2 ^. F$ k( ?% s' G/ F - #define DMA_FN_OUT
% ?- s) h# P4 @1 r' l: [3 @ - #endif3 Y) y [3 L) p8 M! @5 R
" F+ S3 E- Q- ?! I L! k* T, c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
f9 O( D; T: I; ]. e - #define STATIC_SHIFT 3
# W( T3 U7 R% R - #define TCINTEN_SHIFT 20% @4 s d$ l$ W$ K
- #define ITCINTEN_SHIFT 215 J! [7 s# ~2 E; e8 g, t
- #define TCCHEN_SHIFT 22# R- n3 @( W6 _% K. p8 y1 `
- #define ITCCHEN_SHIFT 238 j) C x3 V* m, o% _
x! U+ k5 _9 _+ ]( a5 F" r- static volatile int irqraised1 = 0;
H4 g% d8 x4 a2 W7 n& K - static volatile int irqraised2 = 0;
0 Q& k( B( D6 l - 0 S' c# T9 }+ i0 w& r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) c) l1 _5 b0 E; C6 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# s8 @0 c1 v4 R) j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ h6 ^: A5 a3 B" m5 Z7 V' f
( `) w+ ?) [2 e% p4 ]0 l+ y: Z) m- dma_addr_t dmaphyssrc1 = 0;
, `! Q+ d1 ]) y - dma_addr_t dmaphyssrc2 = 0;
3 T# Z, n1 w1 D9 ? - dma_addr_t dmaphysdest1 = 0;
0 q3 j/ a: z! v - dma_addr_t dmaphysdest2 = 0;
6 F% m2 R0 j: j& ^4 {' T
7 k1 @* l- ^6 i+ N; u/ j- A- char *dmabufsrc1 = NULL;/ N% H( h z6 o1 L
- char *dmabufsrc2 = NULL;
; y! t3 g) {' X" I" C1 U& u - char *dmabufdest1 = NULL;
. `8 m) {9 K, F) N- H+ V( h6 ^9 ^ - char *dmabufdest2 = NULL;/ p- a9 N- ?9 G2 X7 x6 ^) L7 y! s& ~
- & ~* z3 A Y/ Z; h4 _+ h! `
- static int acnt = 512;
9 C+ `3 [( G4 [1 a5 a& y - static int bcnt = 8; \3 y" f& t& U7 C* H& k* H
- static int ccnt = 8;
; j3 J+ I7 z. j: V5 ]7 f$ a - : x- u' r# y9 {# f0 c& N
- module_param(acnt, int, S_IRUGO);4 k* P" }- K. _5 _# T
- module_param(bcnt, int, S_IRUGO);- ~8 p5 r, G+ c% g. J' W0 M9 k: F& {
- module_param(ccnt, int, S_IRUGO);
复制代码 0 w8 w. {0 u; x$ H% b6 l4 ?9 u
; M1 K1 n; Q6 v0 I% k* C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ f% p2 l& h+ s: [' S" T7 X" d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! s D% x# ]; Z) ]5 } @ Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 r# c5 [9 g, g
& B- [( p% A2 |( ~) D. c7 ^
: W- R3 F' L: Z |
|