|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' i' {+ a7 \4 O# G1 d- [code]EDMA sample test application4 R% V8 S, }4 T
- /*0 t. B( q: J5 O' M" ^2 ]% [
- * edma_test.c! S! S- A# Z7 I: e+ f) l
- *
j4 {) N: ^' E - * brief EDMA3 Test Application
1 s0 w/ l4 ?% _ - *% ~" l8 B8 N0 C* p
- * This file contains EDMA3 Test code.
2 p- w Y% e8 [ - *
; n9 q, ^" ^. x/ T/ | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ] y2 m( Y, o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; ^8 C$ S: s$ P( F( s
- * TO CHANGE.
* u% y0 N9 E2 R5 }( ^. [: K - *- ^* e4 e% \$ i k$ f3 k$ D* H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 C/ p1 N; Z# w& A7 a! a
- *) a4 y6 r( U4 ~; R
- * This program is free software; you can redistribute it and/or
; D/ {. ?/ v' A - * modify it under the terms of the GNU General Public License as0 S) ]- E X8 R
- * published by the Free Software Foundation version 2.: K( m/ d. C3 J8 m
- *5 }0 y; s- |7 [/ `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ M1 x* `$ a7 b) r - * kind, whether express or implied; without even the implied warranty
+ v0 L8 Q4 Z! }' _, L" c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Y1 ~, w9 y8 v4 H- T+ x" T
- * GNU General Public License for more details.
~/ W! j7 A" ~& `: D& g7 D - */
" b$ E7 B* g3 E1 H - & |% K7 B1 M2 W
- #include <linux/module.h>' K8 S4 }$ E0 U n9 ]& K5 Y+ N) X
- #include <linux/init.h>
% o3 J E4 w# C - #include <linux/errno.h>6 h0 ?. ^. P) x8 g- G( J/ O
- #include <linux/types.h>
) h# K2 e8 |' L* V0 n - #include <linux/interrupt.h>. U5 `7 F' O* a ?0 a
- #include <asm/io.h>& V% x6 B4 ^: q9 B. b1 [! h" L" t [
- #include <linux/moduleparam.h>. c# N! [' R+ s. X. b7 M
- #include <linux/sysctl.h> T" k8 Y+ e5 L6 S( u6 K9 D5 W* W& V2 }
- #include <linux/mm.h>% i' g, ]' L1 Y# ^0 O
- #include <linux/dma-mapping.h>
: T% \' l9 X6 W2 U& I. K
1 |: U" |& Z- m! [1 {# p# o1 i4 z- #include <mach/memory.h># \9 S* {9 e% A) }. d
- #include <mach/hardware.h>
& a8 z5 @/ C" N: m: p - #include <mach/irqs.h>
8 x# G. {+ M# d6 c7 j3 n9 e4 J- H - #include <asm/hardware/edma.h>
) O7 C7 u: X+ Z - ) t! G9 ~+ }9 }$ ~# `' ~
- #undef EDMA3_DEBUG
9 U/ w0 J' t1 H& B1 B y X/ r - /*#define EDMA3_DEBUG*/
1 i, ~# g4 ]0 b; x4 H& o - : z, e. W* K" X1 U5 H( [" C
- #ifdef EDMA3_DEBUG
" V" }, ^5 j; x# ]( Y4 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 ]4 B2 A; ]4 q9 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* Q" P) k' ?+ b* j$ |! H$ u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): F' F; K x* D) S/ x* \
- #else) f! O2 j% G. c5 j7 x
- #define DMA_PRINTK( x... )
* F- c; `" G( }/ g+ ^# W8 H - #define DMA_FN_IN
" G* v5 k1 f x9 r( K - #define DMA_FN_OUT
9 Z. f6 Q' {+ T! A3 L - #endif
, \* E8 L: o0 w T
# u9 n% r- `; d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! b; R6 b4 {/ L- J0 `# q0 h# Z4 A& Q
- #define STATIC_SHIFT 3! n, v- n! J. G5 O
- #define TCINTEN_SHIFT 20
$ z! Z' W7 h4 H, k/ t6 `3 I9 T+ Y& o) F - #define ITCINTEN_SHIFT 21
0 B2 L; b: T/ S) _, y5 Y - #define TCCHEN_SHIFT 22
: k4 I& e* G7 U3 ? - #define ITCCHEN_SHIFT 23
& f+ `) K. A% n% B - : |3 f( g8 I' i3 B0 X! ~2 G, d! G
- static volatile int irqraised1 = 0;5 _' P. ]5 u' @ c
- static volatile int irqraised2 = 0;# K. }8 k$ a+ p( c4 g
n3 d+ v* t7 H, i! J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z% F9 Z3 n% q: Z6 v4 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 D) }% ^1 W% r5 ]4 v; U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 {4 f9 w; B+ ?7 _2 ?3 a - 3 [& [- t2 H' A! `
- dma_addr_t dmaphyssrc1 = 0;
/ R! D; r2 e0 u( t: L- }8 N: A9 x - dma_addr_t dmaphyssrc2 = 0;+ r% n+ v9 o1 p# }( J
- dma_addr_t dmaphysdest1 = 0;
, w2 g! F' ~: `# d5 t: W2 ^3 _ f - dma_addr_t dmaphysdest2 = 0;5 _" h. R( I1 g4 E
- k3 t+ J7 a1 a* Q
- char *dmabufsrc1 = NULL;3 Z) } F9 B6 `9 r; p f/ Q5 T
- char *dmabufsrc2 = NULL;
0 l7 _" ?/ \) b6 E' M - char *dmabufdest1 = NULL;% X2 a2 k4 n. S! ~
- char *dmabufdest2 = NULL;0 g. X, }. h6 k; b$ W- G! B
- * E1 B3 H' ?9 c, \
- static int acnt = 512;
- t' Q! `; G0 n R - static int bcnt = 8;& q* U @, g m& Z
- static int ccnt = 8;
, ?6 g" \, Y4 F - 0 z& K T/ O+ }7 y) e
- module_param(acnt, int, S_IRUGO);
1 F$ |# G1 e, J% ~9 n" r - module_param(bcnt, int, S_IRUGO);/ m5 A' G% h; C7 _* e4 O
- module_param(ccnt, int, S_IRUGO);
复制代码 0 F8 d T+ P9 a% |3 h
5 E. `0 j+ ~% k5 ~5 l7 ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& _: A! {( F. `! j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& A* b* t' ^- Q6 I: ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 K1 J# n. I8 b$ d) ]: b) b
/ V9 E6 E: k8 I5 |$ K6 v9 ~+ m* N
, j8 i A+ ^& M
|
|