|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ]% W0 K# }* c2 @+ |' Z0 w- [code]EDMA sample test application
9 ?( N0 h& I5 |' l- n3 H6 v - /*
: W$ |9 h1 U7 [. d5 D D& j+ O; T - * edma_test.c# E d- x& M' ^
- *
+ _, a. V( G8 V2 @2 k - * brief EDMA3 Test Application$ D* x: N( ?5 l
- *
5 q" O) P( o6 Y- |7 | - * This file contains EDMA3 Test code.2 m5 {2 v. T/ K. I8 L0 @
- *1 F7 c* w# V0 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. |* S4 X2 D& `# Y+ a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% }% w: t: A. Y9 G1 L - * TO CHANGE." J# @9 O: a A2 |3 a
- *+ V0 d/ w5 G7 Y" W2 X+ ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 x% J, g- \+ S+ w! o* Z! k) J0 m* [ - *
- _& T$ m. I3 O* }6 b% }& V8 v - * This program is free software; you can redistribute it and/or9 l, Q& d' I/ W) b- M# E
- * modify it under the terms of the GNU General Public License as
+ B: c) S) c- ~8 Q! q( m: w - * published by the Free Software Foundation version 2.6 D4 D7 F `3 a! J) R
- *8 U# e0 [: n" H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Y4 L3 }3 Y7 Y; {9 P
- * kind, whether express or implied; without even the implied warranty# o; p- Z) ]; o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& I J7 \( T4 i5 E* v" ` - * GNU General Public License for more details.
& Y1 C/ f u( @. J; p( b - */
5 u" ^& V) m: R - 0 r8 R, I @$ j1 x
- #include <linux/module.h>
) x/ L9 L* s! ^: ^( u4 a G4 Y - #include <linux/init.h># y, z5 D) O# W( I: a+ |& x, D
- #include <linux/errno.h>
( |) f5 [ K( R# z' P$ b& O - #include <linux/types.h>7 `7 c1 z E) P- T* ?
- #include <linux/interrupt.h>9 M4 C( ~) {9 m! O: n
- #include <asm/io.h>- U6 z! V* ]. ^- ^0 ^" C
- #include <linux/moduleparam.h>
& N" g) b6 F! m8 K - #include <linux/sysctl.h>
: r: V& @, k0 J' s) ]% l - #include <linux/mm.h>
# ?) }& V* x" h3 w# d' h - #include <linux/dma-mapping.h>( @& ]/ z' Y4 n; ^6 z3 Q
5 l/ [2 D5 e6 l# P- #include <mach/memory.h>
" i/ b( ] e6 m) S5 ] - #include <mach/hardware.h>2 Q$ O7 Z( |" o* h. `
- #include <mach/irqs.h>
- R% Y0 f! I1 Y3 k - #include <asm/hardware/edma.h>
/ f, @% `* @/ T! [$ h: Y
2 l1 u9 [- K: u- #undef EDMA3_DEBUG
: D- r+ u6 t* a) N& O7 n - /*#define EDMA3_DEBUG*/
k5 O' O1 L* j) b8 r' W( e
3 T) l5 [& y. o/ K% v/ r% I" h- #ifdef EDMA3_DEBUG
+ N' y& f9 O% K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): @' @; L7 r, `$ Y, q6 B. N& V* H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 H1 J9 m2 {! G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 V3 m& b' g% s; Z - #else
# P& N4 L2 n9 J - #define DMA_PRINTK( x... )* z9 X( S' I& t5 S6 U# s
- #define DMA_FN_IN* [5 O& J0 N+ y$ U/ m0 s. G
- #define DMA_FN_OUT) G: |8 C, t( N$ p
- #endif
8 e8 P+ [9 P7 X6 k
; K7 ~3 \. {2 p2 k) b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% H7 z! F3 K; v2 N- z
- #define STATIC_SHIFT 3% S9 T8 m5 _$ i
- #define TCINTEN_SHIFT 20" q* s# U8 L5 r" h4 b3 X, g6 k
- #define ITCINTEN_SHIFT 21
2 H! R0 s _% g B/ q: t8 F' B, H+ ? - #define TCCHEN_SHIFT 229 f1 y0 T! f4 _6 D3 l
- #define ITCCHEN_SHIFT 23( s4 D. H- v4 b% Y
- 7 h0 p: Z* p/ C! C) S2 O: n |+ C6 q
- static volatile int irqraised1 = 0;/ Q3 N# }' \$ o/ F3 f
- static volatile int irqraised2 = 0;& g& l1 ^$ z' X C% _3 ^7 ^
7 s! T6 X2 Q# o9 F4 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Z& H0 Y1 [3 q8 E7 a/ o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- W* e" ^8 F4 E4 e7 d$ W( {! s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( H, ^* x* G/ D8 @+ H, a
- * f3 T( J' E: s! |/ F2 c/ f
- dma_addr_t dmaphyssrc1 = 0;7 i& f& z {$ J- a+ f: R: ?" T
- dma_addr_t dmaphyssrc2 = 0;
6 v- \8 o1 z9 y - dma_addr_t dmaphysdest1 = 0;+ e3 x7 {" c O$ S0 X1 ]: @# X! m
- dma_addr_t dmaphysdest2 = 0;3 k' P* \7 @! ?1 Y# D5 U/ Z3 W1 R
% n+ Q- @( F& u- M4 k" D5 A% C+ D8 ~- char *dmabufsrc1 = NULL;+ M3 S- n+ X& C! o
- char *dmabufsrc2 = NULL;
7 `( e+ a& c3 u/ R# G1 ^ - char *dmabufdest1 = NULL;
( U! k9 @3 n B. P - char *dmabufdest2 = NULL;4 W. s$ d) ]; ]; Z0 a8 S _
- 5 ?6 V5 m" c! I# p. l
- static int acnt = 512;- p! u) [7 B% x
- static int bcnt = 8;* D+ F# M& [" ]9 d* {8 a& K4 t
- static int ccnt = 8;5 n- R( Z a* C' s0 {
- H$ T& M# F% s" n5 J- T- module_param(acnt, int, S_IRUGO);
7 t% d! i8 j* D2 N" s - module_param(bcnt, int, S_IRUGO);$ |$ C9 ?+ s& p0 U" ]9 _
- module_param(ccnt, int, S_IRUGO);
复制代码
% `( I$ m) m) Y' x$ s1 `, h9 U$ Y* V. f# g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) L) U7 ^+ \% D+ W+ W- i) \! @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 G- z6 \- c& \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% y7 w. E) c4 {8 ~- C
+ q: B5 [# h) w0 c
7 C! q3 X) [ ~" w
|
|