|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. \" @: j/ G8 p- [code]EDMA sample test application
F6 m+ I9 ^1 ~3 U' C5 G; e - /*
& X9 ~3 K% H: Q: F - * edma_test.c
9 @1 K, {% V! v. ]. M - *
1 B% Q2 @+ Y+ w! d8 k" V) |' e9 ^ - * brief EDMA3 Test Application
3 _8 P3 }7 Q0 N& U0 J: d - *5 E2 m4 \* c9 j; k& u, R1 s
- * This file contains EDMA3 Test code.$ {) y4 ~3 p( t" R2 ] _; W
- *
; P6 s8 m! l A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 q; L! k- u5 x: ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) l' K% T1 x. v- q% g* o
- * TO CHANGE.
0 z' s m' v5 w/ c - *
" O) x6 v4 o* ] t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* R$ {) v$ e( A' J5 D/ Z( e - *
; }* Y" v. w) x" G( T/ A0 P - * This program is free software; you can redistribute it and/or
* K" _" V1 P) b1 g- ~+ \ - * modify it under the terms of the GNU General Public License as- Z' B4 b5 G) U9 e0 s' }1 i$ I
- * published by the Free Software Foundation version 2.3 m& u" P, G: g3 d
- *# w( k0 I" l }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& q1 f8 ?" G# ?3 O/ w. c; Y
- * kind, whether express or implied; without even the implied warranty; M% b K( R; b* V X% O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! i% @9 g9 d: ^! F1 q) n2 a( Y4 `
- * GNU General Public License for more details.
- [- o6 o' J. V - */
$ Q$ b3 g; J% s' D) b3 s$ `) G$ {
: s# v9 O1 {* @2 p- #include <linux/module.h>
* s( E5 R6 @; \: d2 s - #include <linux/init.h>& w9 }5 Z) [ ^7 @* D
- #include <linux/errno.h>; m6 M9 p3 d; `! s d
- #include <linux/types.h>+ F V) [) x) D( z. ~7 g9 ?
- #include <linux/interrupt.h>
# a5 p; q2 F3 P5 @, B - #include <asm/io.h>
+ ?1 w2 a: Q6 Q' R9 o9 s - #include <linux/moduleparam.h>
, [* J1 c2 X! Y0 _ M' t5 I - #include <linux/sysctl.h>
% L; l- F: S5 ~ - #include <linux/mm.h>
- |0 n7 `/ v b. o5 H+ F - #include <linux/dma-mapping.h>$ r- n$ c& q' p0 X: O0 c! g' f
6 }5 C, U ]$ L$ f0 b: x% v- #include <mach/memory.h>! L0 k0 `+ a- d: F7 H
- #include <mach/hardware.h>8 \8 l0 f9 P' @6 m& I. O+ E/ G8 |
- #include <mach/irqs.h># f& w0 o8 k- b
- #include <asm/hardware/edma.h>
" l. Y, f6 r7 o# p6 }/ k - 6 n' ~: b5 D1 h$ n* j
- #undef EDMA3_DEBUG
( F; I% T: A) F: N2 K - /*#define EDMA3_DEBUG*/# i% R' K2 b9 j& M, p5 t& c
- 2 J" x9 E1 c% X6 N# v! N7 s
- #ifdef EDMA3_DEBUG9 S' O5 ^7 w" |/ b; T) ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). }5 Y' _' Y+ A- p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ b$ D6 q4 u1 h0 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 J8 y: O& y* e( s6 y' q( { - #else9 C2 q; B% g: L" s; X/ f
- #define DMA_PRINTK( x... )% _! C# E+ b: F. Z3 i
- #define DMA_FN_IN- C t: p7 B; O) `7 t- y* Z/ @
- #define DMA_FN_OUT
$ H8 Z: i/ B/ ^$ b' i - #endif5 y% {: b- Y. H" e1 W1 g' w* g
- ) ]' |" ?4 E/ g; s: u/ F( c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. B: U2 K% ?2 ]. x4 k/ G - #define STATIC_SHIFT 3/ o; J: l: ^! m
- #define TCINTEN_SHIFT 20
2 k6 z+ U- E. h. N0 r - #define ITCINTEN_SHIFT 21
1 X. w6 Z+ I% X2 a F' [ - #define TCCHEN_SHIFT 22# V+ B* b& G6 Z& L
- #define ITCCHEN_SHIFT 23
8 H1 p. k* p& Q" C - _$ H8 ~; v; T, k B
- static volatile int irqraised1 = 0;
. t0 C$ J' m& W$ M$ S7 s5 c: M - static volatile int irqraised2 = 0;
" e7 m4 N8 `* f' I" k& w7 U- X) i
/ M& c5 U2 C. p6 G. K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& M& n6 y: S+ ~$ L$ n0 O, C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- p$ \( ~: E& @* ^$ W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 r! P( _* G) J5 _1 ]0 ?: j - . ~, K- P, B+ O& ? i5 c' X* O+ `
- dma_addr_t dmaphyssrc1 = 0;
7 i( P) X1 |& O. e - dma_addr_t dmaphyssrc2 = 0;
9 g0 _7 f3 i" v7 a% e8 y# ~ - dma_addr_t dmaphysdest1 = 0;
8 `2 Z0 x7 F/ ^- } - dma_addr_t dmaphysdest2 = 0;
& v' ^. e1 [6 t! X, g
/ {( n( C; z& ~) z0 \' J0 B% O' D- char *dmabufsrc1 = NULL;4 U( t; W1 V# ~5 g+ r( O2 `
- char *dmabufsrc2 = NULL;
) `7 w# @/ d1 f& _# T - char *dmabufdest1 = NULL;) k8 n" k3 t- r* L- [. e
- char *dmabufdest2 = NULL;
" z( N/ \: ~" e4 [# {/ i8 F - 9 t9 ]; E$ X/ g( G2 w% R1 `( t
- static int acnt = 512;
9 J L3 t6 v& f - static int bcnt = 8;
: g+ g- ~7 Z, c( A! R+ { - static int ccnt = 8;( D4 O# C( z b6 ?0 V
& R2 B( U2 w; H& p1 N/ B% y6 X& t- module_param(acnt, int, S_IRUGO);
8 R/ ~. M" T3 Q8 F) W - module_param(bcnt, int, S_IRUGO);3 a* A6 a; h( r' }% N. O
- module_param(ccnt, int, S_IRUGO);
复制代码 m# f* _, Y6 s0 V/ S; K
8 L! V2 w* U1 q4 ^" k# a8 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) c( y, i$ Q' I- q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 v1 T. |4 W5 {* U: i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 _/ E2 T4 T5 ~$ e2 O
6 m, f* R; V& F; ?; e: g: O
) q4 d$ X3 g7 J" B$ Q$ V3 d |
|