|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ T! d% I+ K; j7 h' i: O- [code]EDMA sample test application
; v3 k6 R9 y. o9 y9 `1 _ - /*
" J6 N' Z) r5 t - * edma_test.c* V6 l. S" C# o3 R
- *- q4 n8 T- E) q2 M% M p* f
- * brief EDMA3 Test Application
3 }( _* [0 w+ J; W) j - *
6 A( M/ j3 _, l - * This file contains EDMA3 Test code.; i; l( L/ Y" C
- *, C! {& B! Y& w3 t+ x6 @$ V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ x# @. e, N, h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 j# @+ ^- b. |( [# M( ~$ Q- H - * TO CHANGE.
" v. c1 Y$ c1 t$ s2 p4 b9 D - *
% x9 N) p) e) u6 \: G; N9 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; i |! w/ _7 g9 I, w- ~: Y: h - *7 x; d$ Y/ W5 ?& [! Y
- * This program is free software; you can redistribute it and/or
+ ]* b" p) C- G/ w* O" m8 x - * modify it under the terms of the GNU General Public License as9 N: T& `4 \, e
- * published by the Free Software Foundation version 2.
: _' S2 {9 ]! h2 [" J& c - *
6 c* V+ k9 ~( N# H7 N( D' c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' N: L7 F* g; x/ b/ _- P4 s
- * kind, whether express or implied; without even the implied warranty
# ?$ D" t5 k; x' G5 x- B1 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! ]' g/ H8 }# m2 z, T7 K9 s
- * GNU General Public License for more details.
. W9 r l) A% e( X# U) `+ ` - */
3 q+ [$ w% g0 [* [- ?6 J% ] - # @' M( |/ n( u# n2 Y' l0 V% o
- #include <linux/module.h>: ?+ Q" }9 r6 d* }
- #include <linux/init.h>) D6 [% ^! y3 k. B5 k6 N! a
- #include <linux/errno.h>
: `/ s1 F- D4 t( F9 v - #include <linux/types.h>* x3 N2 l* t* `5 [1 k& J: }4 w2 R
- #include <linux/interrupt.h>/ H) W) y6 h' k
- #include <asm/io.h>
. {7 I% T$ M2 }1 b - #include <linux/moduleparam.h>& C; ~6 C5 k- m
- #include <linux/sysctl.h>, ]! I( _0 u& P
- #include <linux/mm.h>0 x; y7 |$ p7 t, a' L3 x( ^$ Z
- #include <linux/dma-mapping.h>
- u$ a0 f' \8 h9 ~0 g - 1 s5 T7 r1 B% V9 k) y1 B
- #include <mach/memory.h>
& G- p" W; p0 l, W7 a& O - #include <mach/hardware.h>
: W* N/ i0 j5 |$ ^- | - #include <mach/irqs.h>- s/ f- j! G: b' X8 u) F0 A q; E
- #include <asm/hardware/edma.h>
, W7 m5 Q9 {5 q4 A - " _/ Q; n5 C3 O: ~( w8 P( ~
- #undef EDMA3_DEBUG
# z$ X N! K5 c5 `' J, c - /*#define EDMA3_DEBUG*/
0 }, d' x/ e! i8 U7 Q
: t- K0 A9 G& c. t) C' G- #ifdef EDMA3_DEBUG# l* }! L- ]5 @; Y0 O. @0 r, a1 j4 }% C* q9 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 ~0 o4 x- z; n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ]- D/ l" J) j" D" n+ a0 h1 Z( n1 G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
j& K0 o" O6 H1 J, F - #else
7 X: M' {4 b# t1 a# J5 j5 t* M4 m - #define DMA_PRINTK( x... )
" T- v8 {2 Q7 d1 G: k4 S" m4 V - #define DMA_FN_IN4 y& t3 m* a. s
- #define DMA_FN_OUT
! Q7 ~4 @* J/ E ~6 _/ e - #endif
) j) ~: }) X- ?! c, L" ^
, w6 j( F) F- n9 O' w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( g7 o+ \$ R# G6 F - #define STATIC_SHIFT 3
1 r) R' z' A; ?5 v4 e - #define TCINTEN_SHIFT 20" S- l$ O4 m0 f6 t
- #define ITCINTEN_SHIFT 21
4 I7 t! h, r P9 h: W - #define TCCHEN_SHIFT 22
! h6 O7 p5 T7 D+ p; d - #define ITCCHEN_SHIFT 23
/ y4 ^" Z' q4 P7 i! J1 C5 d7 W
$ j4 ^. k% h- C1 F# k# F d0 a- static volatile int irqraised1 = 0;) O7 f7 A" }3 O" r5 x
- static volatile int irqraised2 = 0;
, j5 V N7 X0 B7 L: w
. M! ]& V& ]* V8 w' c" M6 t/ A+ @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ L+ \9 E, q. E( G( e' H, N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" I8 a7 ~: z) e9 v4 L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; R; i# n/ ^* X3 i" F) Y9 D - 8 w% a9 E+ y2 m. S8 J
- dma_addr_t dmaphyssrc1 = 0;, h. e v U* J4 f
- dma_addr_t dmaphyssrc2 = 0;9 H8 ]% E ?& q5 E! h6 T5 ?
- dma_addr_t dmaphysdest1 = 0;
8 E9 P/ [9 A, c6 H3 V3 z. Z - dma_addr_t dmaphysdest2 = 0;
' R9 [8 }1 ^6 q9 S
; l4 z2 l+ u3 d1 N, z9 p- w- char *dmabufsrc1 = NULL;
% \% E0 @3 U5 P& H, M$ ^2 h3 Q - char *dmabufsrc2 = NULL;
) I$ _8 t% J. m' M" R* v l: V - char *dmabufdest1 = NULL;4 F, T/ h4 I3 M9 ?- }( T! S
- char *dmabufdest2 = NULL;
4 P2 u8 ?( [" W, a: F) T
; K6 A E: x9 E, K% i7 r1 _' B n0 h- static int acnt = 512;
" |7 c5 z, K1 P; [ - static int bcnt = 8;: W, H- z3 W! x1 u6 W! R& T0 }
- static int ccnt = 8;
, f4 H8 {6 T# Z; J% w L
$ S4 _4 |7 Q# ]: A) u- module_param(acnt, int, S_IRUGO);5 l4 u! `, N3 J; l+ H7 [! O# o
- module_param(bcnt, int, S_IRUGO);$ b2 a! Q( K( `. Y" r' s) N1 p, p
- module_param(ccnt, int, S_IRUGO);
复制代码 + Z8 D" ^9 g' Y3 F
7 T. e0 n: n# D, |" ~7 j& l- p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' w) L+ h ?! t7 L4 R8 m2 V: darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [% P$ _- \( j2 Q1 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ L8 r0 X9 \8 l9 G2 w; ~7 k
5 }4 t- W5 ^* J; U: v$ |) q- G% R
|
|