|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. R! c0 `' P1 `* A' k0 ~5 M! W- [code]EDMA sample test application
6 j* _3 w: G1 J2 o, L: b! e - /*
' N) o; B. M2 S# v! H6 }3 K; j - * edma_test.c
) t, ~" s) V% j( O2 X - *6 J' F& n7 Q6 D& N
- * brief EDMA3 Test Application
0 ^# P3 B) E/ n - *
, g6 e2 T3 w- j4 B A - * This file contains EDMA3 Test code., `5 W: W+ H& ~. ?! K0 r) c* |# ]3 D
- *4 P" c6 x: n [5 c# E z+ I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 l" n% k& t; d Z% n5 a9 r( G5 \+ k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 `1 z+ U5 S: z7 D5 q- ~2 L( |& I8 j
- * TO CHANGE.
- K+ K$ w+ h& {* M - *
; }3 q/ r- K- J0 k* [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ f. m* z' K+ T$ c( [/ Y# S) z - *6 _) h8 H. J) j- v3 b) Z: s8 W G1 b
- * This program is free software; you can redistribute it and/or
0 X% @( P1 [* ^9 V. \& j9 F - * modify it under the terms of the GNU General Public License as
0 U) F5 e% W, N: ~( e- | - * published by the Free Software Foundation version 2.+ r* w8 V. R7 d7 @6 C$ W& ]
- *% O; m7 ?9 M* f. v& w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ @7 s) |8 O6 f8 v! e1 b& x0 F3 I - * kind, whether express or implied; without even the implied warranty2 U" I1 _, s* e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: A( t: t7 \0 \% ?: f' E - * GNU General Public License for more details.
) {" P6 K r O- K - */
8 y5 N9 o; U9 x5 k# V
3 n B7 S0 j x- #include <linux/module.h>
+ R& G v+ k& e: y& C; t- I m6 ] - #include <linux/init.h>' k; R- E! I, F- x- g. {5 V9 D
- #include <linux/errno.h>
2 Y, @- _1 z8 z - #include <linux/types.h>
( ]8 A8 h( f' C1 x; h( e - #include <linux/interrupt.h>4 f# l' k$ R5 w5 L; A% l6 F1 j
- #include <asm/io.h># }8 s5 Q+ ^$ ?# o) e4 e
- #include <linux/moduleparam.h>
# `8 ]' D' f" F8 o - #include <linux/sysctl.h>$ a7 g: i; M) l; d. I( G
- #include <linux/mm.h>
, Y' K. `6 Y" M$ L5 d1 X& X - #include <linux/dma-mapping.h>
3 |3 U M! k; k# H( x, o V
/ [; u- q; ~) |! \# B2 F6 C- #include <mach/memory.h>
) ?* d: w; ~) c. b" H, { - #include <mach/hardware.h>; g7 ?9 Y, }' m; G( R
- #include <mach/irqs.h>
6 ^- W. U8 z2 J! ~ - #include <asm/hardware/edma.h>1 o8 `1 ]8 t* [" j
" ?% C+ h. [: m& q$ L! q- #undef EDMA3_DEBUG
5 s( ]4 a5 m4 Y& H5 w1 S - /*#define EDMA3_DEBUG*/
1 `) Z$ t3 u. y& Q - ) l+ R! ?% p: r
- #ifdef EDMA3_DEBUG) s) F0 e1 p( }" D" P( M9 \. X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 `+ e; G1 S" F. I& ~- h. i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ C6 R- ]$ e* }/ s7 R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 f# E4 z9 K* Q, ?1 y
- #else
6 ?. r* ]- k ~1 k. }' k9 W - #define DMA_PRINTK( x... )
* i8 @1 {3 R' G3 J* ^. [1 ]/ l4 F - #define DMA_FN_IN: \7 {2 B: L0 E
- #define DMA_FN_OUT* n5 u$ N& V! |. ~
- #endif q- b+ J- n. p2 ?( C# t: r4 Z
$ O7 J) W2 l8 e6 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 w& p% i7 G: ~, k6 F9 E - #define STATIC_SHIFT 3
2 s' F) Y3 h& y' D6 f5 C$ t - #define TCINTEN_SHIFT 200 E: k: t3 p7 ~3 K, P, `
- #define ITCINTEN_SHIFT 21* l) x7 O( C4 N4 l
- #define TCCHEN_SHIFT 22
# X- P0 N! }$ g, l6 ^' { - #define ITCCHEN_SHIFT 23
1 `: L, p% F) ^) A2 P% I+ I
# `' l8 o/ q3 o3 X+ [4 p- static volatile int irqraised1 = 0;
4 ^* I, T7 ]3 {+ Y - static volatile int irqraised2 = 0;8 E$ P2 ]8 b- p9 g5 Q
- " m; g9 s4 B9 d% V* T; V. b) n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 I( [5 p& ^0 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# G3 x& r9 `$ ]7 W9 I: { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `# n. G8 C8 U9 \/ E4 d
+ l: K( r) z" c- dma_addr_t dmaphyssrc1 = 0; @9 K" w* p1 k8 E
- dma_addr_t dmaphyssrc2 = 0;
5 P- S" T( d. B# K8 R# u% | - dma_addr_t dmaphysdest1 = 0;' E# @, r4 Q) v N" o/ y c
- dma_addr_t dmaphysdest2 = 0;
- W" c( Q" }5 c- [; R; ]5 Y
1 C% y' k! S ~ p) P- char *dmabufsrc1 = NULL;
9 P* D% o( {% I, [7 b! F - char *dmabufsrc2 = NULL;
# a- R. B4 u6 d& e - char *dmabufdest1 = NULL;3 x, r" N* o0 G- [* _$ N+ w7 M) a
- char *dmabufdest2 = NULL;% K. k& R& i; \, V: T3 R
4 [$ x5 N, n p- Q- static int acnt = 512;
% i8 v7 _% M T: O - static int bcnt = 8;
5 J: {, L2 g2 T2 ?; i4 |8 H% l - static int ccnt = 8;
* P( J0 S- M# e+ R - $ Z& }) r- J. D$ C2 F8 o0 o
- module_param(acnt, int, S_IRUGO);: O/ F* O1 Q+ g+ Y! Z
- module_param(bcnt, int, S_IRUGO);
8 r6 y s N6 g$ v0 n - module_param(ccnt, int, S_IRUGO);
复制代码 + C/ j5 ]6 k% ~1 F$ u1 ?3 B( }
, g0 P6 H: S3 J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, J% J% }2 @( Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 P) O' p, r( ~/ V1 u. k- d- }1 @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 s" N* j9 | w1 \. L' e, a9 C
9 v9 h/ I/ I3 Q4 Q! D# K- P! {/ V5 F5 [6 {* R. A1 B9 {- @" d
|
|