|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 c# Z0 h3 s4 N* J& Y) |: R- [code]EDMA sample test application3 U" ^8 _6 b/ \/ W8 i, |' Y
- /*# a8 u& K* E+ `
- * edma_test.c$ H3 S8 q9 [ _5 f
- *
$ a- J1 k2 m) K; O - * brief EDMA3 Test Application# N9 e. H) | C3 h6 C6 B3 Y. F
- *
, t- e3 C" G3 O; T! c - * This file contains EDMA3 Test code.
+ X, B; i* q8 ~7 p1 C& O# H, J; ` - ** Y5 R0 \. |: W1 h2 U% E+ X$ T/ ? _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 d9 M8 Z: k% p% s' ]. V: q1 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% [0 a2 b- [: j; m3 i' K$ c - * TO CHANGE.
8 m: V% y7 E: v" J% e - *2 i- P/ v8 n L# Q8 ]1 ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ X- h4 T6 P0 v$ G. |$ |
- *
V& ]) d/ X" I5 l - * This program is free software; you can redistribute it and/or' u5 S- f; V( Q$ e4 A
- * modify it under the terms of the GNU General Public License as+ ~5 z) F/ A6 t' I, a
- * published by the Free Software Foundation version 2.
7 |+ ]4 B1 e3 h; \ - *' M, w' f- T4 j2 z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) X- v( H$ X; Q" l - * kind, whether express or implied; without even the implied warranty
7 v% l% ?$ h, b3 G( _; l1 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 ~9 n+ {' {& h3 n% j - * GNU General Public License for more details.
) f: n+ J1 {9 H8 a$ @' u P1 ^$ h; q - */0 A- ^0 u# P& K; D0 ~ y3 c
- L, Z; q6 l+ k5 i9 V* G( c- #include <linux/module.h>( E2 _; U7 U/ R$ F0 R- V; y2 a
- #include <linux/init.h>' A3 }4 a5 z/ l( C, i" O/ U4 [
- #include <linux/errno.h>' a0 n" T1 e! F' c2 x: w+ Z
- #include <linux/types.h>6 f( @: z5 g0 h! b& t7 c
- #include <linux/interrupt.h>
1 a; w: D; t7 L7 ]# r7 s - #include <asm/io.h>
6 M S9 g9 Y8 {7 w: E) n - #include <linux/moduleparam.h>
7 @0 ^. t( l. s" p0 }$ T0 x* v) M h - #include <linux/sysctl.h>1 |% h( z: m8 V5 S# s0 |9 h
- #include <linux/mm.h>6 Y" U; @% T, d5 _$ Q3 h' B' N
- #include <linux/dma-mapping.h>
/ [) Y @; [6 Z6 c
3 t, K: K6 c8 P# U3 D3 i0 A' @- #include <mach/memory.h># }# T5 a+ @9 c1 `- O3 z- ]: `6 V
- #include <mach/hardware.h>
0 k) a! X$ y! M0 c - #include <mach/irqs.h>7 X$ b* y' O1 u+ G' o: A: G
- #include <asm/hardware/edma.h>
$ p0 X9 ]+ S! E/ { @* i - 5 o# J% W, i t
- #undef EDMA3_DEBUG
$ ~4 |2 E, n7 G( _' d6 O8 |( |/ p - /*#define EDMA3_DEBUG*/
5 G$ X% r% Z. t4 h2 Z8 ~ - - ^* L6 d: ?8 {9 d4 k2 S+ Q
- #ifdef EDMA3_DEBUG$ |' L6 k0 [0 C5 R& o- Z% M* {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 Q# ^ q2 a$ V+ Q. \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): l* N, c9 y$ _1 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ }% H3 v: ]' S6 Z5 {
- #else7 \% } P! V# r- O
- #define DMA_PRINTK( x... )) A: d/ _% m8 x, [8 ^- ~
- #define DMA_FN_IN
' k0 K" Z- {3 U9 } ?6 @- x3 H2 N% h* Y - #define DMA_FN_OUT
: `: w7 }( n" D6 S! d3 x - #endif
3 k, x1 t0 f1 Q+ ^ B$ a ? - 7 Q; E- S- ~0 I) I! }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# ~3 A$ b! U" C8 m0 l5 ? - #define STATIC_SHIFT 3
7 F" R2 a0 T' E - #define TCINTEN_SHIFT 20
9 ~) K. c C" g* A+ D* c - #define ITCINTEN_SHIFT 21
* f' A7 ]! y9 }" v. P/ D - #define TCCHEN_SHIFT 22
4 A% w' U+ e! o2 r$ p - #define ITCCHEN_SHIFT 23
- t/ i; \( L* O - , L1 a5 q5 ?& w/ B
- static volatile int irqraised1 = 0;3 i8 {% C4 q5 B
- static volatile int irqraised2 = 0;
6 m! c+ `5 G* c$ c3 h; Y @ - " B7 {2 t, w2 S! L/ T# w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 P1 @% J& }* M8 p- g9 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; V7 U4 e: @+ _0 m/ m5 i, ^. d6 a# H+ O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ f+ D2 W3 g6 I2 C- X
A3 W5 }+ I( G0 a- dma_addr_t dmaphyssrc1 = 0;/ Z& r+ N, T5 |/ L' c) q7 q/ F5 X
- dma_addr_t dmaphyssrc2 = 0;" N2 {8 n; {) a: E, j
- dma_addr_t dmaphysdest1 = 0;' O2 t7 }& s, F
- dma_addr_t dmaphysdest2 = 0;
/ q# N+ ` H* r9 @+ k9 V - u+ i& m2 c( q) ~4 |5 i7 \" S9 O
- char *dmabufsrc1 = NULL;
- c$ ?# c; c% b, @: R - char *dmabufsrc2 = NULL;+ \1 b, q7 o& X* B( M
- char *dmabufdest1 = NULL;# [+ S1 r5 z; C$ {+ o
- char *dmabufdest2 = NULL;
3 D8 Z0 R% l: h# W; n - / a4 u5 e/ q8 ]) v: q
- static int acnt = 512;
2 ~$ v ^' X4 m; U - static int bcnt = 8;% ?/ A% }6 X. J
- static int ccnt = 8;
. p0 Z. V5 K$ h. l7 M# x
- l- g6 @% C) E7 a- module_param(acnt, int, S_IRUGO);
/ ?" |. q, k; P' o - module_param(bcnt, int, S_IRUGO);9 {/ H2 x& R3 o2 R) F4 B' d5 h
- module_param(ccnt, int, S_IRUGO);
复制代码
& Z( \8 j8 d, G0 ]5 ?; I# I* E
0 p) s; I# J5 \$ x" K% i7 O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ c( O0 ?% F( O1 Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# U# k2 F0 p' \7 b4 ]8 U. Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 q; F I, z J- B5 c
; M- P& N% |" ?2 ~) [( N& N1 d4 x9 e; |/ `
|
|