|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 X, |9 o. d3 Q, v+ C- [code]EDMA sample test application
; _/ g0 T. K3 N c2 t/ o+ a% W0 d - /*& R$ g* i6 G/ b( R0 }" p% j. d6 Y
- * edma_test.c8 K+ Y$ u, S+ E% ?( x! Y! e
- *3 o% ^+ _' \2 g' Q3 N' t
- * brief EDMA3 Test Application
F4 m: Q- m5 S; s! X, R - *
; Z7 Q$ ]* ?0 J, {4 I( ^ - * This file contains EDMA3 Test code.. @9 S# s- w5 p: }/ D) J1 A
- *& ` h; U( A; c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 U" V# A4 x0 X, b& {( p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: ^9 n3 N8 r, |2 F7 Q7 ]4 a" J- a
- * TO CHANGE.
. S8 o* J! W8 n - *
% J/ j+ W; W+ ^! ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// J: y4 P9 l( }. @+ x! ~- a7 t
- *, L3 ?4 Y( ^: F, J
- * This program is free software; you can redistribute it and/or1 O/ ]/ g4 A9 u) [
- * modify it under the terms of the GNU General Public License as
# F0 g8 O; \5 a$ Z9 C6 |6 F2 K/ u - * published by the Free Software Foundation version 2.2 T; x" w: c4 C7 G0 e
- *
2 {# X/ k' u- J% a6 y5 F/ D) y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any ?9 b1 V/ ?* x8 v: t* {5 e& A
- * kind, whether express or implied; without even the implied warranty
1 i. C/ _- ~2 G' Q6 U3 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 x+ U/ |( F( i! n- q0 [! Z) @ - * GNU General Public License for more details.
M" d+ B* n& M, } - */
% V% w; [ b$ G3 r0 C1 g
# J/ [* _' V- ^- #include <linux/module.h>- L4 \4 X6 L( G; V- E$ p) u( i
- #include <linux/init.h>1 b# _# } o' |9 F! E8 G0 G
- #include <linux/errno.h>
t8 Y2 s; Y6 o& F. b, x$ t - #include <linux/types.h>0 Q! k" W1 W, T* L! p
- #include <linux/interrupt.h>
2 ]; f" W0 G: S2 j6 c. n6 N/ i% q - #include <asm/io.h>1 ~* o7 j, ^. |* {) B
- #include <linux/moduleparam.h>
& s! v' J7 v; c% D, | - #include <linux/sysctl.h>
: c1 u6 X9 }4 t: U% I - #include <linux/mm.h>+ @: j* d& J' R3 D' e
- #include <linux/dma-mapping.h>& i! e: J, J1 N" }4 F1 y' M* }- t
- ; F+ O' D/ x0 O: [) X# `1 x4 [
- #include <mach/memory.h>5 m8 ]' L3 v3 i& b8 ~- m& R+ _
- #include <mach/hardware.h>% L. K' h) t" e
- #include <mach/irqs.h>) d- b ]% `) A4 Y) b' @
- #include <asm/hardware/edma.h>* @* x1 T7 p+ n, I1 R& E& }1 y
- 4 c' x9 W2 ]: a5 T$ S
- #undef EDMA3_DEBUG% C g; d* l" Y' {- r
- /*#define EDMA3_DEBUG*/
! c f3 Q4 ?1 Y9 Z. u0 } - ) |" }% G5 B2 N7 L/ J+ ^
- #ifdef EDMA3_DEBUG
. H/ K5 a8 g7 y4 x! n0 i' B. P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ^4 l% \) i- _" J C" V! Q7 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 u8 ~# a3 b2 ], C" T" [/ z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ x2 c J+ d8 ^1 A
- #else
5 @+ c0 H2 Y8 y- ]+ N - #define DMA_PRINTK( x... ), l# E# c) E4 g5 ]( L" E
- #define DMA_FN_IN* Z" Q' g( H5 H/ v6 P7 Z
- #define DMA_FN_OUT3 I8 ]: h9 K& ]4 q
- #endif
% x4 ]( @: L. Y
2 j! c5 F3 v" d& Y/ R# j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ h2 t* E& M/ g - #define STATIC_SHIFT 38 [1 i( h z- e. F
- #define TCINTEN_SHIFT 20
2 L+ t5 m9 `4 @7 l: m - #define ITCINTEN_SHIFT 216 l6 i# J$ e+ m' I( r) S0 o
- #define TCCHEN_SHIFT 22
1 b' c3 n! b1 m3 G: k - #define ITCCHEN_SHIFT 23( |; n( P0 e9 f& P
: u. Q+ \( h! H p; m0 v- static volatile int irqraised1 = 0;
8 L3 k/ e" l4 U/ U& S2 T - static volatile int irqraised2 = 0;
* S; f9 i/ ?9 x) x
5 ]& \8 \: s/ E9 ]$ y' \1 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% S( z* I% o) N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* p# @; j/ j7 O$ ]: j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 _; x4 ^: `# { - 0 j4 M( \* F- g4 X+ P7 r
- dma_addr_t dmaphyssrc1 = 0;
3 E) c0 j& M: f# C - dma_addr_t dmaphyssrc2 = 0;2 m# c( X$ E" u
- dma_addr_t dmaphysdest1 = 0;2 P2 C2 I4 g% \2 c5 H7 l8 \
- dma_addr_t dmaphysdest2 = 0;3 k& r1 B( h$ t0 @
5 d" ~4 {7 q+ p0 X3 m5 I" ]- char *dmabufsrc1 = NULL;
% H+ a* S+ Q' {5 o - char *dmabufsrc2 = NULL;" i2 }' B2 M# P" c
- char *dmabufdest1 = NULL;, e! ?% m9 g7 B e( E
- char *dmabufdest2 = NULL;
+ T# g" \, X9 U
5 `: _0 p4 n: q1 \- static int acnt = 512;
/ N0 c: F% i5 r5 [, C* G% b - static int bcnt = 8;
- T$ v9 J, w" c: S2 [ - static int ccnt = 8;( v8 \+ N1 d% d
- $ r+ f% v% J( O) d9 u. b4 i
- module_param(acnt, int, S_IRUGO);
9 L; ^; v8 z! v. y# N - module_param(bcnt, int, S_IRUGO);/ s2 z% N- _1 `$ r( D
- module_param(ccnt, int, S_IRUGO);
复制代码
7 z0 |1 ^; u8 d) s h
3 R' e7 k. f/ ?) @$ U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& C1 a+ x q# ^6 L* }( \. V$ u3 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# q5 G6 n* k/ S x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 j f/ A8 Q# w5 b
# e' M6 F: N/ g( r# E6 z5 c4 d/ x: B0 z P7 l& b1 p4 D
|
|