|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* E m ]7 K! H9 S( h3 @- [code]EDMA sample test application0 B: D: a, l7 |* {8 i2 `
- /*6 y/ A. `5 d: N! ]1 v( x- a6 @; ~& ]1 U
- * edma_test.c* S9 a8 P- g$ Y4 w1 b# o* k
- *
. S& @8 N* W* b# B6 A, _: t p - * brief EDMA3 Test Application
5 K, v& E3 g) I/ K7 ]4 U$ _ - *( u9 ?( |5 P( ]/ ^
- * This file contains EDMA3 Test code.; E# Q) @( E9 g" L0 n
- *
$ \- c, S1 [/ K7 V; B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* I8 ~ s- |. V4 J% T5 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# B- Z& A/ F; l( f0 B# p' K, n J
- * TO CHANGE.
7 v3 ~: Q- v8 p - *9 M' m* \$ K* c' Z1 O( a# m' K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, w8 d; r5 J3 t2 M) d8 t - *# \& D7 _9 b: L6 q
- * This program is free software; you can redistribute it and/or M0 u( z2 k8 a n0 d
- * modify it under the terms of the GNU General Public License as
* t6 u5 [4 Y9 o - * published by the Free Software Foundation version 2.( H) q9 T( ^% X( K! X0 W
- *
3 m0 x- f" h& }/ f, Y" { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- c% V% F6 \/ q - * kind, whether express or implied; without even the implied warranty" H, X* U/ i" z" h! x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; K9 t4 q3 r9 N' t% o0 {
- * GNU General Public License for more details.
3 h2 i8 r6 G0 \5 |3 l# d) A' h - */: I x k V# J5 z/ t9 `
- 3 ]6 O. L: j/ G( J6 w
- #include <linux/module.h>
7 x, |* c( Z3 b8 Y - #include <linux/init.h>% j4 u3 S3 R$ ~0 Y
- #include <linux/errno.h>5 M( K8 N1 Q4 \ O6 h
- #include <linux/types.h>/ L" E/ ?4 N3 ]7 g5 Q
- #include <linux/interrupt.h>
# A7 @5 |* p1 z! C - #include <asm/io.h>. t+ @3 B* P) j. y9 Y
- #include <linux/moduleparam.h>
5 N+ J9 g+ ]: n/ T4 n" V - #include <linux/sysctl.h>& Y, k& [8 @" H5 V& c5 [. S; v) `6 N5 t
- #include <linux/mm.h>
' t, @3 ?$ U$ `9 e6 W* m P - #include <linux/dma-mapping.h>
. f {1 D& x' l) }$ Z# }2 O D
8 E. p4 S: o$ K* |% }" Q* Q) S- #include <mach/memory.h>; O5 b2 N$ \2 y% `
- #include <mach/hardware.h>
2 [% |4 D! j0 S: \" I/ C9 m - #include <mach/irqs.h>5 k8 ]1 q+ ? `0 m: a' G
- #include <asm/hardware/edma.h>! N; l# L' T/ U0 ]; S5 }
- ! F- [/ i% d+ T( `3 w/ S
- #undef EDMA3_DEBUG' d6 u2 @; b5 T* W9 u
- /*#define EDMA3_DEBUG*/
* i6 U/ `: o- j0 i/ o+ @& Q3 t2 B' w - " e5 r% A9 b* g& e( O% z. d
- #ifdef EDMA3_DEBUG% e$ M/ K6 ^1 s: w+ ^) ^9 D9 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); X; ]# z7 H* @" e& U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) A. i; G0 v, } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( O% s, W# C* R6 A
- #else4 O; E. L9 ]% ]$ l5 g" }- K
- #define DMA_PRINTK( x... )+ l; v+ t: [% e, T: C' V' Z% ~2 \
- #define DMA_FN_IN/ L3 |) f3 Z0 O" r) X
- #define DMA_FN_OUT; z# @4 ~% Y- I3 L
- #endif. O/ G- O- l6 r- g, w4 E& b
! o! @8 z! r! a' N( l3 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: Z" M5 p* s: z4 I5 O6 R( e - #define STATIC_SHIFT 3& h2 u E2 ?5 l" h+ S2 U @6 R$ f
- #define TCINTEN_SHIFT 20
n/ \; e! h1 s- A g - #define ITCINTEN_SHIFT 21/ C/ S" f6 e% s( Z7 u4 Y! N* S
- #define TCCHEN_SHIFT 22
- }- g, ^( _* y - #define ITCCHEN_SHIFT 23
* r+ M& Q/ R# I
4 Q; D) k3 |1 |" v4 j/ l2 V- static volatile int irqraised1 = 0;
* r# w1 L) ]4 e h( }, q4 w; X& U - static volatile int irqraised2 = 0;% F* p: P" O$ L# v
- " _7 e/ F: G$ `* h# V# y! Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' `7 _- F# U) D& R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ M7 f( |( f5 c3 s+ W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ D' T* D# p- H8 H+ X& d
# |, K1 f4 t: \* C, O$ x5 U- dma_addr_t dmaphyssrc1 = 0;
! O" V$ {" w/ L6 \ - dma_addr_t dmaphyssrc2 = 0;
$ F' M" M- R* W6 K1 Z% V d* S - dma_addr_t dmaphysdest1 = 0;
( w) I: Z% e: O7 o6 K$ C3 M2 e: M - dma_addr_t dmaphysdest2 = 0;9 \$ V. X: \2 n( L2 k; a2 ^
M ?5 L. t: U; d4 Q$ _8 }- char *dmabufsrc1 = NULL;
9 C, l( `9 B( p/ t - char *dmabufsrc2 = NULL;# H0 D- @4 ^6 y0 _
- char *dmabufdest1 = NULL;5 ~- l' j; y) x) S' m, N
- char *dmabufdest2 = NULL;
- G5 g9 \* M) F# \ D! ~ - 8 {' G/ _1 d6 N* ^+ L) T3 R: G. G2 g9 ?
- static int acnt = 512;
- L/ C. V- o0 s, \# m4 s2 g6 r- N - static int bcnt = 8;
; O1 g5 V1 N' `/ N- s# a+ \" E" r - static int ccnt = 8;
* L, @5 X( u0 s" X. Y* I: }+ S. v- r
+ p% ^) f' Z# h, g( a- module_param(acnt, int, S_IRUGO);( N" O' F! G/ q" H0 d. Y- {$ N, s
- module_param(bcnt, int, S_IRUGO);9 u9 i- n& E$ o4 Q @" ]+ p
- module_param(ccnt, int, S_IRUGO);
复制代码 3 q! o' S$ V J
" q0 @( d3 z; o8 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ k6 k. ^3 ^! L s4 j, g1 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 q, c9 k+ t/ v2 i3 S% M- O# C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' S' d8 ?$ U0 i( a
1 f6 G; m6 D' Y/ O5 M
* G* [9 b: X! d( @2 g
|
|