|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 U5 w' h( d; m% i- M" `
- [code]EDMA sample test application$ k9 J' d9 K) b- t* a* J
- /*
+ y$ v2 U0 O* q: Q( t - * edma_test.c! R+ E/ r$ ~. X! R- F
- *8 w+ J7 |, y- {7 Y
- * brief EDMA3 Test Application# Y @0 O& t3 D, {: y$ D! R/ H
- *, S# ]$ P( ^/ H* v
- * This file contains EDMA3 Test code.
! ^) v4 G9 V3 S$ ?$ c( {/ a - *% {1 o/ g, x3 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 a: F6 n# H. X3 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; }3 ]3 ~2 k2 _, O- O
- * TO CHANGE.0 r% ?. @" U, ~7 H2 p
- *2 Q5 x& Y" r* o+ Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& O. [& y$ D) ]. {. f - *
) Z" c( p o6 K+ {; A - * This program is free software; you can redistribute it and/or
7 c, d0 E$ d$ x - * modify it under the terms of the GNU General Public License as
( p7 y( k6 E( N5 w/ O9 U- q# k - * published by the Free Software Foundation version 2.! Z4 m' q" \) t: O* Y
- *5 g) [3 }8 z. [+ `; Y% S& s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ A: J4 G! G9 A - * kind, whether express or implied; without even the implied warranty
& k5 q1 D0 q9 M* ~0 p6 m% k0 U T+ { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- Y& e3 W6 s! N: g* H5 d1 P0 S/ @
- * GNU General Public License for more details.
) m" H# e9 i+ w& ]$ Q4 g! O- k8 \( ^ - *// G2 o7 p; U( B# D! Y
- 3 Y4 \* s, e. Z- z+ z1 g/ ], E T
- #include <linux/module.h>
* p8 F) z" n. b" c# n% ? f: D - #include <linux/init.h>; W9 I" \( R% _( c0 b
- #include <linux/errno.h>
9 x5 I! Z/ c, |! o- H - #include <linux/types.h>/ A8 S3 T2 g+ P7 T3 J/ C' O& V
- #include <linux/interrupt.h>" F6 e6 c! X, K
- #include <asm/io.h>
8 R D! C- t5 Q$ V# p$ T! K - #include <linux/moduleparam.h>
# d, K) q) A9 ]8 ^2 V! h% Z - #include <linux/sysctl.h>' X3 E$ v- j2 Z/ A
- #include <linux/mm.h>
9 v, g% x6 y1 o; L* H3 l& X - #include <linux/dma-mapping.h>$ z7 h$ e: T4 K. u* y4 a0 B
- " w; ]" P( j4 c* Y( u" S
- #include <mach/memory.h>) }. k6 `/ H" I
- #include <mach/hardware.h>
" v3 j$ h; Z) q# o+ `8 Q) b+ J# N - #include <mach/irqs.h>
" b7 o8 c' d* s9 E1 X; n - #include <asm/hardware/edma.h>. N, w" F& {' `1 d
1 Z, s' `$ C) K0 O9 Y! ?8 y- #undef EDMA3_DEBUG
2 Y- W/ W+ @8 d0 Z2 t - /*#define EDMA3_DEBUG*/
" v1 l3 ~3 ]5 l( f8 F& X Z
4 v& [2 |' v0 z [7 y8 p Z- #ifdef EDMA3_DEBUG
; o) L: t1 k! V9 g3 x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ p _5 X: l1 o! L8 l. v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) a7 O1 Q( K5 p# C/ k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; e) Y; T% K* c; O+ { - #else- h8 h' ^+ z4 D5 N# `/ K Y
- #define DMA_PRINTK( x... )
: ]" z* K& L. v f - #define DMA_FN_IN
) z1 f$ M4 w: n* c) _) f/ C; i- o - #define DMA_FN_OUT
" u+ g7 O R/ P6 _$ G - #endif
6 S9 i# e# M# s6 w" \) a7 y
7 z! a _3 r- i7 \3 a& `# Z- h0 `9 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
M& c$ B9 b3 ` y - #define STATIC_SHIFT 3
& x6 X8 N' B" v$ K* O) f - #define TCINTEN_SHIFT 20; A3 ]! {" c* w8 O# m) n
- #define ITCINTEN_SHIFT 21
( d, j( ?- D% [% ` - #define TCCHEN_SHIFT 22
& n; ?8 m3 o( r/ q6 b - #define ITCCHEN_SHIFT 23
+ I$ q; L- l& }5 C2 K - 0 F' j' e7 |: x* j" {6 g* L7 W- R
- static volatile int irqraised1 = 0;
2 d* I1 l# S1 e9 b - static volatile int irqraised2 = 0;
* J E/ S0 O" E5 ~* t7 o& I6 e - ; l$ ^' b1 f. [. X) ]' n- Q+ S7 e# m) F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 E7 K. ]& o6 ^9 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( _4 E7 V6 [) L% M. ^. X/ H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) i& e- z* g, ^( {* s% J0 D& d - * I6 ]0 q l% E% d. n9 `. d" G
- dma_addr_t dmaphyssrc1 = 0;1 Z& M: _2 x9 ]8 w) |( d# I
- dma_addr_t dmaphyssrc2 = 0;# ~. M7 J2 D4 h& `0 d, h+ y5 O
- dma_addr_t dmaphysdest1 = 0;* o$ J: V0 g0 ^; D( e
- dma_addr_t dmaphysdest2 = 0;8 W. K' I- O# ~6 m" N
- 4 W' k. r( R! X5 z
- char *dmabufsrc1 = NULL; J. E9 E# ?5 Z- Z! d% x
- char *dmabufsrc2 = NULL;3 \) ]6 F1 h+ h0 A% }
- char *dmabufdest1 = NULL;$ A5 K$ K( e# D- c: s
- char *dmabufdest2 = NULL;/ v( f/ c- E8 W; i6 L3 {7 x% k7 v
- 8 `; r* p0 z s6 {
- static int acnt = 512;
, D5 o6 W6 t( Z - static int bcnt = 8;
( O8 L5 v+ E$ B# l - static int ccnt = 8;! v( _6 L# n. s5 ?
- " O* O& C: \* j% \# b" ?" M
- module_param(acnt, int, S_IRUGO);
. d' q& {0 ^( \# V6 j$ M - module_param(bcnt, int, S_IRUGO);
3 z! z% K2 |4 J0 `/ S0 z# h - module_param(ccnt, int, S_IRUGO);
复制代码 % ? a# ~5 z0 l% l4 |' e
2 b$ J, m1 _8 p3 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 [& g0 k! l0 i# D" H% harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 s! `5 M# o+ I2 t4 B5 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! j( k! `4 B+ O, u
$ ?) ^- y+ b7 u9 `5 P8 z
& }9 q( w5 B7 B$ c
|
|