|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& r9 b/ m' z1 H% ~4 l- [code]EDMA sample test application/ a ^" x$ y7 ?
- /*
& Z4 c, I& Q7 Y0 n - * edma_test.c- l$ F9 q8 ~; j$ f! D" [7 y
- *) O ^6 Y3 `0 D9 F2 q/ o. }6 y
- * brief EDMA3 Test Application
6 j4 R0 e( ^, `1 P* m2 g( E+ j - *6 e% d, T0 `: y& h! X
- * This file contains EDMA3 Test code.' [7 ^, K6 f% T- ~
- *' ?# w8 ?$ \8 O3 @) }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" O/ A6 |* u3 W2 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: k/ E/ H5 \1 W/ Y9 Z: t - * TO CHANGE.% I) s& w- d! r2 y; W3 N
- *
; @/ b* g- Z# _$ g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ r s s' B: W3 ?' g
- *
, B0 P. r5 d* w7 W - * This program is free software; you can redistribute it and/or
* M2 k; m) s/ ~& g; P - * modify it under the terms of the GNU General Public License as" g4 z$ O5 R) m" N; k& W$ v7 s
- * published by the Free Software Foundation version 2.
/ U/ B) I( b3 F( D0 P - *
U6 H" u9 j! |/ B2 e/ V; o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& j0 E2 m- q/ x& W, E* l
- * kind, whether express or implied; without even the implied warranty7 N$ n' g4 Y$ T4 M$ y: d8 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* _. m1 [$ L# x# k- G! Z" i8 x' j! p
- * GNU General Public License for more details.
% ]' u2 \' |% | - */
8 R G/ ]5 ]3 A( ` - 7 j9 N! N) _+ }# J- l( S, ]0 M
- #include <linux/module.h>$ ?( ?2 Q$ D: {4 ^" {
- #include <linux/init.h> M8 M; _! V+ a$ S+ l+ w
- #include <linux/errno.h>
8 ?* s" Y9 D5 n ?2 i - #include <linux/types.h>) Y4 J' i \! k6 l( A. F
- #include <linux/interrupt.h>8 v0 V8 J4 g9 S0 ?
- #include <asm/io.h>
0 }4 C2 D; q. N5 e" H- } - #include <linux/moduleparam.h>
1 S. L0 l2 @# |- ?8 Y$ i7 ?! n - #include <linux/sysctl.h>
" ` h! K1 ?4 \6 [2 n- [9 c9 o; l- n - #include <linux/mm.h>
% i0 k* M, z; ~( E+ R+ x! r' d - #include <linux/dma-mapping.h>
- B& \* L! N7 u8 G( ~ - # f& \# X9 I& E$ r3 p& D
- #include <mach/memory.h>5 Q3 M# t, m8 Y7 Q: F2 ~! p
- #include <mach/hardware.h>
* \+ Y" d8 {, j; b R - #include <mach/irqs.h>
+ h8 s; H9 r, g: A" \* r5 H" B - #include <asm/hardware/edma.h>
( r" }# [+ T8 o4 A& e, J! z - ' H! l; S8 G+ e+ q* n& o. B8 n
- #undef EDMA3_DEBUG
) }# F2 @' @4 ?2 D - /*#define EDMA3_DEBUG*/
* L5 P K7 s& V5 G( h% G4 Q4 ]
# q5 Y$ H* g1 ?4 F- #ifdef EDMA3_DEBUG# T9 w/ Y$ k4 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" D* Y! `: ^* J! z2 k( O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" r& f0 e, v2 j" Y+ ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' o2 `. @% J, t( l L - #else
" _* L1 I* }- z( h - #define DMA_PRINTK( x... )
+ W: P" A) }4 }6 R. _ - #define DMA_FN_IN0 T0 V2 G* ]" E8 R& k) o3 e
- #define DMA_FN_OUT
8 J5 ^" x7 h: ^, ` - #endif
% t# ?) I4 v# h
F( G+ V. |: D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 c# S9 s; k6 p; I, ~, b$ [5 b - #define STATIC_SHIFT 3
& \7 q/ z% s! w/ j2 E - #define TCINTEN_SHIFT 20& S2 {! ^. _ A; u) v
- #define ITCINTEN_SHIFT 21
1 C0 D( y* @- s# h$ _7 {0 d5 [/ C+ J - #define TCCHEN_SHIFT 225 U+ q( U7 j( ?/ h6 @: {6 p$ e
- #define ITCCHEN_SHIFT 23
2 j4 M4 l7 o3 f. N5 ~3 p2 _ - ' ]' p4 a. O: w9 m* e( L5 Z
- static volatile int irqraised1 = 0;
2 I# v0 g0 O+ n7 ^ - static volatile int irqraised2 = 0;
) ]* z& ]4 F% k" L
3 R2 R/ i L/ y, Q1 X6 x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 D+ w3 k; |/ p0 {) G3 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" t! C- }" C; V5 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, D" b0 q4 T/ L g7 q6 i
3 I% ~4 O; n. o8 l& ?3 |4 M- dma_addr_t dmaphyssrc1 = 0;
# E$ a1 d7 s5 g1 T" m/ B - dma_addr_t dmaphyssrc2 = 0;+ t# v) r0 T/ Q0 K
- dma_addr_t dmaphysdest1 = 0;
& J3 L" H' k* O+ s - dma_addr_t dmaphysdest2 = 0;9 v" o4 x9 o! e; [( m, [' A' S/ q
4 e' l! m$ I9 x- char *dmabufsrc1 = NULL;
2 l, U6 J+ y* r - char *dmabufsrc2 = NULL;
( ?: Z) a6 j9 V2 L7 {) g+ z/ Y - char *dmabufdest1 = NULL;* H0 o+ \8 P9 S3 X* G2 t( G
- char *dmabufdest2 = NULL;% X4 d9 _# x. K0 K. M7 Y+ i9 Z% O
( e g' K6 Z) i" l- static int acnt = 512;
3 x* T& V# E3 K- N" K( I - static int bcnt = 8;
1 g4 }) D+ \$ V& y - static int ccnt = 8;
9 J1 o3 w9 A K6 C0 X% D! A0 Y# U - , j' ~, A* O$ ]
- module_param(acnt, int, S_IRUGO);
; o3 V5 ?% _, ^/ o - module_param(bcnt, int, S_IRUGO);
% c2 z, N7 H7 E - module_param(ccnt, int, S_IRUGO);
复制代码
0 z I7 \) o7 {% t' {7 i; r2 L/ p( C {7 j) ]: j: e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) y4 b, g& ?- n. u, q/ I u3 z Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 l( m3 R' t. |5 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- b- F- z: b8 W: `; I/ _
0 \& b% G" _2 R B% |, U: k4 o) V( t/ x
|
|