|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ [5 e1 N) {& P1 g2 @7 w- [code]EDMA sample test application* @! [( ~, o' t8 ~5 y
- /*
# R: H- l" c' F1 i2 k% T - * edma_test.c2 V, h# E) b+ a4 O' H1 R5 E
- *# V& q' ~7 d* B2 F7 p) S
- * brief EDMA3 Test Application! i1 J: I8 u* {- [, r) s0 C6 V
- *
0 E% n( {- i" y0 X - * This file contains EDMA3 Test code.
$ |: i' W- R7 u! ]" a& {( o - *
( P7 b _" ?( {, A' o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& Z, U! W( y8 A2 _( y) h& o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 k/ @7 Y }2 A+ w1 L" G - * TO CHANGE.
9 g' Z4 ]8 c* x! ~. I! o# V2 p* e+ w - *: Y. D5 f6 L2 I1 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ I6 x9 E% W$ V! C% o. ~
- *
% N& s7 ]9 U1 i6 B. ^6 Q& D - * This program is free software; you can redistribute it and/or
. f/ A1 p& e% \: ^( U [2 Z - * modify it under the terms of the GNU General Public License as8 [3 w, W7 v. U% F. @
- * published by the Free Software Foundation version 2.! v2 Z ?- E& k" W. k1 P' P0 h
- *
, l7 Q0 v# r3 ?- { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. C3 A7 U6 ~) N) K( d1 V
- * kind, whether express or implied; without even the implied warranty
$ b' x# w8 u8 t; T2 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ z$ v& S" X1 o6 G: C" n
- * GNU General Public License for more details./ E0 F7 h5 `" I% f
- */
% e0 @4 {- h. d2 K6 ]* [ - 3 @+ C1 a8 ]9 [3 V* K7 I
- #include <linux/module.h>
/ {9 w5 @# U1 p; J9 i% Z# h+ g - #include <linux/init.h>, Q* w5 v8 B% `: U ?- P
- #include <linux/errno.h>$ |; f# l2 v+ z2 c: X$ G' j" z/ U' R
- #include <linux/types.h>( `) V" H$ V5 i% L
- #include <linux/interrupt.h>
" v( Q! k9 B7 L+ d% r( L - #include <asm/io.h>4 H) o. r r& B
- #include <linux/moduleparam.h>
0 s# @1 |# s1 ~+ {0 | - #include <linux/sysctl.h>5 P' w9 t8 u* t. ]: t
- #include <linux/mm.h>4 E" `) x5 a" |) I) t
- #include <linux/dma-mapping.h>+ a' H2 l* \" ]/ ^1 s
9 ~4 ^# L6 i+ g2 \( i2 w2 s9 z3 o- #include <mach/memory.h>
O# q9 x8 [. R% D8 n- ] - #include <mach/hardware.h>+ e! M$ q% ]& a5 r2 N, \+ b
- #include <mach/irqs.h>0 g$ Q4 V% v# r _
- #include <asm/hardware/edma.h>8 @5 {9 \: S- N! X
- , j3 V( W* \2 W) k5 j1 z, |
- #undef EDMA3_DEBUG
% h# W9 H: T+ v% y+ ?. K - /*#define EDMA3_DEBUG*/
$ {' _9 n/ c( p! A* _
" I8 |6 u Z: t$ O; J) B4 }% J- #ifdef EDMA3_DEBUG
; A4 \& C1 O0 z( ~9 D p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 @1 b5 e, Q/ J1 \% S" V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 a/ }. i, f/ c, Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); F$ F3 E7 y( u& D( Z% L
- #else# L& t4 o Y; }! ^. `$ R
- #define DMA_PRINTK( x... )
7 D4 C1 d6 t2 @6 H' ?, H - #define DMA_FN_IN+ O2 U. u/ n. ]" N# A& }( [( \& l
- #define DMA_FN_OUT
. _/ X! y9 w5 B' r0 B - #endif
4 D& u# `, d4 t- W
1 `: s3 ^6 S0 z& F: R) l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- B8 i+ a2 O) M/ O- o2 r' }
- #define STATIC_SHIFT 3
5 G9 E" y/ F% _" g; K) O - #define TCINTEN_SHIFT 20
- U/ k3 B1 E! M% X - #define ITCINTEN_SHIFT 216 R/ a" V$ C, N+ `2 T. p
- #define TCCHEN_SHIFT 223 D. ~8 a! Z( |
- #define ITCCHEN_SHIFT 234 w) B. r" c: i/ \6 ^" O
5 }. x- w( s9 g- static volatile int irqraised1 = 0;
% O* n5 r% Y1 d) L' v - static volatile int irqraised2 = 0;
/ |0 m K, _. Y/ ^( z% i2 M - ' j3 H3 p: Z) Y( J7 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* A6 i; u3 | ?0 T9 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Z) n$ G# p& U1 T5 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# j1 t1 z5 ~# I+ a - / U* E1 r1 C. e$ k& I+ r9 Q
- dma_addr_t dmaphyssrc1 = 0;
8 e# h5 J2 E$ |8 R% W4 [ - dma_addr_t dmaphyssrc2 = 0;# P! n9 Y; O1 Z. h x! V2 y
- dma_addr_t dmaphysdest1 = 0;7 D* T; [. `& y7 s
- dma_addr_t dmaphysdest2 = 0;
: J r* i2 J/ \1 |! Q
5 l5 j# \* n. Y! o2 X, J' B- char *dmabufsrc1 = NULL;6 H% L, r4 X+ l# k: H
- char *dmabufsrc2 = NULL;
. M4 }* _, q& @- @ - char *dmabufdest1 = NULL;
, U( {5 X: I0 {" i/ q. X - char *dmabufdest2 = NULL;! h! ?- b. Z% f. J# p+ F- Y- Q) Y
& s3 @ b4 F! L# l# x. s6 i) ]; Q4 }- static int acnt = 512;) Z, k, V6 P( f
- static int bcnt = 8;+ [0 N6 k2 ^3 n5 M- D
- static int ccnt = 8;# Q! U5 N' b& O/ z* F' Y/ P
. z, ^9 g5 Q( h2 M2 l4 P- module_param(acnt, int, S_IRUGO);
0 [+ w5 V! {) P" w; b - module_param(bcnt, int, S_IRUGO);3 t- `; Z. z+ U1 c7 X' m7 m
- module_param(ccnt, int, S_IRUGO);
复制代码 7 d& N, ]! {( p
7 D/ Q2 t* ~; e7 J% l- Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 }' |2 |* a- V" L; o) Y) @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; G0 H8 o- V+ a4 d$ {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 S& p2 R& @$ ~. U; {9 t& _
, @; g Q" C: W9 {5 e( P
$ T5 J u+ f/ A6 j5 ^' } |
|