|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* q; L/ \9 O @! ]! d- [code]EDMA sample test application( `+ v' V: s* L2 K6 _0 h, \5 c
- /*
" ?% n. `/ d3 t) R( R - * edma_test.c! n- H1 q3 j& u9 F4 \
- *
4 ~! x; T+ M; } - * brief EDMA3 Test Application
/ S4 _6 `. k- N& _/ z4 q' h9 c+ t - *
2 h, K/ @7 G2 P( S8 b" U* n) v9 T - * This file contains EDMA3 Test code.
8 W* W; S) X6 h& F$ R- u - *! g1 B3 g8 T* \9 [ a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* @# g1 b: R6 o2 w8 l6 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 q" O8 }' n2 _( d' M - * TO CHANGE.& {0 V( p1 ?- h, ]' W4 I; r+ _" S8 G
- *1 b( A) O0 d4 R. R7 b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 Q- ~1 w, o+ {; g8 V
- *
& c, v9 w4 b' |8 S3 L4 N, s* w1 p2 v - * This program is free software; you can redistribute it and/or
& S c/ y4 T# Q* R) E" Q - * modify it under the terms of the GNU General Public License as
/ r: t* Z) G# c9 v - * published by the Free Software Foundation version 2.. G! a$ R% w4 p. y; {
- *
! e8 s2 d8 ?& x# p! }. t4 u/ w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. X2 k# p& [; D. R
- * kind, whether express or implied; without even the implied warranty
3 N0 q6 P8 D- y) T; F& J3 q( q% t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! X8 a X6 P+ X H5 p. e% H) \# j - * GNU General Public License for more details.$ N2 ?% d( h* }& t; k3 \
- */! y4 ^/ a x/ d
& Q4 A8 r# |$ t6 F0 r2 v2 t- #include <linux/module.h>1 n& }. b7 a9 w3 x
- #include <linux/init.h>
" L! y. ?3 D5 J: u - #include <linux/errno.h>
% h4 C1 Q7 m: ^- ` - #include <linux/types.h>5 u i: N2 s* D3 x8 [
- #include <linux/interrupt.h>
) q/ E: g9 d% b. g1 S - #include <asm/io.h>
6 ^1 u" u* ~* J% M - #include <linux/moduleparam.h>1 n6 H% Q1 ]1 x' n. i
- #include <linux/sysctl.h>
' T4 e/ _! H& R5 f0 k9 c7 W - #include <linux/mm.h>
& }; i! k7 C. d: O& J4 q9 c - #include <linux/dma-mapping.h>
& y8 W2 j9 w/ Y% C/ Q
" [- b. K9 b2 L5 o' }- #include <mach/memory.h>; y- r9 J: Z4 @, \, s7 E
- #include <mach/hardware.h>) Z5 h w# u! J+ u' i/ C- ~
- #include <mach/irqs.h>
! Q% R; q8 m z - #include <asm/hardware/edma.h>3 x1 i; ^7 v' B
- ( d( A! l$ Q( E/ } g
- #undef EDMA3_DEBUG
2 x9 F3 I8 V7 Q1 b - /*#define EDMA3_DEBUG*/5 l+ c! D% D! Q
- . `% q9 M1 o- {" ]/ @& T
- #ifdef EDMA3_DEBUG
$ M4 j3 T1 t" v$ k: I; C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), u: ~: r* Y, ?8 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; Y. n, z/ V$ t# ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) N/ k, S8 T, K1 m l
- #else1 S% T/ P: }1 ]1 ~' ^
- #define DMA_PRINTK( x... )% r8 M) j, _3 l( H5 ?
- #define DMA_FN_IN
8 E4 x/ N8 f7 V8 Y. k+ T - #define DMA_FN_OUT2 _6 Z: R1 ]) p
- #endif
- R# H, J' U. V% o: ?
8 ~/ O9 h) S; ?# W! B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ v: [8 g4 z" U" K. H1 P0 P - #define STATIC_SHIFT 3! R0 W0 k" ~* ?' P' C, z
- #define TCINTEN_SHIFT 20% j7 b1 e3 t! y
- #define ITCINTEN_SHIFT 21* y' m5 C, c* W) e" l+ n
- #define TCCHEN_SHIFT 22
6 f2 ~! P o5 `# c - #define ITCCHEN_SHIFT 23
( b) k5 P, s) m - ! r. P: a, W. o& j6 [! V/ t
- static volatile int irqraised1 = 0;
; ^ j( F( c* q - static volatile int irqraised2 = 0;
2 {5 G6 g9 T. J0 c" ` - 4 Q, J4 [4 G; ]1 w o* i1 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 z) E# \( |, x2 o+ N. K' \2 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; _3 l J6 [( @. E3 x1 T* v2 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t( c6 j. V4 e( b: ^- z
- k" z9 b8 n' ^0 u5 m
- dma_addr_t dmaphyssrc1 = 0;
. n# k. h4 x: l! J - dma_addr_t dmaphyssrc2 = 0;6 ~8 u6 N8 D1 A; ^
- dma_addr_t dmaphysdest1 = 0;
, g+ v+ J! Q' t7 Q- r - dma_addr_t dmaphysdest2 = 0;
3 F1 `! ~9 y- ]7 J' Q6 P9 ~; H7 _ - % P, |9 r% J0 _) G4 ]; K4 M
- char *dmabufsrc1 = NULL;$ T* l: \4 g- A2 i3 i; y/ N
- char *dmabufsrc2 = NULL;
1 p }. y8 H+ y/ x" B - char *dmabufdest1 = NULL;0 l$ ]5 w4 d2 m4 H/ w& q7 \
- char *dmabufdest2 = NULL;" S2 |1 f4 \" |& l) H
% K' @* I& F0 _8 ]" S- static int acnt = 512;$ L: R! `! t4 O& D- n" |/ v$ O T
- static int bcnt = 8;
, _: A; u2 O2 ?) L9 A" D" c; M - static int ccnt = 8;
- H0 Q9 E* @# l, J {. P& R - l) A9 T% b* l$ H: i# L0 n- I
- module_param(acnt, int, S_IRUGO);
0 l( d$ _7 S4 f1 b& y+ o: N+ u. n) f - module_param(bcnt, int, S_IRUGO);' Y+ I; m; {8 T/ {% D, T- i9 D
- module_param(ccnt, int, S_IRUGO);
复制代码
2 j# A4 v$ q% O/ K9 z) E3 y$ }4 E# K. d- x- |1 p0 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( H& s. F# ^# W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 H+ t4 \: e9 R9 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; s4 m) E p9 M/ a* q- w
- @; J# @) I1 I5 e& ~& b2 }% G
6 L* q7 f4 F c- h P5 `' J8 N |
|