|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% ^4 U* e* s6 j% h3 A5 k- [code]EDMA sample test application
" B4 D& D. I5 f/ f3 X - /*# B$ A$ B3 y2 ~( [* L
- * edma_test.c9 v' |8 H2 Y" q( I/ y; `. F
- *
: r: n6 Q- \+ }5 z; U - * brief EDMA3 Test Application
0 k5 Q0 {$ }* [ - *
. @/ H; K8 z( L) z) s - * This file contains EDMA3 Test code.
# | V- n5 t" u6 M3 X$ E# L - *
]! z1 ~& Y6 G. }# @# k8 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: z3 t. R( Q; P, M" C* n& P" K& u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 F7 L G! O4 R/ e. o; z& y* \" W% W
- * TO CHANGE./ L# q/ R# r+ p9 v8 ^6 j
- *1 _) r' b, ~ n% Q! ?5 f! p' ^" g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ `# }$ z/ U- s6 W6 Y
- *
2 s$ k# g+ N/ C% f - * This program is free software; you can redistribute it and/or
- z: v4 t3 i* O/ w - * modify it under the terms of the GNU General Public License as
' m5 F! I( a) ?& |- J. x8 i2 a/ K* Q - * published by the Free Software Foundation version 2.
5 Y( R! g# `3 n3 V1 |1 l8 E9 N2 ~ - *
2 V# c7 j7 N8 Q8 ~" w* x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 _7 M" m: x3 v! r: y: I - * kind, whether express or implied; without even the implied warranty
. E: B6 ~' l. a, N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- L# X2 E' m; \) A6 I/ x( L; ]1 ]
- * GNU General Public License for more details.; B* r! u$ i* a$ ]
- */" X1 D) R5 H* F3 m
. @# ^0 k& `1 R1 ~1 h- #include <linux/module.h>! R) v/ V' V7 z% ^, P5 L( r
- #include <linux/init.h> q5 e* \' E/ s' o) C) [- t
- #include <linux/errno.h>
! e* y+ o$ }7 c, H* f - #include <linux/types.h>- X0 J- v ]7 c2 x0 g: P
- #include <linux/interrupt.h>
D* p1 g: T% D1 u - #include <asm/io.h>
" ^9 T5 l! s) E+ O, D - #include <linux/moduleparam.h>: g( u' I3 z. O5 Y. M% \' R
- #include <linux/sysctl.h>
3 c9 \; R5 k% f. x( l - #include <linux/mm.h>
+ b Z( V! w6 b- ]5 ?1 U) d - #include <linux/dma-mapping.h>% R7 f. D3 B& x- V4 F2 s3 v4 L
- ' R6 X* p# }% Z# o
- #include <mach/memory.h>8 A9 R7 z" J$ ], R: ~
- #include <mach/hardware.h>
$ A/ S4 i4 }* w& H' J - #include <mach/irqs.h>
, d2 S. `0 F$ F' F, j+ h - #include <asm/hardware/edma.h>6 L1 o7 @+ j* C$ g
- . D3 T9 {6 D, v% Y! R
- #undef EDMA3_DEBUG
! M) b3 Z C; z7 w* i( T - /*#define EDMA3_DEBUG*/+ R; ^, Y: R; i) [5 m% R9 `
- - A+ ^% [' G7 d6 [ I/ T; P
- #ifdef EDMA3_DEBUG
: B" X; u, r$ S7 {+ Z2 |7 L- [) N9 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 g) G. A* i x' u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 c# R6 S# j0 H, r$ }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 r5 N0 F; }7 u3 L* k4 D; T - #else: w' d: y) z# Z7 |) k4 O: e' u
- #define DMA_PRINTK( x... )4 |) O P' b& Y2 y- u( e
- #define DMA_FN_IN2 X7 S" B, M: u, Q7 E( a
- #define DMA_FN_OUT) z' L- s+ X: L% a- ~" M5 o
- #endif
3 ]- [/ B8 e/ i7 K, { - . v8 R" k: Z3 N5 i9 [* h+ C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 }) V: N& a! f7 }8 S. t( @ - #define STATIC_SHIFT 3
% B. b) p7 B6 |! Q8 L! m; Q% n* ] - #define TCINTEN_SHIFT 207 S, M" t* w. @* B
- #define ITCINTEN_SHIFT 21- X4 n1 v5 S1 d0 T# }! X/ T1 m' l8 g
- #define TCCHEN_SHIFT 22
/ g' [. L8 Z: i - #define ITCCHEN_SHIFT 23
4 {6 F5 C k9 z" g8 {0 f6 L
& R( m0 R# L% N! y0 ]- static volatile int irqraised1 = 0;
# ~0 k8 ^1 Q* v, B4 d0 b9 b/ H - static volatile int irqraised2 = 0;
2 A* v6 d/ G: u% L& j' h5 p" G
! }! y/ ~7 I/ h% H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 h7 b& ~3 Q, n( ^& U+ } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P x3 k3 c; [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* j6 t: H9 r5 P8 i* z - 4 g R P5 J: E7 A" x7 G7 P, P
- dma_addr_t dmaphyssrc1 = 0;$ M- f; q! m% {5 M0 X4 f
- dma_addr_t dmaphyssrc2 = 0;3 x g" g4 Y( y4 s
- dma_addr_t dmaphysdest1 = 0;
) `! ?6 V& b. a) u0 B' B: C - dma_addr_t dmaphysdest2 = 0;, ]* a* o* @; c% d$ [; a# C- p# B
. Y+ e) }7 S& y# P- char *dmabufsrc1 = NULL;- W3 a1 `/ O! x6 U) R
- char *dmabufsrc2 = NULL;( F" u) w5 H# r: ~+ W: Z
- char *dmabufdest1 = NULL;! e& z* N4 E$ Q7 H# q
- char *dmabufdest2 = NULL;! a$ A& k: t* G9 x% B
7 \: E( l; B. I5 x% C2 z# A- static int acnt = 512;. [: K7 w) G e( A u: [
- static int bcnt = 8;
0 X3 m8 T) J* f) J0 P( m, { - static int ccnt = 8;" D. s# F: [4 I5 T' Z
. P1 c5 {- i4 z9 s2 k- module_param(acnt, int, S_IRUGO);
8 M! I$ d8 v0 g - module_param(bcnt, int, S_IRUGO);+ J2 b( _1 L( s% E/ p
- module_param(ccnt, int, S_IRUGO);
复制代码
1 J* ~& |/ V6 _) k
) D: O b, ~- L0 p. ?% `* q- l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& t, [# k8 [. O" P- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, T& C" O7 q, Z- `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 e' Y% M# I1 t$ {8 @& r1 g
' ^; @- z" c/ s' z6 K' [/ ^7 x/ D* a; @8 @1 C
|
|