|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) I, L0 D' l/ P9 R0 J2 g
- [code]EDMA sample test application! A, a6 Q- h& g6 h! e+ }4 `: Q
- /*
6 y5 |8 v: z+ L - * edma_test.c3 V7 J- U, V0 V ~
- *$ @# C: D* ? x' ]2 ^9 e" u7 J4 W+ N
- * brief EDMA3 Test Application
$ F, G4 c/ S8 v" p: } - *6 m+ v7 m; ?9 p" R
- * This file contains EDMA3 Test code." g' {: o+ l1 \9 D
- *
) B4 }1 k9 [( Q9 I4 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. z1 x& j& Y3 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 h9 w& M$ x* {2 O4 h1 Y - * TO CHANGE.
& V" c- s, [* t- ` - */ Q4 K" y9 k& e2 P2 {# J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ y: R) \* d, a
- *
5 m; \4 t+ W4 e - * This program is free software; you can redistribute it and/or
3 q. U/ e, b! S, E4 w% W - * modify it under the terms of the GNU General Public License as
6 P l0 `5 i# y1 _ - * published by the Free Software Foundation version 2.$ h8 r9 d; B- c$ y+ k
- *+ }& u5 W) ~8 l' Q3 M" l6 G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) k# O6 z* X" K( g1 |2 l- ? R# ]5 ?
- * kind, whether express or implied; without even the implied warranty
( o L% d6 Q) o* c2 k/ y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# w) j, j2 x$ ]1 k# A - * GNU General Public License for more details.
0 X6 h0 p0 B6 g( O' t6 g - */
+ ?9 o$ J- q( }: N; ~& l% Y - 5 r, [4 X8 T8 H# a' ?. q
- #include <linux/module.h>
* n% b6 e* g( [% l4 c8 a& G9 ^9 A - #include <linux/init.h>! _' x! L6 o1 K
- #include <linux/errno.h>$ U, O- k A2 }# x8 u$ g
- #include <linux/types.h>2 K$ ?, m% Q7 r+ q1 l' B' U
- #include <linux/interrupt.h>& j& Z0 \- @# ~9 Q S8 u
- #include <asm/io.h>
! q5 B* b. l6 A - #include <linux/moduleparam.h>! x/ b0 W7 Q: k2 X$ x2 G
- #include <linux/sysctl.h>
: J8 q8 z* L0 b! ~% ] - #include <linux/mm.h>3 a$ n) O# ^( q
- #include <linux/dma-mapping.h>
. ^$ g" K0 |9 _ - # L% s- R) g! w0 U
- #include <mach/memory.h>2 Y& o' o) \2 [
- #include <mach/hardware.h>
8 E! X7 j( g' i+ q8 ~- E' G7 |. F - #include <mach/irqs.h>
! X, U2 s3 r. [/ F - #include <asm/hardware/edma.h>9 {/ M; n' G, {- ?5 e: P$ q9 V
- 2 k! D- q. S6 `8 J% [
- #undef EDMA3_DEBUG
# F! B' w& z. I8 H' g - /*#define EDMA3_DEBUG*/% M5 A$ ^6 V1 f
: [1 t: J: k& T. V+ B K& U- #ifdef EDMA3_DEBUG, w* d8 c1 F0 r& @+ J4 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ B: H. F4 e6 |) W" T: I! K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ a, Y4 j$ b) h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 v4 T) e; R8 a @4 [5 T - #else+ `6 H. H2 e% b+ @
- #define DMA_PRINTK( x... )
0 V+ b: `) k7 I. ~$ O6 f" x8 o - #define DMA_FN_IN
3 k8 f2 z. X! }& P/ j* {+ ` - #define DMA_FN_OUT
7 s2 {( s9 Y5 I! g - #endif
$ O+ j8 Z- s7 z/ b% ~9 }* C# m" `
! L0 j- P* F% C$ w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# g) r0 q* }2 \4 y: N0 B: m* V
- #define STATIC_SHIFT 3. f1 y6 D; i5 O. O4 R( e
- #define TCINTEN_SHIFT 20
7 _9 O d4 \" y) z3 B7 y - #define ITCINTEN_SHIFT 213 V: Y2 p( v8 l: A( j4 i
- #define TCCHEN_SHIFT 223 H4 \% R8 a t- f$ D: x
- #define ITCCHEN_SHIFT 23
& c) \- `. L( ~ r+ o
. }3 g4 K5 M& T- static volatile int irqraised1 = 0;
8 R! M q/ R0 m: y" X - static volatile int irqraised2 = 0;
, S( z% X5 l4 \ L3 X
' o. ? U+ A0 {- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D/ S9 F6 |9 K0 ^: N7 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# {6 E) b, s7 [2 E" D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- q) i+ y7 P1 n: h) m/ N; m
6 k. P: ?/ i; F( y: C r- dma_addr_t dmaphyssrc1 = 0;% P! V6 ?2 ]8 q2 Z, g( k
- dma_addr_t dmaphyssrc2 = 0;- j6 @4 m. t: t* @5 I3 d
- dma_addr_t dmaphysdest1 = 0;) L. t/ j+ ~- ]! A* A' W- _3 X
- dma_addr_t dmaphysdest2 = 0;
3 f- V; q' x; a) ^- B
0 s" k& @9 x, ^/ J k9 }$ W# t, t- char *dmabufsrc1 = NULL;9 \; d6 ~0 y5 Y# z4 |" q; H
- char *dmabufsrc2 = NULL;
+ f& d% z- C% b1 _1 n8 M) e8 N - char *dmabufdest1 = NULL;
" Y% F+ m, F; v6 C) V- a - char *dmabufdest2 = NULL;
( ?7 ^3 n- |! {& |- x/ ~ - 6 Z. G) c& w( u5 W4 H* I$ z
- static int acnt = 512;+ m0 O$ a0 H9 A+ j% x
- static int bcnt = 8;% d- C. J) i% A+ I
- static int ccnt = 8;' J; n+ W/ I! Y! S
- : ?- n' V2 H- i: H
- module_param(acnt, int, S_IRUGO);) ]3 n' N Q; L- j- S
- module_param(bcnt, int, S_IRUGO);4 F4 B% ^& ]7 E M) R" C( a" o
- module_param(ccnt, int, S_IRUGO);
复制代码 ; u, {* c: E2 f b
1 f1 p0 c4 z0 g# X& {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 v& O' o3 w+ L8 v `- B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ k! [# R" P' O3 v" ]: D- J1 S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: A( u6 ^ `4 o. r: E5 ^) ]* K5 s* e! p2 _
6 M7 a0 ~2 z: ]' S0 s# N8 z
|
|