|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) C1 l- N7 m5 r6 r' L
- [code]EDMA sample test application
: ^1 k. k5 z7 A - /*
3 L0 t9 s& O% f( h/ I - * edma_test.c
" \4 O7 P! L/ d9 I; M- \! ` - *- w7 F3 ]6 J0 e% R& P
- * brief EDMA3 Test Application
' [: [0 I' i5 H$ i# i5 w1 a - *
7 a' G* q r1 G1 l( C& y0 Q - * This file contains EDMA3 Test code.
) j8 P% Q4 _! ?3 O$ m. T0 I - *
. R1 J! c- [% i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( x7 p" g2 ~9 X' h, j6 h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 D5 r, t0 F* f# D p5 F
- * TO CHANGE.6 I; | R7 B5 {8 J A& l% N
- *
' q! `% ]; b% D$ z2 q, O1 l) g8 b4 W8 A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 p0 y5 J/ f: v - *
1 I+ r8 Q; M, `( y$ {3 q3 i - * This program is free software; you can redistribute it and/or
- e* q3 A' a; {5 L& k1 l - * modify it under the terms of the GNU General Public License as: q1 j( z) j6 }3 X0 r' l* o
- * published by the Free Software Foundation version 2.- u2 R" M2 g1 y4 Q+ y8 Z" ?
- *, F7 F% o8 A, Q1 E" q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 D- d, o9 g5 t9 r3 H _ - * kind, whether express or implied; without even the implied warranty( r& A: H; s* O3 j# o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 H9 k g5 N/ s1 X# X* z - * GNU General Public License for more details.: N9 |& \1 \* _& \/ }8 Z# M7 a
- */
. I" Z, |' ]+ @/ Q. d! Y - ! ?) Y3 t# a2 A+ g# A8 L4 F, a
- #include <linux/module.h>6 g9 b, q4 T4 X# M5 m. }
- #include <linux/init.h> k8 r# U7 z8 v- f1 n
- #include <linux/errno.h>2 A# |$ Z6 u. w; u$ c( J
- #include <linux/types.h>+ f$ r$ v6 Q/ @# B0 ?( d
- #include <linux/interrupt.h>
5 q; C3 W' D5 ]) V8 W - #include <asm/io.h>2 [! {5 H. m2 m4 j
- #include <linux/moduleparam.h>
* A- O3 ^" u7 ^- I, X, g - #include <linux/sysctl.h>/ e/ U# y% Q( a: f" C* J* _2 Z/ K- |
- #include <linux/mm.h>; p$ J2 V* a% ^, q: V
- #include <linux/dma-mapping.h>
/ |+ Q4 l+ v2 t8 m) j9 O - 0 K% C+ k) A$ s2 I9 `& Q% x
- #include <mach/memory.h>
; W+ S: b" j1 \, a" H - #include <mach/hardware.h>! C% a3 Z0 Z5 U
- #include <mach/irqs.h>
! n0 ]- M' W4 l* m8 y - #include <asm/hardware/edma.h>2 r% o. C* m/ E. ^8 P; @; E- E4 b6 }
- ; K* T( Q6 v0 ?1 y8 d* Y9 Q" c
- #undef EDMA3_DEBUG9 t9 [" k2 ? X% B5 b
- /*#define EDMA3_DEBUG*/ L9 @: L, |% U9 U
- 8 B. j0 j! K; {: F) U; ?
- #ifdef EDMA3_DEBUG
- [; |/ ^9 K- B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( ]# z$ ^7 D8 k7 K( j4 n- o2 f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 A2 P0 d3 s" D3 F* y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 L; Z! @; W+ A) I* b1 w, [& d8 g - #else4 U9 A2 c2 D, o, m t
- #define DMA_PRINTK( x... ), m# |" _8 R' k9 H+ c
- #define DMA_FN_IN
2 p( r4 j3 }. \4 F l4 h - #define DMA_FN_OUT
4 P$ _; O# K( Y F6 T7 ] - #endif9 j8 V* R& l, l* ]
- " \& p0 E/ t* E1 d( }, N( ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ]% u" f/ H% u: d
- #define STATIC_SHIFT 3
% J# w$ T" C4 l' z: E - #define TCINTEN_SHIFT 20& S7 n+ r1 ]+ g9 p1 B0 O6 s' q
- #define ITCINTEN_SHIFT 21
% g( I: V4 p) T2 W4 k - #define TCCHEN_SHIFT 22
# k [: m: x' f6 K! Y ^$ ` - #define ITCCHEN_SHIFT 23- Z2 j* z K) i$ K- {; p
- : ^/ l* B% S0 z; w6 Y* G/ [$ m
- static volatile int irqraised1 = 0;
8 B5 U& ~* W2 _& n. U# v - static volatile int irqraised2 = 0;
, _5 a( Q* m5 i; Z) a - & I1 C1 f; s" h6 l5 k$ L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. X0 b7 A. E# W$ X) q" [8 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
f! S3 Z q7 G' P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" M! ?# q- A4 f1 L' H6 O
+ ~/ ~) D, d3 X- dma_addr_t dmaphyssrc1 = 0;
) X+ a' [6 e1 S4 J - dma_addr_t dmaphyssrc2 = 0;( K/ Q2 f6 L; o
- dma_addr_t dmaphysdest1 = 0;
0 |6 e) [& J/ q3 w0 g, G - dma_addr_t dmaphysdest2 = 0;- E. }2 C& { R9 g+ t1 ?
- ) S! J! l4 G/ M% Y+ _- Y
- char *dmabufsrc1 = NULL;
$ i V1 t/ h: f - char *dmabufsrc2 = NULL;- H+ g* e S( N- g; w1 O! V
- char *dmabufdest1 = NULL;
! O! C- O0 Z, p9 c/ I. m - char *dmabufdest2 = NULL;! [( G+ Y. M; _" m
/ |" J4 ^- i4 \, x- U+ Q- static int acnt = 512;( H8 Y$ l: \/ v) p) ^
- static int bcnt = 8;
k7 x* t2 r; F9 e - static int ccnt = 8;, p. R& [5 Q, u
- ! ~, @. [4 D; J8 ?8 `1 _
- module_param(acnt, int, S_IRUGO);& N& {$ L g) F6 m, \( w" ^0 g, j
- module_param(bcnt, int, S_IRUGO);
7 e% A1 `% a. c& b - module_param(ccnt, int, S_IRUGO);
复制代码 # S2 a) u5 b6 d9 E+ ` F
/ m) i, W0 r* O0 i% { p" w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, O% H7 d' K/ ` D% ~8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Q' @; k' T9 x; b. h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& ^; {- ~5 ]6 P5 C$ ]. Y3 ^9 u$ i6 N% N1 {2 ]* w
1 e9 ]5 C2 \9 ~; O
|
|