|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 K5 y& Q) Y; v
- [code]EDMA sample test application% Q, C' U; X$ u2 k* |% ]9 K
- /*
7 [; Z$ \- h0 o$ o8 ]# J - * edma_test.c
& W K" A4 V& f2 k - *8 A6 ~, z7 R3 O8 T @0 v4 ^
- * brief EDMA3 Test Application% r: w1 w) x/ [! M, H
- *
0 X/ [( a# g8 \/ g( z0 s8 Q+ J - * This file contains EDMA3 Test code.
t* `1 q/ X8 r6 U( I) {1 B - *
, N |2 \$ t/ e! n" Z0 r- x& p2 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 D' u" r0 c, W* v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 p# J. ]' d8 B- u - * TO CHANGE.+ i* T9 o( i! P
- *
2 U% x' @; s0 W. F. A- C" K% M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ~) A0 h2 B6 @8 \ - *
4 C3 @1 G# I) n! ?& {$ V1 p - * This program is free software; you can redistribute it and/or2 r' K9 ]- p: X( ?
- * modify it under the terms of the GNU General Public License as; V2 {8 m2 r. D2 [
- * published by the Free Software Foundation version 2.
, f! m3 O0 S5 |7 ]4 v - *7 x& V) N9 U- {; j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 \) B0 ?( R8 W4 d/ I - * kind, whether express or implied; without even the implied warranty) ^( I7 v' w* n0 P, E5 q# M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the k8 x+ n1 z% M2 G" x; c
- * GNU General Public License for more details.
/ O- k. O8 S- z: a8 g3 i2 [0 l - */
6 S2 ~/ A1 ^' U! x5 }9 B) G - ( ]4 S( M8 X$ F: }' I d4 W' O. \
- #include <linux/module.h>* l$ U$ \0 i: H& @
- #include <linux/init.h>
' E+ ?6 k$ Z9 i4 G - #include <linux/errno.h> z5 p9 |, R' j+ F. w
- #include <linux/types.h>
5 I) c: o0 d' @ - #include <linux/interrupt.h>
/ _/ b% z% q% Y0 R - #include <asm/io.h>( E/ u* e0 m' b
- #include <linux/moduleparam.h>
) x* \ x0 G0 m - #include <linux/sysctl.h>
: U: T2 f: e9 B5 y - #include <linux/mm.h>. H; H2 e3 m1 Q4 j( C
- #include <linux/dma-mapping.h>" s/ s* ~" U; l" c" X; Z! G# o
- - [! O+ O9 U1 Z, N- z6 x! F
- #include <mach/memory.h>
( u& V4 P$ M! [- f8 x6 j) A - #include <mach/hardware.h>0 ?5 m$ @7 F% W( P7 f) B
- #include <mach/irqs.h>
4 H' B0 s+ @( T4 A; I - #include <asm/hardware/edma.h>3 O8 u1 _( E4 l9 h
- ( L/ x- b' ^) m7 g
- #undef EDMA3_DEBUG6 P9 J6 N* `5 e) U6 M
- /*#define EDMA3_DEBUG*/
) o+ H I7 }! k* t7 h9 \ - 8 O0 V9 C( y! C) g+ \1 I5 l
- #ifdef EDMA3_DEBUG
+ O' d0 o# l8 g& @/ g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' a+ W8 [, s1 D% q: H, L3 e. {1 j4 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) F# Q0 s' Y. I8 D' b4 A! a+ | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 k0 [7 ~6 O' t/ F# Q S
- #else8 s1 D; `2 Z& N% R$ A$ ~
- #define DMA_PRINTK( x... )/ O* _% H" O) O! h' y
- #define DMA_FN_IN4 B/ v3 r) m" d7 ^, ]. F
- #define DMA_FN_OUT
9 \. l1 A8 t# D. j! i3 E' ~ - #endif& [$ |; R: ~+ R; a! u
- ! ?! _/ l1 E$ b4 |4 N) h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* _5 |0 {! g1 h; n" i8 W7 m - #define STATIC_SHIFT 3" ]* |/ I# v$ k% @# e- l
- #define TCINTEN_SHIFT 20
# l ^, B& d, i7 ~( g - #define ITCINTEN_SHIFT 21
* N( f: C, x8 c5 f, v - #define TCCHEN_SHIFT 225 z8 n; X M/ n' U$ G4 A
- #define ITCCHEN_SHIFT 23 y0 b" C! E+ B8 ]: H/ C/ j
& V( k& o' O+ [& d. O" b- static volatile int irqraised1 = 0; T0 }* I# k2 D; p
- static volatile int irqraised2 = 0;% l2 R7 }# ^- n( i
$ L2 v) Y4 S0 X$ j, X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); S J Z; R4 s3 F q- W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 `) n+ g3 H) L8 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- _6 ^% B. L- F1 {" M( B# R- S
- 3 H: c" G# S+ P
- dma_addr_t dmaphyssrc1 = 0;
2 i5 S; T$ t3 l4 H, y - dma_addr_t dmaphyssrc2 = 0;
* I& M' A* H: A9 B y/ ` - dma_addr_t dmaphysdest1 = 0;
" @ Q+ |/ c- y6 q$ D - dma_addr_t dmaphysdest2 = 0;
& y; ^' |6 Z. f" q
7 M* x6 p& X! q8 |/ w' l2 O2 t2 b- char *dmabufsrc1 = NULL;& a$ j+ m3 Y. ?4 K
- char *dmabufsrc2 = NULL;
; {. r9 [7 ^, D+ `; j; e+ g3 a K - char *dmabufdest1 = NULL;
% b9 v& j: d# A# g - char *dmabufdest2 = NULL; g$ y. {. b* h5 y2 |6 r- G( d
5 g7 R& V/ n( m I( T* W- static int acnt = 512;
7 z/ |9 p+ c; Q9 U" s - static int bcnt = 8;
1 i) X9 x) `! j/ Y% {' x" u0 r3 r - static int ccnt = 8;* h& ?% t" D6 v0 M$ r8 u) W" J
# \. l0 a* n# o, M. |% ?% d; J: ~- module_param(acnt, int, S_IRUGO);) x& b7 Z' y, r `. A. A; ?/ ~
- module_param(bcnt, int, S_IRUGO);
& W- _7 a( A6 C% t8 @ - module_param(ccnt, int, S_IRUGO);
复制代码
; k$ b, Y/ w* e! e7 ~% r7 B1 F9 { C9 f5 j' u8 b0 `6 D- z9 u+ m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Z* F3 U) b9 I) o3 R+ k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! k" k0 X- S, Q, m" W5 U' [5 q. r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% i; N( U$ S! W; v8 Y# U; f t0 ^6 z
0 D1 |* T, K( b S
|
|