|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% Y( l6 W6 c1 W* {- [code]EDMA sample test application+ N# x. { T8 E* z2 Q. J, t
- /*
0 G' B, r8 ?' l7 y) z3 i/ z - * edma_test.c
; P! o; P+ u6 H9 K. ] - *
# j" O) J* q$ N; u7 a1 k1 v( j3 P - * brief EDMA3 Test Application
3 s% u! W% e" r - *% n3 q, G F% T9 p) L: I r
- * This file contains EDMA3 Test code.3 B0 h( ?9 |/ l! s; ^$ Q2 K
- *$ T3 |: U) ~8 R7 I! g
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 t( x! F. O5 n" D6 Z6 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* W4 r- S% H) ?# n; X - * TO CHANGE.( u# t5 I) ^+ z) G% g( A
- *+ i Z$ H7 O* y# l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 L# d$ \- d+ S) C4 b0 z
- *
- s* v1 @! r3 |- }' S3 B - * This program is free software; you can redistribute it and/or; a* d& V8 J" P& _
- * modify it under the terms of the GNU General Public License as8 S; Q- @* i% b0 S0 R" q1 y# `
- * published by the Free Software Foundation version 2.9 M) ~9 J+ H7 e/ { Y L! B, N
- *8 V% u- A# m( D; P# ~3 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 f( N: Q2 V% x/ b) ^( k - * kind, whether express or implied; without even the implied warranty. t$ h0 j8 `6 S+ H8 y0 _! N9 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% w1 n i$ n. e: c- n7 z9 u - * GNU General Public License for more details.
! }" I, y% Q1 Z8 M3 ] - */% h2 _9 s' g+ f! O; _. o4 @
- 0 Q3 [, K( l4 q# G! e( t" W
- #include <linux/module.h>
0 R" c% ?; u, J& L' r8 h - #include <linux/init.h>% U) d. \6 a8 S3 O7 b/ |# E
- #include <linux/errno.h> @0 m$ Q. d0 [/ y6 Z
- #include <linux/types.h>
( e- X7 s( N* G' c+ I4 B - #include <linux/interrupt.h>
( F/ C( h2 x* i' Q- c; }. Y: Q! p - #include <asm/io.h>
: b( E2 T& x5 y- i! H - #include <linux/moduleparam.h>
+ h! O' [" }: i, t6 B - #include <linux/sysctl.h>
+ l {: W }' S) v- x5 O - #include <linux/mm.h>' O# ` L5 o5 m/ o/ ~" a, W# \
- #include <linux/dma-mapping.h>1 f9 \. L. P8 f1 b
- : S, h0 |4 R. `. E; s# A! {
- #include <mach/memory.h>' q0 l5 a' n& J" C
- #include <mach/hardware.h>
, a0 h! u8 F/ G# T' } - #include <mach/irqs.h>
; X: o+ y6 q- [4 G- V: J7 w, ]4 S - #include <asm/hardware/edma.h>. k" z( S) M. l( g* p& I
+ P8 J' P/ z. Z0 \- #undef EDMA3_DEBUG
' Q& p# J) [6 m! m - /*#define EDMA3_DEBUG*/
8 Q% U& U. a* p, [
. f- b( m: [7 T( ?; _: }- #ifdef EDMA3_DEBUG
$ B2 d9 J- t$ a3 V, b" o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 `* k9 {6 x3 W+ I; L+ @5 p
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( A+ z' ~% J5 V& N; j# _' } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& \2 ?! ~" ~8 v6 i6 [2 F) M
- #else
7 A7 I0 g# ~; E9 Y W' m9 T% u8 ^; ` - #define DMA_PRINTK( x... )
8 c0 Y7 o6 d) t _5 l, I: P. i) F - #define DMA_FN_IN
8 X s. V. `" P - #define DMA_FN_OUT
4 n6 Z$ v3 F p5 V) ]$ J& l - #endif& l& G, P. h4 d" G; ]& ?# d9 \
5 {, ^" V+ E2 {/ y( V4 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 w o2 r. s' ^" e: c+ \4 s" d; K - #define STATIC_SHIFT 34 f. l; q5 U( H! n: K1 v1 D* D1 B3 w
- #define TCINTEN_SHIFT 20- `7 p2 X, l( H$ E6 d
- #define ITCINTEN_SHIFT 21: D' E- V$ g2 r6 d; c% A, x
- #define TCCHEN_SHIFT 22
/ x& s/ s: x r; ] - #define ITCCHEN_SHIFT 23
: M' b% r j( ^
+ h2 b/ A/ I# }, ^- static volatile int irqraised1 = 0;
4 j. F ~! j H4 J9 f - static volatile int irqraised2 = 0;9 n( q6 R5 J# u' e
$ l' h$ Z& E4 k. c1 w7 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& p' G) M* d& \- l# I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- \5 }: x. @3 L6 Y% Z4 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 j' d! I/ `$ P/ O% `2 U# T& U2 K4 C
- & r1 }$ V8 a/ p: l
- dma_addr_t dmaphyssrc1 = 0;
7 c% g# w) Z) O, l/ C7 f9 `. P- D - dma_addr_t dmaphyssrc2 = 0;' q! ^/ G1 @9 L
- dma_addr_t dmaphysdest1 = 0;
7 d3 p1 ^6 \% H* \; T$ z( T - dma_addr_t dmaphysdest2 = 0;4 F% G+ ~0 |& U/ W* T
- 4 p# i* k. s" ^1 f: G! o- Z) g
- char *dmabufsrc1 = NULL;
3 y) u: _0 d4 y# |4 q/ D - char *dmabufsrc2 = NULL;
$ o& F% v# Y- V% q) O3 M8 P) S" n - char *dmabufdest1 = NULL;
, | S I- h- W" B' _2 L" Y1 I - char *dmabufdest2 = NULL;3 |8 m J% S7 b
- 2 h/ R7 B0 F9 b2 o
- static int acnt = 512;
/ F( ~% |, d! |& x. {8 w8 c - static int bcnt = 8;( e. d7 v& ^ W3 B( ]' V) ^
- static int ccnt = 8;
0 G; t0 J9 | \2 Z# p4 n7 E6 D
/ X* m! t( B7 C5 w: q- module_param(acnt, int, S_IRUGO);
) @& b* D/ V4 Q" m& x" G - module_param(bcnt, int, S_IRUGO);
, q0 S! e* y! [( q - module_param(ccnt, int, S_IRUGO);
复制代码
# k- i! g D3 g0 e6 { s+ \: V3 N9 M2 j5 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( u& v: K5 x+ @8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) K" \5 v i k+ z+ |: X! s- e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 f/ h: ^" ^9 K4 O3 F. C/ w) W& }3 t3 X& U/ f
# z8 C: ^3 s( @. H0 i( f* b
|
|