|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / O1 X1 s$ C4 l% [/ k- ^' Y
- [code]EDMA sample test application7 B+ Z7 u3 N6 } A. d
- /*! k: u( s- w( N0 P
- * edma_test.c$ r) t9 r9 [+ B4 n
- *
- i2 m7 M! f2 R; } - * brief EDMA3 Test Application$ X& D4 C1 D4 }: L3 `5 O
- *- q {, j1 j3 |1 V) u% [
- * This file contains EDMA3 Test code.) S2 e! `, Z- {* @( N
- *
5 K( O4 K5 T' k* B. r; A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% U+ V- [, ?9 Q3 [ w; Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. d( {, ?/ i% d6 [( {4 h" o - * TO CHANGE.
* j5 t, G& |! T. E - *( E8 P! z4 e# S+ f3 f8 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Q3 m4 ~- q" P) A9 O) B4 \
- *
# j" T; \6 y9 Y& z& d0 H0 i - * This program is free software; you can redistribute it and/or; G @6 W& a) Q9 G# I5 m
- * modify it under the terms of the GNU General Public License as
7 L* L; [, L* R- f% m- A) p - * published by the Free Software Foundation version 2.
4 ]- l& @0 j& b - *$ T& I0 S9 g+ Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" A2 X) R# ^# K7 W
- * kind, whether express or implied; without even the implied warranty
* J; I0 X* H0 G* ?- T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 B3 L; @- p$ |- |7 p$ g
- * GNU General Public License for more details.8 l* c) z0 @ w6 L. |7 F; f
- */0 O7 G, }8 Q) s3 Z( l- \! E) f
" K' n5 c5 o L( X1 A: p2 f- #include <linux/module.h>
: C3 z6 j! O1 ~* e' c. H - #include <linux/init.h>
0 b- U9 w b$ o - #include <linux/errno.h>
, T* h3 a- ]2 ?! ^8 x E* D - #include <linux/types.h>6 L" q d; A) N& {5 n9 R
- #include <linux/interrupt.h>
! m3 U. u+ c3 p+ G - #include <asm/io.h># z+ \( M6 J& Z6 f' A& _' p
- #include <linux/moduleparam.h>
5 `' {/ S- K! Z8 a& P% s - #include <linux/sysctl.h>0 O) J6 K- V: W& _% F( `# i( A I
- #include <linux/mm.h>
* S+ g8 G& H0 ^* |" L. E - #include <linux/dma-mapping.h>
3 V; e' c) b! U - : K7 S+ s% T9 S1 k0 H$ Y8 M& w
- #include <mach/memory.h>
5 \- N; ^# f* ~9 j' S - #include <mach/hardware.h>8 H- a% f3 L0 n( f
- #include <mach/irqs.h>
: N( E/ x3 y4 _% Y% u9 h - #include <asm/hardware/edma.h>, t5 t; O O2 z1 Y1 N4 }
) _ K0 Q8 E Y9 S7 {- #undef EDMA3_DEBUG. @! }$ ^5 {$ I' e9 f
- /*#define EDMA3_DEBUG*/
: x W4 {) t0 D) v; n& b - ! j# |# I3 D0 P9 K. e4 b N
- #ifdef EDMA3_DEBUG
1 a7 l1 b u" q$ h0 w+ C: a3 S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 J6 E, l6 h# L! J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& Q0 @$ e- T7 J0 f$ A% o. n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, N9 m. w+ B, z! V- a) c - #else
, W+ N) N$ @+ { - #define DMA_PRINTK( x... ) L; [: Z" ?/ \4 o6 p0 |+ e) C
- #define DMA_FN_IN. s! E2 r5 b V
- #define DMA_FN_OUT: z1 H& x* E" U& R
- #endif$ o- ^; E$ l! X9 _' [3 @
- ; `! h, A' K8 G5 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* y. S1 o- j9 w4 ^/ ?1 M8 ^
- #define STATIC_SHIFT 3/ P) y) x+ h/ P d, x- b
- #define TCINTEN_SHIFT 20% k" }7 B1 \% o% ] h0 a( o
- #define ITCINTEN_SHIFT 21' W( C% f5 Q' c% C7 @
- #define TCCHEN_SHIFT 22
+ T7 ^2 D t' l9 L3 b* _1 ?" L/ I! B - #define ITCCHEN_SHIFT 23. n* R; R. W. }3 L- \% v0 \
7 b! B) N4 Q) d- j! g- static volatile int irqraised1 = 0;
; O# s/ i5 Z% v E F# D+ I' s2 Z - static volatile int irqraised2 = 0;
* _' q2 X9 S, a+ ^5 m6 L/ \* G" V
- w7 Z- ~" G4 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 L8 ^+ j( R0 N0 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ [' r$ q& G. c: q9 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }, w+ k) i& E/ z- S9 O
' }: e; ]: _) N1 d6 m" P8 G- d- dma_addr_t dmaphyssrc1 = 0;
7 D. U- Q/ [7 d5 U. | - dma_addr_t dmaphyssrc2 = 0;
* V" F) |2 u0 Z4 [. N7 D i3 j - dma_addr_t dmaphysdest1 = 0;
. y; Q8 ~4 u- l+ @! W' V4 w - dma_addr_t dmaphysdest2 = 0;3 A$ x$ I5 k f8 x- x2 Y3 c$ f1 a L) c
( `* ~$ D* \5 B7 m$ ?) E- char *dmabufsrc1 = NULL;$ F/ b: X( P( H& F% y H
- char *dmabufsrc2 = NULL;2 r0 v( g% b! T: c, ]9 E+ v
- char *dmabufdest1 = NULL;7 Y5 B; v; _7 a& a
- char *dmabufdest2 = NULL;# H% q+ k* H3 j9 z* G
- 3 F" y1 c. h% F" L# D! o" H
- static int acnt = 512;
: W1 a- \ |+ `& r - static int bcnt = 8;. r/ i) }8 j R B
- static int ccnt = 8;8 w. H& h; r, h! f
& f1 r; O W: D7 P) d! ~& k; ]+ A- module_param(acnt, int, S_IRUGO);
( u5 p, J+ U2 H; y" H0 I - module_param(bcnt, int, S_IRUGO);
9 z- d' ]( Q( p5 u5 K) \$ \ - module_param(ccnt, int, S_IRUGO);
复制代码
$ X2 b ^5 P5 d, Q# \# j" L' x* D, R
& d/ L/ n* B1 y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% |3 F8 `. D4 X3 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 [8 i/ K; x% I N. |3 C) i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 l z) t* t. x8 p7 p4 D. k0 y& s! j o) z# w; V
! p: g2 j r- Z
|
|