|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 e I6 T' Z9 r5 l/ `( o1 d
- [code]EDMA sample test application
5 F0 Y/ S) z3 o, }3 Q& l - /*
3 @( k/ o5 G% A" _ - * edma_test.c. D5 _+ f8 t W" x6 l9 c7 R
- *) h& `( I) Q2 z: g
- * brief EDMA3 Test Application
3 W6 Z* A2 H2 K6 T - *
' x {0 [ u& S! Q - * This file contains EDMA3 Test code.
2 D: K( O. b& q/ ^( t, C$ a - *5 n4 e, h: M- s( x, J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 K- b. a7 r p+ y7 |% X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 T% U- [ v1 J. F) _, p9 H
- * TO CHANGE. Z4 H" \# {* r$ V1 ^* E! `
- *
0 C/ D8 h& C% N H# b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, j1 W1 @' }. U4 u - *
3 I7 f5 ^8 [! k5 K+ b; B: P - * This program is free software; you can redistribute it and/or3 u6 B- J0 o3 v
- * modify it under the terms of the GNU General Public License as+ W2 M( E( f& j& H* ?1 t
- * published by the Free Software Foundation version 2.2 N( }/ b% P/ U( C
- *# Y6 b! m3 i* d' Z, E/ R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
v* l& i% e- z" z1 E - * kind, whether express or implied; without even the implied warranty/ X1 s O; d3 Y- k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; R$ Y# c, ?& w8 W1 v" g6 r
- * GNU General Public License for more details.
4 E/ @: L! l2 N/ S5 Z t( y - */
' w6 ~5 s6 T2 q3 e! i# N
7 I. A- V; L p; V- #include <linux/module.h>* i. c2 s$ r0 h% q7 f1 R( x6 I
- #include <linux/init.h>
4 B# F* G0 i& A3 f* v# p7 f - #include <linux/errno.h>: y6 G2 o; \- ?7 y
- #include <linux/types.h>2 k7 Q/ ]; x1 n( v) u
- #include <linux/interrupt.h>+ o. z! ^! h, Q1 U4 o1 T
- #include <asm/io.h>
5 G2 M+ T5 P& N4 S' W" ^- x4 x - #include <linux/moduleparam.h> u" n( e, [5 H& V* s9 \
- #include <linux/sysctl.h>
1 F- o! n5 ?0 O0 C7 l# ^1 v2 ` - #include <linux/mm.h>9 W: P6 h; a" q, A, K
- #include <linux/dma-mapping.h>+ }0 ~3 W9 e" `
( ^0 |+ W/ u! ]9 ] h, v- #include <mach/memory.h>- u! O4 S% o3 M0 }: p1 @& \+ _- o
- #include <mach/hardware.h>
, c' n5 g9 \) x$ N- \' M - #include <mach/irqs.h>- O% y8 @( E+ _% l8 r
- #include <asm/hardware/edma.h>
& B! A0 `5 ?* K, l; E/ `% q
! u- f* g6 |- W- #undef EDMA3_DEBUG I, A; S- o/ v& Y
- /*#define EDMA3_DEBUG*/
( N \5 R& u9 F4 Y4 {, u
+ B7 R1 x5 _! Y- #ifdef EDMA3_DEBUG m0 p' I7 k: v$ P4 ~: F3 q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). Y% d# t+ l3 m. L& A, Y3 L& g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! A7 o' B0 T! E# p6 ?( t6 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 `3 @ K% f0 M) `4 _7 \! Y9 d
- #else0 A, _, u! s8 ?- H3 r$ g0 k6 P
- #define DMA_PRINTK( x... )
' [7 f# d7 R# w) l - #define DMA_FN_IN
' K+ |4 J9 ^9 Q, R; g: e - #define DMA_FN_OUT% |3 c+ q2 a( |+ B. s0 Q- v
- #endif
+ S2 e! _4 m4 T. P: A - 2 e1 s: r# D( E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( @1 B, ` B* A) \ k! L: \ - #define STATIC_SHIFT 3
" L; p$ Y7 \: W - #define TCINTEN_SHIFT 20
& d8 M, y1 v, g0 m8 a - #define ITCINTEN_SHIFT 21* B9 I1 r0 ? I4 i
- #define TCCHEN_SHIFT 22
( _9 ^, g' _, d( U - #define ITCCHEN_SHIFT 237 H! J$ i0 Z+ e1 S6 E4 f( I& L
- 6 D# k1 I1 Q' \, r
- static volatile int irqraised1 = 0; ]$ ?! W( {$ }) x
- static volatile int irqraised2 = 0;* D8 f% \; ^" B, i9 X2 X
# t( b" L4 c# @5 K; L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 R$ C8 c- _, ~1 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" I! f) R" ~9 s8 n/ b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' b& r! B' ]- g& a/ k0 O
V3 p5 E; u4 P8 t, i- dma_addr_t dmaphyssrc1 = 0;
u8 i) D L3 C - dma_addr_t dmaphyssrc2 = 0;2 k9 k- S* q( K" c+ o1 m2 [: d: g; x
- dma_addr_t dmaphysdest1 = 0;+ A y f: V! S& ]0 Q" R
- dma_addr_t dmaphysdest2 = 0;
. A1 ^) r& x7 Q* ~9 j$ O - 0 q/ B/ I& o3 [5 d# E3 S4 M, M
- char *dmabufsrc1 = NULL;
7 [: F4 j% @% }! B' C$ s0 J - char *dmabufsrc2 = NULL;
! w+ [3 Q( o1 _' k - char *dmabufdest1 = NULL;
! k/ O, \3 y W1 Q, P M* u* J - char *dmabufdest2 = NULL;- I: t- k( I, J4 y
+ {* `" t7 Q/ j& i. E( S$ T2 \- static int acnt = 512;
- T: V9 S% e. e/ t9 ^5 Z. w: @ - static int bcnt = 8;
9 n& [7 e* T3 j, W- n/ ~ - static int ccnt = 8;' O/ w9 r ^) p/ c3 K# ~- [
- # |$ }/ u L$ E s: u6 r% B5 |1 R
- module_param(acnt, int, S_IRUGO);# Y; V) U g8 W8 c3 S6 @
- module_param(bcnt, int, S_IRUGO);
# v4 V( T2 Y9 C% r3 F - module_param(ccnt, int, S_IRUGO);
复制代码 * E, I3 f u9 O( `5 M& j: C% x( ~
& E( J& o3 s- U5 Q) ]7 b# d* b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# i1 G5 T; t2 _& E4 \: J/ Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ C# i, s/ c5 E- v. C- z: J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 d8 S* z; Y$ n# ]/ U5 c: V/ g% v/ _" {/ ]0 z
& J4 U D5 i' @
|
|