|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % q: G/ U8 a+ }
- [code]EDMA sample test application0 i: ?7 C! x' o% o: r: V5 y* x
- /*
4 [1 k" k) ?% N7 q6 e4 F0 w* f - * edma_test.c
/ x* O! ]4 i8 e" O1 d& Y; Y7 | - *6 L3 ]6 t, ?+ g$ L6 Q: X' C1 n
- * brief EDMA3 Test Application$ @) ^ l2 B6 a' T% Q
- *
# U U) y5 }$ |9 I$ Z; ~ - * This file contains EDMA3 Test code.5 d. N+ u' [8 H7 J( G, |& x
- *6 L9 i4 n. S2 ~- i$ o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, b# u* _% x1 B: G& K0 b5 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ O2 z/ L5 g: x% A - * TO CHANGE.
1 D3 \1 {2 | n7 O% J3 c6 o4 P; X" j - *; v# q- s# |) a" |$ m4 M+ F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 T. N) p3 |7 ~
- *$ Y& m* `' k3 [- u: `
- * This program is free software; you can redistribute it and/or
& P/ R$ @1 ?+ L+ a; t; Y# u, l - * modify it under the terms of the GNU General Public License as
- U$ S; i4 l: b* r) q. w - * published by the Free Software Foundation version 2.( |3 @8 L6 e7 {
- *
7 |! q) T/ D5 C& R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( T0 N/ N! u2 L9 s* i: N0 H
- * kind, whether express or implied; without even the implied warranty
4 A1 T- u! \. ^; F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the k w" S8 Z+ M) C5 k
- * GNU General Public License for more details.
. f7 \: A/ S& `! z# b7 @ - */
C' z& W2 @! M
( t9 j1 X7 V. R; Z- #include <linux/module.h>3 V: W, _ C6 J( ?$ ], ?3 G1 f& t
- #include <linux/init.h>
. I4 Y* e% z7 Q - #include <linux/errno.h>
$ P% \ b Z4 l; C8 `1 D/ s. L - #include <linux/types.h>
0 N9 n1 t8 s1 z# Z- P8 ?( h! ~* J - #include <linux/interrupt.h>* v% G" T! p3 x) c1 H, b
- #include <asm/io.h>
& U7 Z+ n a w3 F! |6 F - #include <linux/moduleparam.h>
v7 T. `2 F" B, D$ | - #include <linux/sysctl.h>- a/ J8 C J1 E' }1 x% A5 P/ U) m
- #include <linux/mm.h>
# k3 ?7 B( Z. ^; @& X6 ?& r1 a - #include <linux/dma-mapping.h>
4 w- {3 [( } n - . Z2 a/ W" I( k* j
- #include <mach/memory.h>5 G2 |: S6 N; I( J
- #include <mach/hardware.h>
8 \" `# o) n% i' Y) ^! v - #include <mach/irqs.h>" I$ H7 I8 H& L, E* n9 ^
- #include <asm/hardware/edma.h>$ X* w0 n7 v0 x& V0 |6 K* }
- , S9 V* N6 ?( t! a. R' n2 y* x
- #undef EDMA3_DEBUG, d1 f1 b* U& I
- /*#define EDMA3_DEBUG*/ y4 b$ V& ?( t' | U( u4 D
6 x& {* [+ Z0 f+ w, c- #ifdef EDMA3_DEBUG
$ H9 x, h' d5 y# a9 _" I3 p# J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 Z* E% p/ l9 P4 d" W3 @2 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 U, W- v) ^4 C6 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
u! J* i! J: P I5 S* K; q - #else8 j% X& @+ N9 \+ O1 H& ~& K) L
- #define DMA_PRINTK( x... )
( k% G& m2 r* F2 t - #define DMA_FN_IN' Y+ ~0 D7 a5 b. Z2 ?8 y8 ^; u
- #define DMA_FN_OUT/ _& R* R$ s7 l4 y' j
- #endif
6 }$ v! M" T2 Z% W! R: h - * O* r$ t2 ^" \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" L, M4 T7 p9 Q7 B9 e* o
- #define STATIC_SHIFT 3
( {- g; O' y( g2 @/ g - #define TCINTEN_SHIFT 201 Y" {3 n3 a9 L; m! ], R, ?6 ]4 k" J
- #define ITCINTEN_SHIFT 21
Y1 G4 ^3 }. E0 I4 A; x, Q - #define TCCHEN_SHIFT 22: P4 K$ [. w7 h# ~0 ~
- #define ITCCHEN_SHIFT 23
+ V- c* X. Q# e - , q# U3 E3 B6 ~
- static volatile int irqraised1 = 0;
! i- Y; U0 ]4 G) a# Z* H- a - static volatile int irqraised2 = 0;
5 S/ r6 N4 R- w; X8 ] - 8 G1 P3 j1 b7 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Y, V: f% I3 Q3 O, d0 I/ d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) r/ D- _0 y8 r' u2 Q+ e7 q# _8 o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o( K. `, ~9 W; G% r' Q
- 6 B" h% P& g% m/ |8 f
- dma_addr_t dmaphyssrc1 = 0;2 N* {) m& K( B l
- dma_addr_t dmaphyssrc2 = 0;
1 ?) `5 }2 T2 P# y$ B! D1 ? R$ Q - dma_addr_t dmaphysdest1 = 0;3 G' e, n8 c, c
- dma_addr_t dmaphysdest2 = 0;
! j1 h; A% ^- G4 L8 e+ e - % H# W/ Y' m1 g. \8 D: j! X
- char *dmabufsrc1 = NULL;
7 }0 q) s3 L. e7 I - char *dmabufsrc2 = NULL;$ c2 n8 k9 m k6 N
- char *dmabufdest1 = NULL;2 o0 Z5 O5 ]% S W
- char *dmabufdest2 = NULL;4 V- T1 A# X" d
- + K( K4 N4 Q6 m ~% K& m
- static int acnt = 512;
. K0 o- L& x, b' m, v, B3 A& ] - static int bcnt = 8;1 y: K* n0 F# d4 q8 P7 H& |; _
- static int ccnt = 8;
6 N* I1 }' B5 |( L
) r7 p; ]6 M4 u+ ~8 G- module_param(acnt, int, S_IRUGO);5 l4 P# o, ]( K# {( x" w# D7 ^
- module_param(bcnt, int, S_IRUGO);% ?- l+ B5 ]; v+ }: g* t6 e
- module_param(ccnt, int, S_IRUGO);
复制代码 6 E! x" N9 ~ Y# A% ~& v
3 q. d% x' X; }8 }) x- B5 f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" {" i/ D$ j7 O: i" Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 _2 t9 g- X! A* x; j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" ?8 l, y9 s/ [
; b" Y( A4 E* A3 [( V4 @' c& q+ ~+ M( v, W( D6 y4 b) Z8 T
|
|