|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 M& w1 L7 U! [/ S
- [code]EDMA sample test application# m- f% J/ ?1 a& B) O5 K0 u
- /*
: ~* B6 v+ s' ]1 `) i3 B - * edma_test.c
$ E. |& q+ }) K d" e) X' V4 ` - *# M _# h6 s2 S% K* G
- * brief EDMA3 Test Application: i y* {1 r: a6 t4 }* v
- *$ k6 v& x* e/ U1 C, D) G" V
- * This file contains EDMA3 Test code.3 ~. `* Y$ }* k
- *: E5 T* ~- Z" X; h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. b7 n B3 @% T& X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: j4 V& }/ y4 a4 o1 ?& I
- * TO CHANGE.
6 P9 r6 x4 |% g4 v' q; Q - *
' u) b2 A/ Z6 i3 F. @2 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// t4 d; J1 \( U0 l
- *& {9 V- G# T1 R4 [3 r+ \0 h$ U0 V6 S
- * This program is free software; you can redistribute it and/or: j) L* n! T- n3 W6 J
- * modify it under the terms of the GNU General Public License as
: ^/ |/ m+ Y4 e - * published by the Free Software Foundation version 2.$ R) L9 `! e$ F/ o" M9 @6 ?
- *
1 p8 B* a" }' z" v2 [2 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! S7 \6 ^# Y# X$ a) [: L4 \# B+ ? q
- * kind, whether express or implied; without even the implied warranty
9 @) a5 B3 F7 V1 H2 v) B. s! B" z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: J# v3 l$ a% a: l6 ~2 l! C - * GNU General Public License for more details. H5 J6 U6 w1 B" w" J
- */. E# Z0 m$ t ]# Y
7 G" K, [% ?1 `& {# U- #include <linux/module.h> ^( }) o3 W Q
- #include <linux/init.h>
6 x: z) R3 _. o4 j& k - #include <linux/errno.h>
1 l. \( @* B) f! Z: Y" J' Q - #include <linux/types.h>
( c+ h4 }( c6 f' f7 | - #include <linux/interrupt.h>
2 Q( k+ ^& F s( L - #include <asm/io.h>
! b0 a, Y' l6 \3 k3 i+ p0 n - #include <linux/moduleparam.h>
9 |8 ]+ B* I) z" h6 K' n; F - #include <linux/sysctl.h>, U0 e2 w' b5 N$ T" c
- #include <linux/mm.h>7 x7 k. ?) J9 { ~
- #include <linux/dma-mapping.h>* V- @% }. |. E) R! |/ \) |- a
4 ^0 A% p' z' X: }' R9 a0 Q- #include <mach/memory.h>
- |3 \8 ]2 r+ B" \6 }7 T - #include <mach/hardware.h>- y. V7 }! z1 t
- #include <mach/irqs.h>
% g; |" t+ D: V+ T( e - #include <asm/hardware/edma.h>( H5 f" \$ Q8 d& f q
- $ r4 i0 V7 d4 t0 A9 V) u& P
- #undef EDMA3_DEBUG- W* f# ?' g7 V- h% q
- /*#define EDMA3_DEBUG*/- h2 d+ o# b# K h+ ^
- $ @0 x4 k4 ?* x% {$ [. l
- #ifdef EDMA3_DEBUG! C% ]; G/ ^) m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 I# E& a7 g) X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# z" L- ^) {( ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), c% |3 v' j+ Y$ w# c
- #else9 U, i w. L) e) O- ^( o- p
- #define DMA_PRINTK( x... )7 U# \9 V0 z/ \5 `9 T$ t
- #define DMA_FN_IN, { q0 J8 R& h& X
- #define DMA_FN_OUT; F- q- a! W8 j& r% ?4 a( D& N G
- #endif
$ }' V, g9 v) o4 J! l
, c$ t* a9 Q9 Y B" {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 x5 x \" N1 N# c! w J - #define STATIC_SHIFT 3, M8 m, G( S; y
- #define TCINTEN_SHIFT 20: d1 e$ [- E+ U2 h3 g
- #define ITCINTEN_SHIFT 21
4 V# g* m( k% Q% o' x7 G1 s - #define TCCHEN_SHIFT 22
! V1 z9 l% f7 {" S+ H( u - #define ITCCHEN_SHIFT 23
& }: `! @6 |- Z- L1 R - / S6 H% |, D: c2 W4 o4 q: I5 j& z+ b
- static volatile int irqraised1 = 0;7 a. U9 W" s5 l1 C$ h+ h
- static volatile int irqraised2 = 0;
$ M% d o/ V1 N' X! Z2 q. ` - ! P7 V; N+ ]9 C/ ]+ g2 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 T: C$ G& G) E$ a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, V) S! ~/ ?! o) A: ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- i9 a+ Q+ U) `/ B
- 9 n$ n, W: e s/ o w3 l8 O
- dma_addr_t dmaphyssrc1 = 0;! D: L( c! V, D
- dma_addr_t dmaphyssrc2 = 0;9 ~$ _5 w D( M1 i
- dma_addr_t dmaphysdest1 = 0;5 `7 B# _# J* z X9 a# O, U& b. i
- dma_addr_t dmaphysdest2 = 0;/ J @( r$ K8 z+ \
( S2 F9 B' |2 p- [- char *dmabufsrc1 = NULL;
$ s0 H+ T |+ |0 A - char *dmabufsrc2 = NULL;
) k, E2 d. m' r3 P - char *dmabufdest1 = NULL;
' o6 Z( N8 ?- S: \ - char *dmabufdest2 = NULL;4 }% `- G* i5 a' {( a, S% ]" n7 A
]; u) s% p/ ~- static int acnt = 512;
; I; F, p) {3 V( a - static int bcnt = 8;* K- R: @; L0 O0 L* ^! }5 Z# \
- static int ccnt = 8;4 ]; y* }( c. \" i, k/ ?
- 2 D; O& O" N' {$ a1 k/ d
- module_param(acnt, int, S_IRUGO);
2 | Z% a2 {4 e0 T - module_param(bcnt, int, S_IRUGO);8 c3 B |2 T& {/ I; J X- Y
- module_param(ccnt, int, S_IRUGO);
复制代码 6 q. n" a* i1 w# I' y
4 _4 K; E7 U$ V( `! l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% K. K/ I1 ~: y5 _, ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 H- F$ v1 _" D7 {1 @! K+ J9 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 e( e' ^( o) ^9 d( [: F# J7 O( g
' p! y( D' l! ?. _ d, K1 ]& D: I* H/ i7 G' K. g
|
|