|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 c, b, N/ x1 I: O+ `# W- [code]EDMA sample test application
, h7 u- o3 }1 C3 W, U - /*
+ d8 S' X' x. S R - * edma_test.c0 S ^( u: U9 ^2 H! x- q- \/ R
- *
8 O" b% t# j3 @7 I$ ^* w - * brief EDMA3 Test Application8 C5 Y. \3 I2 d/ X6 ^
- *
2 g o1 `- |; f" R7 E - * This file contains EDMA3 Test code.
/ V& Y) |5 ]6 L# G" O0 B& {4 q - *
# d: M$ F* M; w9 ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ q; ~$ t# a9 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 h# R H. F& L) @/ {
- * TO CHANGE.! }5 O# ]: F- J$ x4 S6 u) K$ d. \
- *; F9 o" h" y9 M* ?+ t! I7 G( M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ \$ P/ I8 S5 p% {8 Q - *
4 U4 Y+ G% L, A - * This program is free software; you can redistribute it and/or
! y( H3 T. K* C. u! ^ - * modify it under the terms of the GNU General Public License as
) X% Q |1 [0 Y& a d X7 [! J/ @ - * published by the Free Software Foundation version 2.7 W! k9 }/ i+ Y7 h
- *
/ F. }8 l# f* J9 Y3 l% d- i! o9 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. v# T* C, d$ f% @. {: [6 R) O
- * kind, whether express or implied; without even the implied warranty: x' i5 i2 x3 `& @" n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 X* R; `8 f! q) B7 k( B: C - * GNU General Public License for more details.* S+ R9 E$ H$ x
- */# V$ y& K$ C6 k* M' g; `/ Z) s
- k- T% p8 l1 W( A% b) Q2 ~
- #include <linux/module.h>, Z, C: `2 p6 f& s
- #include <linux/init.h>
( y% `$ ?, B( f# W7 N8 r- t' X% \% [ - #include <linux/errno.h>
2 V" S1 }6 [8 E+ f. H& E - #include <linux/types.h>
/ b/ ?# y4 w' P( r# \6 V' G' q# _ - #include <linux/interrupt.h>/ h7 o& t ~& w1 z" r8 Y3 L+ w
- #include <asm/io.h>
0 p* a' R b! m# |9 r4 o - #include <linux/moduleparam.h>
4 O# E. Q2 A- }' h# w6 [1 o - #include <linux/sysctl.h>! B8 i& m+ l- r2 ~* M
- #include <linux/mm.h>, }! _) x9 M9 E% c
- #include <linux/dma-mapping.h>
+ Q/ O3 D1 |; a4 d - ! q+ [4 M4 U; z
- #include <mach/memory.h>5 [% v b! Q! K6 l, o
- #include <mach/hardware.h>
4 C8 x3 |2 i0 g2 K5 C B) V, T+ L - #include <mach/irqs.h>
+ Q3 \: L; r9 o4 Z( H: F& J - #include <asm/hardware/edma.h>
7 }: e& @$ e3 v - 2 r, U+ [3 J9 M1 b; l
- #undef EDMA3_DEBUG4 C, s' P9 f8 q7 Z6 n: v9 x
- /*#define EDMA3_DEBUG*/
5 x% @# l! Z, T8 I' m
. a4 Q* ]3 \6 K" O4 R- #ifdef EDMA3_DEBUG
& B9 a/ c' K; x0 z9 ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ k, L' u F3 q) V/ M) G. }+ Z8 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): E* S. P: _: `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 g+ J$ N% M5 F. o* Y/ U7 B - #else1 m0 M9 v0 u: A
- #define DMA_PRINTK( x... )( ?. N/ G" z4 D, _; z
- #define DMA_FN_IN
9 b5 \& t8 F& Y' X) O - #define DMA_FN_OUT' k. K' @0 V1 Y( i9 @
- #endif1 ]2 j7 c5 |6 _' C5 @+ K
- * m& w. I+ j/ r% l2 I2 c. Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 Z$ [, T- a, y8 u6 o. V - #define STATIC_SHIFT 3% R" C, k: S" s m: `) P
- #define TCINTEN_SHIFT 205 Q' H1 n( \1 D& r/ Z/ O% Q3 o
- #define ITCINTEN_SHIFT 21
+ V/ g8 T3 C$ ]7 Y+ I - #define TCCHEN_SHIFT 22
1 ^$ m. v$ g: B1 }5 o: G0 E2 ^ - #define ITCCHEN_SHIFT 23* U+ ?+ j' t2 t9 a0 C/ ^- U) `' Z- w
! @" z: J1 k1 _7 { _- static volatile int irqraised1 = 0;
7 s" B' O6 Z4 U) {, R/ `6 V8 s - static volatile int irqraised2 = 0;
6 `6 g$ @/ N) |: E O
* W* S7 l3 v( J' g7 Y$ x- T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 n$ k$ c# O3 ]! O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ~0 _/ p+ q( r3 G3 D6 b2 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" B- b/ Q' g! n9 b - ) @8 u$ A) U- f. G# s( h
- dma_addr_t dmaphyssrc1 = 0;6 E4 q9 J+ H6 t, A' y' {: J
- dma_addr_t dmaphyssrc2 = 0;$ M5 a( U" B/ W0 w5 ]& ^6 g3 J7 a6 l3 k
- dma_addr_t dmaphysdest1 = 0;3 j2 L2 i- K0 b0 }! J
- dma_addr_t dmaphysdest2 = 0;
7 M+ @$ d; Z) q; W% z G* M - . x. n" B4 [0 H# [3 e; P) O
- char *dmabufsrc1 = NULL;
& w. X9 c. m% l* U3 `0 a, b. O4 w3 L - char *dmabufsrc2 = NULL;
/ a, L/ @0 r5 T - char *dmabufdest1 = NULL;4 ~4 L; C% V: Z. m. U, s
- char *dmabufdest2 = NULL;- f. H5 o$ `2 d
+ [: W( T$ H5 L0 l0 {! ?/ j2 j1 s4 l- static int acnt = 512;
. |& b! q" H/ q4 {4 b; Z6 t( | - static int bcnt = 8;
( l3 Z$ q7 I0 x2 X - static int ccnt = 8;
" W7 Q1 j6 F/ T. l. n' U' \ - & E" t5 l9 v9 ~" U: K" j( V3 F
- module_param(acnt, int, S_IRUGO);
2 m# b* I5 t+ y" h; q - module_param(bcnt, int, S_IRUGO);5 G8 K2 ]" {3 Y4 o
- module_param(ccnt, int, S_IRUGO);
复制代码
! X0 ]. m2 q9 A. e1 n. E! W; \$ a. X- F+ u: \$ g7 w* o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, V" x9 s6 k3 s& `6 V) Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 K( x: p8 _' E+ f6 a. D/ w, ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* {# B/ j; U7 S7 @4 y0 }1 {0 K" i' |
, P6 @. i2 z9 B1 s
|
|