|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 U0 T" A/ O) a4 D! K, ?
- [code]EDMA sample test application& B9 K% O9 X" i D+ G% N
- /*
( u3 B$ T- |0 q& U) Z - * edma_test.c
' N1 \/ [0 m/ l0 k+ I - *, u6 K- ~1 h" {0 W
- * brief EDMA3 Test Application
) [- [: N, Y# t- d, f - *
: \+ S) }* Q" b* v6 v7 ]% G - * This file contains EDMA3 Test code.
: b+ D, T% }7 b/ T! ~& L - *) B% |! D B' K# B2 ]8 l( i" E+ Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' P9 _# [) @& {5 Q4 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" [/ x2 k& B- X" d0 h" k( I
- * TO CHANGE.
. G9 O5 [6 M) K! ? v& q, I; S - *9 F/ G$ b3 ^1 Y/ f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 T* A1 c$ Y2 U% z& A
- *
: K9 [% d) `2 U - * This program is free software; you can redistribute it and/or
8 H' `! f0 k1 b/ e9 [& a - * modify it under the terms of the GNU General Public License as0 l" W1 u4 t5 D7 M# P7 k
- * published by the Free Software Foundation version 2.
6 l/ ^: i& [( V* h3 F# l* ~ - *
( x* v* U, N. B' \5 ^4 e& P5 C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 U( _0 U8 ^- h2 N: z - * kind, whether express or implied; without even the implied warranty ^) l3 @6 c: P( w% J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; O$ x2 A% _9 ?! o
- * GNU General Public License for more details.0 Z! |+ m7 ^2 n; o( r3 g8 d
- */4 z5 o$ w3 J% Q5 d) W% b
- & M, Q( R4 p* g$ ~( Q
- #include <linux/module.h>
! g2 v R7 j2 z% U3 r- L0 { - #include <linux/init.h>5 ]5 ^; x$ h0 \9 x. U$ N& N
- #include <linux/errno.h>
3 N/ l+ k; b* J2 e - #include <linux/types.h>
- G& y0 }0 @1 B2 s* c/ r ^# x' ^- V - #include <linux/interrupt.h>
6 l3 Y" K0 X- b, U - #include <asm/io.h>
! n) i t' W6 _7 D/ X- W# h - #include <linux/moduleparam.h>
' s" b% t$ K1 Q* {# u& M8 ? - #include <linux/sysctl.h>
5 N, J& a9 @6 n' D7 x1 E - #include <linux/mm.h>+ S- t$ y1 H3 q. Y* L
- #include <linux/dma-mapping.h>5 ?; g+ w+ }) L& s* }4 w" ?
- * L+ W e3 l0 j; }% p
- #include <mach/memory.h>4 A" {; ^ u3 t" q" [+ S+ T! T
- #include <mach/hardware.h>
* d3 j/ |* D. G" { - #include <mach/irqs.h>
1 D7 x9 z3 g A - #include <asm/hardware/edma.h>" S$ ]. X# }6 r' [: K0 @
- * K" O6 F" u7 K+ n% X
- #undef EDMA3_DEBUG
& i- T- X y' s i+ q& p, c - /*#define EDMA3_DEBUG*/: m- T ?' t! C5 ?
3 Z# _5 k: N2 S0 }- #ifdef EDMA3_DEBUG
6 }. X1 E, o2 g; H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ p5 a9 @$ h# t9 C2 X$ o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% n! B9 @) O0 T+ v- \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
u9 c+ {4 T [/ y- L4 z - #else5 z. n( a; ?" H. f0 `+ o
- #define DMA_PRINTK( x... )
: I/ B. w ]; v! E0 B+ n" q - #define DMA_FN_IN) m2 X/ i% S- i/ L
- #define DMA_FN_OUT9 ?) @* z2 b! f( H0 M3 K" T- P- n& u
- #endif
/ Y2 x0 F- X1 G5 Q7 u& b- | - 1 T; D3 b3 C# G) W* l' B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). g3 [6 X3 v1 e7 |4 I* _: ]8 S
- #define STATIC_SHIFT 3
. p0 [9 x) k) E! o6 ~9 m5 @ - #define TCINTEN_SHIFT 20
# X, H0 u5 W: {0 B - #define ITCINTEN_SHIFT 21; |4 x1 M8 N6 n& G
- #define TCCHEN_SHIFT 22
9 d- W2 S+ J1 i4 _2 j - #define ITCCHEN_SHIFT 23& p/ X0 g* G+ L/ d9 R, r, w4 Y
: ]: Z6 @5 g5 K% R- _8 s- static volatile int irqraised1 = 0;
$ A. H3 b- s0 u }* q' v, ?* B - static volatile int irqraised2 = 0;5 p9 I- Y3 e2 K( P/ p8 @, }
! q* X$ M* Z h; Y7 {3 E8 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 F+ u; _$ I/ Q4 V4 u. G# P7 p$ l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: R' b4 Q5 {; }( L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. N* x/ }& }" \: I8 y - 4 a2 t2 g$ O8 f+ O5 i* l5 Y
- dma_addr_t dmaphyssrc1 = 0;
$ [: X, N+ Q" d( H9 K+ L6 s - dma_addr_t dmaphyssrc2 = 0;" F- u. \6 H1 c& k+ u
- dma_addr_t dmaphysdest1 = 0;
9 R& ]) \* r1 V1 `5 P1 W& @ - dma_addr_t dmaphysdest2 = 0;& x) K+ s% `8 {4 c+ Y
) N6 p/ j' B! E2 T4 X% m- char *dmabufsrc1 = NULL;
% b/ n2 G9 ?: |/ _" `' u4 A$ H - char *dmabufsrc2 = NULL;4 {+ w# w4 ^' }
- char *dmabufdest1 = NULL;
1 A; t7 s' C: a: v% E - char *dmabufdest2 = NULL;5 Y& Q0 L" c3 p8 k' a& A
- - l" e) r' a. P" c+ x- n
- static int acnt = 512;- _* _$ N1 |1 E* d( u* w
- static int bcnt = 8;
3 _% S2 Y! {6 b; H+ w* U; H3 ~& h - static int ccnt = 8;
3 q4 ? ?; b K+ y- \$ U
& M1 j f$ p; t" k- D) V- module_param(acnt, int, S_IRUGO);
+ f2 C/ Q, m/ i, d2 j - module_param(bcnt, int, S_IRUGO);" x" J# n9 e) u! k
- module_param(ccnt, int, S_IRUGO);
复制代码
b, w# f7 Y( m! \1 u- L0 v' e$ [+ @1 S* A) M! c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ], `8 q5 {4 O; P' i% i5 g' E! C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K0 E+ p2 v& {4 X+ P1 p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 }1 X+ k9 F' r+ L# S: E
. b. o' h1 D2 I# H; p
9 _5 Y2 S# x9 ~5 { |
|