|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / _% N/ J( [- U' G5 @% V2 g
- [code]EDMA sample test application
0 ^3 x: V2 A3 J! V: j - /*" o5 o! H( U/ s1 y: {) t+ b
- * edma_test.c
4 U8 v' `6 \2 H# x1 b - *
1 G9 c, B: O! X6 T - * brief EDMA3 Test Application
; x5 x# }, N% `, S) j - *8 U* _6 i( p" j+ I9 n
- * This file contains EDMA3 Test code.
3 r. {5 e5 p8 p1 T- f - *
X) j0 f/ ]# y Q: J) p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: t, e* p8 X; R; Y2 [2 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' d6 b4 @. X2 w
- * TO CHANGE.1 R4 [6 n5 d, }; j( d
- *
6 B" i! b3 P9 Z4 \. y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% {# m- c( R# e* W$ S8 \ d, t7 I
- *
e' O, l9 ~, C - * This program is free software; you can redistribute it and/or
2 ^/ a) A/ v$ y% V V/ h: L - * modify it under the terms of the GNU General Public License as
- y) {) \/ V1 G- j% S - * published by the Free Software Foundation version 2.) ]6 D3 ]' @2 g+ o
- *: Y" }3 |3 \* D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ P/ k0 j3 M. k; q+ T* Y* P - * kind, whether express or implied; without even the implied warranty, W% ?$ | p8 v! V6 V5 g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ B" w3 [) S/ p: n: w9 M
- * GNU General Public License for more details., t& m$ l- z3 k# V0 D6 ^) I5 r
- */ c$ v" g1 P( N# k Y
/ l# N8 Z9 Z* I( K3 R5 E2 r- #include <linux/module.h>6 I$ g: J r5 r6 k0 e/ N1 U
- #include <linux/init.h>
) S9 }6 [6 {- _6 f& }6 D5 ^, p- o4 c - #include <linux/errno.h># A" Z. y; l: o: ]/ z
- #include <linux/types.h>) E' ]* r' t6 V6 p! X, f
- #include <linux/interrupt.h>* @* [# s( L% u; R) l+ }" x' l
- #include <asm/io.h>
# |+ S& Q2 i! Y7 c7 h6 Z) V; w4 H - #include <linux/moduleparam.h>
. P; ?/ f2 D! ^+ k; n3 P0 u - #include <linux/sysctl.h>
. S8 T, t- n& v1 y. y - #include <linux/mm.h>/ d8 p& t. r7 \4 e' G9 w( d
- #include <linux/dma-mapping.h>
) T4 F7 a7 E2 P+ f6 j) [' A/ B. V: G - " p- s5 w- S8 y( x0 S
- #include <mach/memory.h>/ m( v$ B3 a4 N# A6 G
- #include <mach/hardware.h>
7 S- X# N& N/ N% S - #include <mach/irqs.h>
7 A' ]2 F5 J: ^2 B2 V1 m, i9 I - #include <asm/hardware/edma.h>; F* m7 x' ] M8 R! Q* U# X
- & \2 F3 s; M1 Z1 Y8 W
- #undef EDMA3_DEBUG
2 n$ n/ ]! B# R i! k. ~/ `1 }& M. K - /*#define EDMA3_DEBUG*/4 F; r8 A0 |% d$ A! f2 ^' `
5 _" [0 v, u- v. _; c- #ifdef EDMA3_DEBUG
0 F$ m4 B* `+ \/ i- r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- [# E) z K" n* w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% }9 f4 C3 o- W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 d. Z) u9 K6 S: S
- #else. h& u3 o, Q, D+ l6 K3 s
- #define DMA_PRINTK( x... )# U$ x6 I+ }4 F4 w0 J4 ?- f% `
- #define DMA_FN_IN$ N% i. f& N6 G* V
- #define DMA_FN_OUT
! y- d# z# k0 W: y$ d/ K - #endif
: I* t' e: ]( ~' R, X3 D5 @ - - }3 `8 k( V9 d v# Y' x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) }( z. m- U1 z - #define STATIC_SHIFT 3
. E) Y1 w! }1 S9 u3 }; g - #define TCINTEN_SHIFT 20' C j$ t: n0 q/ H+ l: Q( g; n+ V
- #define ITCINTEN_SHIFT 21
5 M6 l6 U5 I, p8 q7 J0 o9 F5 Z8 [ - #define TCCHEN_SHIFT 22
' N! g: q2 e1 z+ S5 T) e, K, u - #define ITCCHEN_SHIFT 23
$ y9 O% |0 W T9 q( t) v( ^3 W - 8 b7 G$ {7 n7 W8 {
- static volatile int irqraised1 = 0;
7 L! ^( x8 G% }/ y( v; Q" w - static volatile int irqraised2 = 0;
2 m8 T; b( @ X; S: i* N+ w4 I. s0 m
- t0 e7 P/ g. d3 ^- Q5 ?" b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F1 Z3 h6 Z- {5 p+ d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 u8 M- F% u# F; E$ d9 h: S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 g* ?/ a! H/ A1 ^" I
" d) D9 d8 E* a( u- dma_addr_t dmaphyssrc1 = 0;! l4 P0 Z& F3 `1 t" g
- dma_addr_t dmaphyssrc2 = 0;1 Y6 Y3 Y) [! Y8 v. n F( B
- dma_addr_t dmaphysdest1 = 0;
9 H5 O2 z, q1 \8 R - dma_addr_t dmaphysdest2 = 0;+ F7 k, D; W+ t- _( l) X* i3 |+ w# i
- : j( v9 P R4 {/ g- A$ S
- char *dmabufsrc1 = NULL;
2 ?, e; j# o) g' `9 d - char *dmabufsrc2 = NULL;% c3 X2 l. o# Z- B, [
- char *dmabufdest1 = NULL;( t% D+ s& n C# w% z5 ~* q) j5 `
- char *dmabufdest2 = NULL;7 ~/ r! N& [& U2 o! s6 P6 g3 s3 ^* [
- `; }; A! U$ s5 C N) [
- static int acnt = 512;5 O$ q% `+ r: S9 c7 q" w* _8 ^2 J. I
- static int bcnt = 8;2 f/ ~7 o0 H e) d
- static int ccnt = 8;
+ ^! Y |! U$ C0 s7 R - ! K0 t% }7 G9 E/ i; H
- module_param(acnt, int, S_IRUGO);0 E- H2 X' J8 |# y# u/ [+ r; q
- module_param(bcnt, int, S_IRUGO);
2 F, e% p" V" D, x2 r5 E- V7 _( r! a- ? - module_param(ccnt, int, S_IRUGO);
复制代码 ' b2 J9 d0 `$ p
# D' U4 z. x7 r2 t! p7 q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* \# e; H, M1 K w! e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( m2 ^( X- f& R0 s: N' C! y# x9 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ M6 `! Q( v4 M6 J8 i; ~/ x. ^$ u3 [% }
1 @0 G, [- M y1 X |
|