|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# T, C: H7 [! y! o; g- [code]EDMA sample test application
' {- @' `4 c( J - /*
; T, @4 n' P5 s l+ O, ~1 Y+ r - * edma_test.c
: |/ N8 d' P0 P& l- ?! w0 w - *( f+ Z" m5 G% u/ `6 E7 N1 d
- * brief EDMA3 Test Application
+ V e5 p, C# h3 ^* D5 T4 h* v* |# k - *- D$ S1 b; @2 B: g3 w/ O% y" d
- * This file contains EDMA3 Test code.
. W6 h5 Y+ Y: ^" ]. a4 G9 d S - *+ Z2 M- z8 l9 E. s; M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 Z9 a% |" B; J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 Y3 i5 E' a9 n - * TO CHANGE.
- ~) j0 m' K! T& L - *
" [% o. Z% K( {; J$ b: h4 E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ v+ s, t# N6 x) d' ?0 y+ m - *, r3 ^+ n5 g, \
- * This program is free software; you can redistribute it and/or3 @* K7 w* a- B2 `8 |
- * modify it under the terms of the GNU General Public License as
9 K' h/ _6 J7 S; ?. U - * published by the Free Software Foundation version 2.2 P O' _8 x y5 ?; s0 |
- *
& X; W7 B2 `' ?0 w, a7 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 C) d$ I0 k& @% q8 s! I! y - * kind, whether express or implied; without even the implied warranty% i/ G4 z/ |; n3 V1 w* q$ Q4 f2 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 f: K' e# R2 |2 r- [
- * GNU General Public License for more details.
* G4 o; f: n) K1 `1 _6 N5 s - */
/ W5 y8 d( u1 n) Q8 H - % @; N# |6 N& R+ L: L; }
- #include <linux/module.h>
5 W' g3 U% |, I9 W5 w - #include <linux/init.h>
$ T5 C! p4 ]# B$ r5 t( l - #include <linux/errno.h>1 H3 |5 T* R1 b$ r: \
- #include <linux/types.h>
' f0 n+ G- A! O# F. @' | - #include <linux/interrupt.h>
4 }+ d5 V4 Y! ` - #include <asm/io.h>6 C! y4 P& H n9 y1 Q' |
- #include <linux/moduleparam.h>
, R: y7 v% p% O) [5 G6 J - #include <linux/sysctl.h>
( T! x9 z# p% [# K - #include <linux/mm.h>
- z7 I, g. t! v - #include <linux/dma-mapping.h>
j+ v5 l: S' k S) V; x) r
" B! F6 p/ W- w/ F3 |9 W9 A- #include <mach/memory.h>
( a+ H0 W5 Z4 l - #include <mach/hardware.h>. m6 |$ _9 w! P6 v8 Y
- #include <mach/irqs.h>
2 T6 w$ K3 ?: |+ r0 J F - #include <asm/hardware/edma.h>
9 ^9 q& l7 ?0 v3 f8 K+ r$ H$ t% | - ( A/ y: ^ O: u/ r' M+ ^4 H% }
- #undef EDMA3_DEBUG
6 @, s, x; ]# W# J - /*#define EDMA3_DEBUG*/
1 e$ y; D2 T+ T" a. Q! W - ! j9 }8 R' B, |' j: b
- #ifdef EDMA3_DEBUG% G2 ^8 u8 |# J. L! B8 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). M* C) U `4 J; l0 W1 c( i2 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; D# a) m4 h. K& N* l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- I% y3 D' D; u3 K# O- E
- #else
7 x3 K1 I/ B' k* u, M6 n - #define DMA_PRINTK( x... )
" b& G/ n9 ~+ c w- b$ m& B: a - #define DMA_FN_IN
7 p8 }! w$ H2 W8 {+ ]3 [% x - #define DMA_FN_OUT
0 W) i }0 K; d, B" ^, l O# Z0 f - #endif
. I4 }/ o7 Y1 \8 b - + K7 R. I, ~6 f* D1 ?5 A! l. a' u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ B8 d: C$ Z" Z8 w5 t8 V( Y
- #define STATIC_SHIFT 3% A8 A9 u$ g+ C
- #define TCINTEN_SHIFT 20
+ [. }/ o% A) V, N8 J: A - #define ITCINTEN_SHIFT 218 R5 Y( H6 n- t- T& u8 i0 l
- #define TCCHEN_SHIFT 222 A) o; g0 \/ W9 T7 V" U1 M8 j0 s
- #define ITCCHEN_SHIFT 23- b2 `& d6 V6 D
7 n" o9 N2 n' k8 T& p8 a3 Q, ?- static volatile int irqraised1 = 0;8 V! t9 p4 V5 Q" i0 y- l* ^# ?
- static volatile int irqraised2 = 0;* P1 D0 \) [( d, s& ]/ R" r
" x& U/ S. J& Z5 l: E1 u( b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ z2 v" \2 E1 j: N* O& b$ m: e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* f7 A1 P3 `/ u9 Y. A, g Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 \* [4 p( \ R; X
5 ]$ w+ u% ^; A- E- j u! G- dma_addr_t dmaphyssrc1 = 0;& g4 g8 G d ?4 {# s) W* M3 z5 O
- dma_addr_t dmaphyssrc2 = 0;
1 I) c* P' z$ h+ t - dma_addr_t dmaphysdest1 = 0;
8 j; s \9 C. U4 I% q9 d - dma_addr_t dmaphysdest2 = 0;
$ C% t/ w1 @. h
- \! i" A/ z6 v* }8 s+ k- char *dmabufsrc1 = NULL;
) x' P4 V! L) T/ o7 n - char *dmabufsrc2 = NULL;& {5 @' ? \( }9 A' i# `
- char *dmabufdest1 = NULL;
; {1 @- M0 G+ b% J5 u - char *dmabufdest2 = NULL;
4 ^4 E, w: M- q4 o9 Q, V1 [ - 4 k* @5 V+ L6 {
- static int acnt = 512;
0 N% g2 S, t9 w0 V - static int bcnt = 8;9 n8 @% k8 B0 b- [
- static int ccnt = 8;* R- w ]" Y5 d1 r
- " b& o1 O, J# t. j3 g
- module_param(acnt, int, S_IRUGO);
+ m N; m/ q: Q8 w# q; G9 O - module_param(bcnt, int, S_IRUGO);
. [& ]; E2 r) G$ @ - module_param(ccnt, int, S_IRUGO);
复制代码 6 I. E. Q$ Y" f$ H- G: v
2 G/ y+ T. x$ Z: Q0 V& m# f# r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, C% u, D/ E% ?) f. ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. P, Q. F+ S' ^( o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& Z4 \ I3 J6 h
- M+ g: [5 ? F, J9 p' p, x! g
2 q& n4 b3 X, m4 i) K
|
|