|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Z* m; i3 T+ `& c5 `& A
- [code]EDMA sample test application* r/ v( M* K6 e8 b4 g7 e% _8 `* U! R! T
- /*
8 A1 N7 x+ l5 R/ g - * edma_test.c
3 }' D/ ?* L% x: k { - *
) @& v. G0 C6 U; O - * brief EDMA3 Test Application- _$ z5 @1 i+ y9 X7 T4 S5 R2 [
- *( s" l# \5 H: _( R( P! U' _
- * This file contains EDMA3 Test code.: F8 T1 I" @4 y/ u
- *
( K3 P X2 e4 f" j7 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& }3 I/ @5 e. m6 I) P" k- G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- k. N3 n! a; x- n2 j1 g, L3 L - * TO CHANGE.. Q. l G8 Z' ?" ~% w* ~6 \; C# M
- *
0 A9 t: [. Y4 B% U7 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// R6 E, z, R- i* @
- *: T* l( V+ g* I% Q
- * This program is free software; you can redistribute it and/or
4 Q3 A' B9 ?6 w$ O# Q1 B, K8 h - * modify it under the terms of the GNU General Public License as' u& Y, J0 i! q9 f* p6 C: B
- * published by the Free Software Foundation version 2.
5 d! {4 O& W. Q2 q/ [0 h) J" d/ V - *! H6 \5 w* J. r9 Z4 Y0 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 d5 r" D9 J( a0 h
- * kind, whether express or implied; without even the implied warranty
- e/ x- a8 G' U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 L7 g3 d% O, g2 F" Z, M) O- S - * GNU General Public License for more details.; y: E( B# v7 s) o8 U) Q
- */: `7 i. z0 v. ~' x( K& X+ l; F# s/ Y# d0 L
- ) |% I8 @0 K* n/ o+ k
- #include <linux/module.h>2 ]+ ^3 D+ T$ q k
- #include <linux/init.h>
0 z) U/ p+ f! x8 k$ }& d5 L - #include <linux/errno.h>
F1 H" E- P. `- D5 {4 F - #include <linux/types.h>
+ H+ L* k6 i# }# S2 Q4 z. H0 ` - #include <linux/interrupt.h>) I3 I! m6 u& T; h8 q2 _; j( ]; Y& w
- #include <asm/io.h>
# h9 y" R' \4 u7 Q' N - #include <linux/moduleparam.h>$ _8 A0 @" \0 L- U' |( f" p" W
- #include <linux/sysctl.h>
* Q( A# T1 U; V4 {' d- g/ `7 e - #include <linux/mm.h>
: m7 W0 e7 r9 Q2 d: l$ Z8 A - #include <linux/dma-mapping.h>
- g8 ~: [6 R6 ?! ] - 8 x, `1 i( y& B, R# |' z
- #include <mach/memory.h>1 K% B# I+ @+ Z2 h
- #include <mach/hardware.h>, ^: \9 `7 C* O" V+ ^( G- d* ]
- #include <mach/irqs.h># p! J& l# Z) R5 d! Z
- #include <asm/hardware/edma.h>& c: ]- W* g' N( O% r: b
- ! H5 H- G6 n: E) W4 N, w" ?' t
- #undef EDMA3_DEBUG* ^5 ~# [* ]/ t3 A% V- v' w' [+ S* E
- /*#define EDMA3_DEBUG*/" c8 Y( O6 ~" Z# \$ w, _
- : j7 Z# \- {$ j
- #ifdef EDMA3_DEBUG
' ]& I d& o+ z; l0 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); I' L0 ]& m5 F: ^# c ^: a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ h4 I9 n, l' G e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); H6 h+ a& n# Z& A. X
- #else
5 `; ?& B. V8 ]" e H$ f8 W - #define DMA_PRINTK( x... )' p4 v3 Y3 N1 Q6 v" @/ m
- #define DMA_FN_IN
1 ^# g* k$ a2 m, i+ ~. y2 a0 @4 D - #define DMA_FN_OUT8 g2 P) T: l3 i6 l$ `
- #endif3 A, |! R/ g5 c3 [
& r" T6 S! R" ~ _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 {* i; O7 Y! M/ o: \( b5 A
- #define STATIC_SHIFT 3* |% i1 ]& j* Q \+ |& t5 o
- #define TCINTEN_SHIFT 20
. q( u/ S: N! \! @ - #define ITCINTEN_SHIFT 21% P* n2 q( ~$ l/ W
- #define TCCHEN_SHIFT 22/ j! R7 V) T" ?7 c$ N5 [
- #define ITCCHEN_SHIFT 23
c+ _2 R( F2 F0 Q6 J6 j
* f0 X$ J% o' b- z- static volatile int irqraised1 = 0;4 M9 v8 m1 T7 B( x7 r9 }
- static volatile int irqraised2 = 0;" U# W# i4 ^3 F
- 2 u+ R& Z8 t3 g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# y T7 N8 f. M; g% d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( W( d2 G8 `0 J0 U& L2 ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {: X& n! A/ m4 n- U
( V6 O) g; o C7 H- dma_addr_t dmaphyssrc1 = 0;
7 r- ~0 M+ t& }: t - dma_addr_t dmaphyssrc2 = 0;
; j" ? J8 w: ]9 F0 E- A3 ^6 a5 b - dma_addr_t dmaphysdest1 = 0;! G; N& x9 u5 G9 L# L
- dma_addr_t dmaphysdest2 = 0;
4 y; Y7 ^* T; f" L - 7 S. u* a, H4 w6 p8 y: L
- char *dmabufsrc1 = NULL;
% `; V& q8 {5 x; _5 }% ?" | - char *dmabufsrc2 = NULL;
; v# R) F7 I( z - char *dmabufdest1 = NULL;
8 b( H9 q' ?! h$ R" T; p. {2 s - char *dmabufdest2 = NULL;
( ]: d: A: Y! b9 b1 t9 z% j - , G( C" ?" L: T' N0 n
- static int acnt = 512;+ u4 h* F5 x/ q$ ~* i; I
- static int bcnt = 8;8 T9 Y0 p; d% n b/ M" y0 y
- static int ccnt = 8;
& g9 a- E+ I, q) h9 _) X9 U. _; _; ^
k- v/ m+ ~7 ]$ |+ [) U- module_param(acnt, int, S_IRUGO);8 ~( z9 p: y5 G( C7 b* c: l9 O
- module_param(bcnt, int, S_IRUGO);8 k& c8 ?* `2 p7 o: m
- module_param(ccnt, int, S_IRUGO);
复制代码 , _7 S& h) [0 g$ L1 \
8 [+ ^3 X0 y! m0 U8 C8 g' c, h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, `% C b6 m6 q, U4 d* M5 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) @( R6 D3 u$ B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
N1 e) n; V/ s! J3 j$ ?8 X$ K
/ O" I7 Q1 e/ ~# v' U3 v" }& q& T! }, n1 @% k' M* m2 R: {. m
|
|