|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + q6 \) g+ b3 Z% \
- [code]EDMA sample test application, Z3 L& F9 Q6 j5 n
- /*
7 i. j, _1 o! d, V9 e4 a - * edma_test.c& p$ Q5 v9 b* [& u% f8 Z
- *; _/ F J: M' T: ?
- * brief EDMA3 Test Application
* M8 J# _6 S6 ]3 I/ } - *& \0 c( t2 V1 C! N# Z
- * This file contains EDMA3 Test code.2 O# G2 y/ g8 j0 S
- *. e7 C4 d& s2 P1 u0 r1 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m: E$ w1 p- X2 E& B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 i8 D. _/ P; {0 X, E" ?4 u' B: L - * TO CHANGE.; K2 Z) R8 o4 m+ i* y- `/ s
- *
6 |$ Y& S4 i" a/ j. w! { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 p8 g" f. e8 p7 o/ U' R
- *3 \$ p7 s) K( ?: c- |/ w& [. b! o/ D
- * This program is free software; you can redistribute it and/or
& J; l) A# {5 A, ^7 r( n$ r8 N: _ - * modify it under the terms of the GNU General Public License as. o; x( _# n( l
- * published by the Free Software Foundation version 2.; |1 M# }3 F' R7 {7 `& l
- *
1 G! B! }1 T( L7 n3 s8 f$ C7 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any \, [, S' h R
- * kind, whether express or implied; without even the implied warranty
! u8 k) ~7 q3 F2 K( J2 _* c+ z+ V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ ?( Y$ K; Q( B/ ]: J& P - * GNU General Public License for more details.' x. F k3 {6 a `# R) G
- */8 b2 }% P/ W g2 l9 Z d- Q
0 D6 i9 Z N: m# Y5 X- #include <linux/module.h>
1 J, R, r. Z' }1 @ - #include <linux/init.h>+ i% g z2 D J4 O
- #include <linux/errno.h>
8 l* \( F8 ?, d z6 W9 S; W - #include <linux/types.h>: u) o K7 j4 d2 h
- #include <linux/interrupt.h>$ P" G2 r5 V$ v7 y
- #include <asm/io.h>8 w# Y$ ?1 w5 R) r- h0 l5 Z
- #include <linux/moduleparam.h>
" L W) N# \6 ` - #include <linux/sysctl.h>4 C* l/ J% D1 Z# X$ I
- #include <linux/mm.h>
# r1 k0 b- f& `! t. s/ I: F6 { - #include <linux/dma-mapping.h>* T* u7 d: U T; _/ u! P
$ p6 t" [2 E8 A+ v4 t- #include <mach/memory.h>& q: h5 C* R& R+ b( O
- #include <mach/hardware.h>
' Z: G* h! D, i5 Q0 z2 Z- Q( E( D) p - #include <mach/irqs.h>
% S' l2 Z+ [# q8 u( H - #include <asm/hardware/edma.h>& m; M% S+ f4 |; X, @- w. P" @
2 C t# }. G4 P) t$ J2 o7 O5 G1 u- #undef EDMA3_DEBUG
: ]9 `& A" P$ o% D$ v5 {/ x - /*#define EDMA3_DEBUG*// s$ h! v+ T3 M) }. Z
7 f g. N/ ~. `6 G/ e2 T$ a- #ifdef EDMA3_DEBUG% ?1 W1 n, F! i% C# R, j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 E$ Y' O, [ ?7 y! N3 J$ w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 z, e" J8 F/ F# b3 x) Q, v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) d+ T0 B8 {- w- J9 X - #else
0 P( d! |6 ~3 F7 \: H$ Z; X - #define DMA_PRINTK( x... )
) u. H) V5 g6 P' \ V# R, y - #define DMA_FN_IN
: ? @& P+ i L) p. X+ p - #define DMA_FN_OUT# I) {) F* `1 P3 e+ Q3 L: l
- #endif
- C1 }' W; X8 i - # x: A% k" P3 z7 [; d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), T) q; e, W7 K$ O
- #define STATIC_SHIFT 3
- b1 u) R. d! ?* O) j5 o - #define TCINTEN_SHIFT 20
8 m1 _' n# K# X$ g1 L - #define ITCINTEN_SHIFT 219 N' z n T* m- J: L# }
- #define TCCHEN_SHIFT 22
* D/ s& ?$ U, z7 M! e' s, { - #define ITCCHEN_SHIFT 23) H5 ?0 F' V5 t; Q* x: c
- 1 N. q; p6 [ Y
- static volatile int irqraised1 = 0;
( J) a% A! v, r/ T" R - static volatile int irqraised2 = 0;* ]; w' v7 M! P
. ~6 R* C3 H* i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V1 H: i/ b* F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! [, x# D' q8 r7 v) ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! S+ H" K; j( [! p3 {) A" j
B a! `& f% K2 k; H& W- dma_addr_t dmaphyssrc1 = 0;
+ ?9 p0 m! s( R; l: G - dma_addr_t dmaphyssrc2 = 0;4 I/ Z" z+ T! w/ E8 I9 W5 t* _
- dma_addr_t dmaphysdest1 = 0;4 M6 O9 a5 Y. a9 M% f3 d: {
- dma_addr_t dmaphysdest2 = 0;- W5 }) f! f1 n; o, z9 U
& u2 H( C: t; R, D+ M- char *dmabufsrc1 = NULL;
6 H5 A, t5 [& `6 w; Z+ ~3 S - char *dmabufsrc2 = NULL;
* o3 K1 O% P' @1 { - char *dmabufdest1 = NULL;$ g u6 f1 ^$ W$ }
- char *dmabufdest2 = NULL;
$ i" t0 c! C3 b2 O/ `
% j" `# i" |) n5 {" n- static int acnt = 512;
5 U" E2 H5 l# \+ _5 b - static int bcnt = 8;
* x8 B% ?" E+ _0 r7 m& ~4 r - static int ccnt = 8;: L% e1 t5 y: R
/ h0 Q3 {7 w. l* ], r- module_param(acnt, int, S_IRUGO);4 Q1 y' A, a3 j, r' h% d& m0 F
- module_param(bcnt, int, S_IRUGO);
5 |8 D3 ?- z0 m7 }/ o - module_param(ccnt, int, S_IRUGO);
复制代码
3 H% u4 |9 {6 v- X& {. g7 E& _ `9 K R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- V E# ~; F" l0 A' w: h% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 L+ D2 Q& B8 l1 G! u5 C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; X C l* {$ X5 s$ m- l2 O
- ~) I$ H7 P2 S6 K' F7 T: N4 z. \" ?% _" t v* _6 \) B8 \4 ?
|
|