|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ A; h5 ~" t$ ]% H- [code]EDMA sample test application
) a5 q" | M! ]9 ?7 c6 I" G8 q" O5 n - /*
. i7 Y0 F! q7 b7 u6 O, i - * edma_test.c
- N6 N% D' S1 S$ q6 x1 [ - *0 O ?; {* q9 C5 w( ?
- * brief EDMA3 Test Application! i# T( [8 i3 Q$ L5 i) N' N4 b
- *$ O0 ]' r8 D% s6 x- g) ^ \( Z
- * This file contains EDMA3 Test code. y& K! |8 B* o2 S* i+ h s
- *
Q& {% a7 N- Y( z, k% w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( S& F9 _; K( Z5 d9 M! Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 M+ V% K2 T. K - * TO CHANGE.
: [7 ~( }0 u0 ^* _* |5 g - *
- K0 l# R: w9 o. n- O% x h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 w+ F& P7 Z" ^$ ]
- *
. g$ l8 K' e8 u4 T) E- g" ?! N; i k- h - * This program is free software; you can redistribute it and/or9 r% L% H5 ?- Z% }- W% P/ B
- * modify it under the terms of the GNU General Public License as
/ F) E3 A9 m7 }) u- k# m' L - * published by the Free Software Foundation version 2.
R5 v! a4 Z* J3 g& i1 g - *
6 ^+ F+ t1 ~$ u y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; g) m4 O. N, l% S, W) i9 V - * kind, whether express or implied; without even the implied warranty
9 A$ j G' q! [* R7 O; u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 L$ [3 b$ c d' y
- * GNU General Public License for more details.; r7 F8 ~- A8 T) U/ S( @% X
- */
, l0 ?+ \/ C X) M, Q6 E - . x: ~; U! L8 l2 s
- #include <linux/module.h>0 q! K! R1 f$ e1 Y
- #include <linux/init.h>
/ \ r: ~) r" B) H- x" F/ T8 D; u - #include <linux/errno.h>
1 m3 _) I8 M9 w" V, E - #include <linux/types.h>
% e, ]5 W4 [8 r+ @) U x; q1 U, [ - #include <linux/interrupt.h>- Y# s! x: G) ]" s+ Q$ l9 @' {
- #include <asm/io.h>% N7 V- U3 S2 U, d/ v
- #include <linux/moduleparam.h>
. H% l1 N' D, V3 H% [. G - #include <linux/sysctl.h>, {& ?4 \* S I; D
- #include <linux/mm.h>
3 l6 `, y' C7 c+ H3 z - #include <linux/dma-mapping.h>
) \0 ]( F2 F5 G5 v1 k* m) S* F5 z+ ] - 1 ^) @0 m% [" H6 D
- #include <mach/memory.h>1 ]/ d, R6 V" \6 i* d1 l5 M: T8 X
- #include <mach/hardware.h> `& q/ |5 X, w: ~
- #include <mach/irqs.h>
6 m) j, t- G0 w' U9 x) y - #include <asm/hardware/edma.h>
9 n5 F- w% t$ x7 k
9 y) @: ^6 U d R6 f- #undef EDMA3_DEBUG
5 U' n5 z( ?! U% ] - /*#define EDMA3_DEBUG*/
7 z% [2 V, u6 g
# g3 F5 y$ x; x$ \- #ifdef EDMA3_DEBUG# u, h! o9 W+ ^% ^( d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 L$ S; f) @% j! V* n* h% ~5 s8 g: P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 N( c5 T5 o5 L% h2 C5 o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 z: G% ~% B; u, H1 n
- #else- j' [9 v- ?& E. g6 o1 O8 Z! `
- #define DMA_PRINTK( x... )- |) R2 ^- Z. J; N7 t
- #define DMA_FN_IN a* D+ g& N' G1 Y/ S) p, f
- #define DMA_FN_OUT2 D6 W: [$ d' E8 A$ X. U
- #endif
) V0 T, X8 e. O. J1 U
* @% C* J9 q' |. k3 g u' e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 y( Y8 Q0 O3 D. t; E
- #define STATIC_SHIFT 30 K3 ]% Z8 y" J& s1 R6 P. ^
- #define TCINTEN_SHIFT 20% _7 _2 b* ^1 c& E% M: c
- #define ITCINTEN_SHIFT 215 x6 p- Q) g. `' S$ @
- #define TCCHEN_SHIFT 22$ ^: R6 l) E/ W+ S" T4 ?
- #define ITCCHEN_SHIFT 23
$ e; {& l- U; d0 z2 r
. f' |; a! g* w8 t y/ N! n- static volatile int irqraised1 = 0;
& b5 Q; J* b: R& v; W& L7 Z0 ` - static volatile int irqraised2 = 0;; M9 \1 L) n: T
: P+ A& u; V0 K" e) s; G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 G7 Z* F8 m! K% j$ t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 x2 C8 @3 F+ j9 q. B, [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# w! X/ R& J: q - 9 p9 `0 E: l5 a
- dma_addr_t dmaphyssrc1 = 0;) f, B4 p) a, `' X. G3 X1 k& m
- dma_addr_t dmaphyssrc2 = 0;5 l0 C. H# j8 ]4 c
- dma_addr_t dmaphysdest1 = 0;
+ c( n/ y- B2 p' M( l2 q - dma_addr_t dmaphysdest2 = 0;1 B' y* `& F; h9 G+ q! H- C e% z
1 o& t0 {' P% _1 q$ Y- char *dmabufsrc1 = NULL;( Y% n) F$ M6 p" z4 L1 A
- char *dmabufsrc2 = NULL;
5 X6 J+ ~, P$ Q: O5 W9 m6 N: Y; J - char *dmabufdest1 = NULL;
. r, P g9 b+ N f O - char *dmabufdest2 = NULL;
. Q* Y' _/ f/ a' i% E$ O* {! O - 8 {1 j O d. F
- static int acnt = 512;5 f. r: R7 Z: l) E9 |( \0 y6 t
- static int bcnt = 8;
% k3 [9 _0 R* b8 |, ~9 L - static int ccnt = 8;
: k" p( G- ?4 R0 r7 j. y7 U3 \ - ) u2 g) Z6 m% p7 N, I( a- n) B: U
- module_param(acnt, int, S_IRUGO);
# Y/ h9 q' G! M; v - module_param(bcnt, int, S_IRUGO);
: {; j9 R+ ]. {2 L5 |* L - module_param(ccnt, int, S_IRUGO);
复制代码
1 g, i$ `( j S y) O8 g
0 u. J9 p b- ^2 O9 `; d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! s C1 s% Q) ?! T% [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- h: i1 r: R4 f/ U( y' b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" e! l- P$ h) S0 C, D; L0 J4 k8 X( [! d& h" ~8 t/ R
I: J, H) x9 e$ S' ?8 X! F |
|