|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 C& b' f" d0 D9 a9 R1 b3 G
- [code]EDMA sample test application) P( _- Q. x* u& @% i, h7 o* o8 `
- /*
; Z% ^% K: m. A* Q0 t5 Z - * edma_test.c0 G; G2 w$ p- n% i
- *
: c' a! z; ~' g2 U, h - * brief EDMA3 Test Application! \! l T% g# T1 W* T
- *7 v l/ A- r) f' N1 V
- * This file contains EDMA3 Test code.
) D( T" H/ h/ Q; C6 [5 ~3 X( W - ** u! ]1 ^3 A, @: }% A0 w* d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 d; }+ {* t- Z# `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; n% f) I0 n8 t+ x$ o
- * TO CHANGE." j9 p& C2 u2 A0 k9 I8 |0 C
- *
3 n6 ^" O+ W$ d6 u5 u( q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 d2 ^$ E8 ?# h' ?" q - *, C, h4 T$ w7 O3 `# k" Q" o
- * This program is free software; you can redistribute it and/or7 P, ?, ^4 h% f. O# h [/ j
- * modify it under the terms of the GNU General Public License as
, X" r) H: p* u" s5 w2 F0 `) X - * published by the Free Software Foundation version 2.
, V! s; h# X# }8 |( q& l0 L& I7 w: t4 H - */ @) p2 g; a* A. D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# H9 X; l$ ?$ G. v9 c Q2 O2 g - * kind, whether express or implied; without even the implied warranty( c/ E. m/ e9 I! E5 U7 Z$ k) r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 z- J( m: H1 ~# V, }+ U3 j
- * GNU General Public License for more details.
: O$ w5 ~5 L# E - */
. d# i7 ]; m" s- |6 v2 }9 s
1 A. e5 d7 M, F7 Z) v+ y# s- #include <linux/module.h>$ @; M A. L, X5 a
- #include <linux/init.h>
* @: A" x6 m1 @ - #include <linux/errno.h>' c4 I. o& K$ A, X! h) _' a8 T/ F( f- y
- #include <linux/types.h>
7 h3 @0 W8 \! L* I$ u: ? - #include <linux/interrupt.h>
. ?) m: R0 f" M: N$ m1 G1 b6 f/ q - #include <asm/io.h>6 {! W% C' e- o3 d) Y
- #include <linux/moduleparam.h>
; T; Y. K8 u# E - #include <linux/sysctl.h>1 @, x( g ?0 o! L9 s0 {8 y
- #include <linux/mm.h>5 v9 ]1 o0 P* @ |1 v
- #include <linux/dma-mapping.h>4 d" \# R; V# j9 g" x
* b" [, i0 D9 i& f+ ?3 m- #include <mach/memory.h>
2 b* o4 k9 E7 {1 h - #include <mach/hardware.h>
9 R& H' U5 |3 U4 v9 b - #include <mach/irqs.h>
/ k3 x9 v6 {, W, U& v - #include <asm/hardware/edma.h>
2 a7 U" a+ T6 U, |7 {+ Z - + k4 O# v, l& i5 F
- #undef EDMA3_DEBUG5 c/ P. @, J& U" a
- /*#define EDMA3_DEBUG*/
8 t- X: ]7 P0 A0 y* ^ - 7 o: I3 X6 i$ u8 t! |& i
- #ifdef EDMA3_DEBUG
Q& W$ ~" r7 V3 v. b2 ]/ k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) D% t3 |8 L5 {7 J; O/ X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 W5 I' |7 V$ ?9 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" e; x, X4 x b. Q8 a% { - #else, n/ S- @3 L5 I" K S% T1 Q+ A8 b
- #define DMA_PRINTK( x... )3 O5 o" o" C: l: F5 D
- #define DMA_FN_IN4 f( z! C* o) V, Z
- #define DMA_FN_OUT( W6 n7 r3 b% a( O/ p9 P0 L
- #endif( i4 r* e$ J: o8 h; X5 D, _, v
- 5 s/ ]" ]" E# }3 X6 Q- U) H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) J+ A5 c, P" H. G/ S& t _
- #define STATIC_SHIFT 3
: J. b% p6 V3 ~$ ]) u" T9 t - #define TCINTEN_SHIFT 20
5 w2 w0 D- W( i+ K' D* n; ]/ M - #define ITCINTEN_SHIFT 21/ f; Q6 A" S6 ?! S
- #define TCCHEN_SHIFT 22
" _. d' v& G2 A! x' E% r- n - #define ITCCHEN_SHIFT 23
+ A$ N% Z% L9 V: k - 3 s3 { J8 ?$ X! y* E* X
- static volatile int irqraised1 = 0;
* H# N/ l& l; ]- F! Q4 I0 _ - static volatile int irqraised2 = 0;6 u4 M' l; }! l! `' C' Y0 ?! H
- # ^5 W" B' g6 i1 K U h" { Y+ N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! I$ ~ ^( {2 @( G9 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ I1 D. B/ M5 ^! W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) F9 L- J/ p2 r( i7 z' ~
6 U; c, c$ p' e/ i |! P0 n- dma_addr_t dmaphyssrc1 = 0;7 R5 }9 ]- W7 R1 h5 v
- dma_addr_t dmaphyssrc2 = 0;2 H9 t' v" n w( B5 H# D
- dma_addr_t dmaphysdest1 = 0;' x2 i& L% V# R ~9 F4 r
- dma_addr_t dmaphysdest2 = 0;/ u+ ]8 R {# @, {/ L7 P" C% ^# r r
+ g- X6 r n2 q4 G, q ?- char *dmabufsrc1 = NULL;
: o+ Z! E) M7 C9 n% V - char *dmabufsrc2 = NULL;
7 {7 `; s$ [$ l* ] - char *dmabufdest1 = NULL;/ N% s5 J! V/ R5 V! A
- char *dmabufdest2 = NULL;1 u! a: t: H( s1 N& J( S$ _; I
( t& }$ c1 u Q9 k- static int acnt = 512;
: u4 }' R( `; ]+ L( S7 T0 H - static int bcnt = 8;
7 Q; X0 @4 g8 w7 i+ H* Y9 g - static int ccnt = 8;
" G0 o9 n/ |) e - 1 m/ E. g! u _: G! L! C
- module_param(acnt, int, S_IRUGO);* E1 \: D) c/ Z0 a- t% O1 k. T
- module_param(bcnt, int, S_IRUGO);0 D5 U8 R% t2 x6 F9 ^( s% y
- module_param(ccnt, int, S_IRUGO);
复制代码 ' I' H8 U' Y8 f& q' g' M* o% \* q, S
- z. P& I$ b! k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ]5 i1 |2 i/ p% g( f. 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 K+ P: f0 s# Q; l+ [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% [$ M6 A" \0 y/ g
. \: s8 ~5 z, q: ]' y* e4 Q5 b% i2 @; b: N, m! a, X
|
|