|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * e6 m8 ~5 w9 k* W( U6 k7 j
- [code]EDMA sample test application9 r* K: c* j6 |7 V1 ~0 l! v& R
- /*+ ^$ R. `7 h: ?, T, s1 ?8 i, j- @# G3 W
- * edma_test.c
" T( Y4 z ^" D8 ] - *
& G% n4 ^ B) H9 A+ Y+ \3 w - * brief EDMA3 Test Application1 D! p6 g: U9 _' x1 e( o+ W
- *! }/ {$ C3 ]2 A: v& c; W
- * This file contains EDMA3 Test code.
5 Z2 ?6 n/ `; W& o# |( }3 Y. u) l - *4 X# S1 s3 g/ h9 W- C, W$ Y* [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ r( d4 k+ U' M) J7 P M8 r* [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 r/ I9 t& C& b8 |1 o - * TO CHANGE.& |0 m* Z! h$ b5 s( t4 P
- *: o% J+ y" X; g$ O" n1 i* W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 S$ O$ E7 X% i0 ? - *
+ I* F# {, D1 Z: F - * This program is free software; you can redistribute it and/or' Z$ P) Q4 \" l. n+ V* [* B
- * modify it under the terms of the GNU General Public License as0 r7 \1 p. S+ c s& N8 R [
- * published by the Free Software Foundation version 2.
( v" G) D% U) s* | - *
4 B) o; a; U1 [$ ~" y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* O& R$ {" `1 Q( D% `6 | - * kind, whether express or implied; without even the implied warranty+ a1 `5 z% @( M4 N& L0 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the {. X2 p" I6 i+ a3 E
- * GNU General Public License for more details." M- y# h2 L9 K
- */
v( W y, H {6 e: E( b" w4 x
4 H* [" W* B$ K; k, [- #include <linux/module.h>
5 }8 s& I" w* J' g; Y8 W2 b! X - #include <linux/init.h>
& i3 e P* A9 H* N3 i! s& E - #include <linux/errno.h>: Q/ r" @, ~5 g8 }/ U3 d/ A
- #include <linux/types.h>
. S% ~4 c6 } N/ V4 x$ h4 r - #include <linux/interrupt.h>
+ |% D& z& T0 N/ U - #include <asm/io.h>
: u! o0 |$ h0 p* j- ?/ n! E, P - #include <linux/moduleparam.h>
) [( |3 }3 }: U. r4 E - #include <linux/sysctl.h>
7 A: B/ _9 b, f- @# z2 N+ i - #include <linux/mm.h>: p* l, L5 a+ b" D' f
- #include <linux/dma-mapping.h># ?$ U& c: U" c; b# t
6 X: I- t: y) J4 L3 l2 p; `- #include <mach/memory.h>
9 [5 L3 u0 b3 m3 I4 |4 F0 C3 O - #include <mach/hardware.h>
8 Z4 H' z" `1 _# q - #include <mach/irqs.h>
% ^7 f3 X0 B W# q - #include <asm/hardware/edma.h>
% o) u) s. |5 o8 ~" f - 7 b( K& F4 @4 y
- #undef EDMA3_DEBUG
# I. T+ g& e* K0 Y- q7 k( D+ b - /*#define EDMA3_DEBUG*/, @8 b6 E$ X$ T( ~% r4 Z
4 \5 c3 G# ]% X- #ifdef EDMA3_DEBUG/ c: O% n) L" C4 [1 g2 ]* e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 E0 Q5 ?2 R/ l- B( H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ^9 B* G! j% q6 ~4 N* g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ _& b/ J+ u. a) i4 {; H
- #else
/ ^) o. O9 U7 w' H. w - #define DMA_PRINTK( x... )
& W) L; T8 Y+ d4 S h% f) Z - #define DMA_FN_IN
3 E2 U( N6 J) l5 Z' @/ n - #define DMA_FN_OUT
! }6 O+ U) c$ [; B9 N! ~& q- b0 s - #endif
; X% K' {( f+ w3 @, ]" ~1 O
/ Z8 {" i, B# C9 e7 |7 C7 E0 P5 v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) M; \, W& w% v( x' X, c. \
- #define STATIC_SHIFT 3" ]1 b. {& T0 ` n
- #define TCINTEN_SHIFT 203 j* W+ s4 y1 w8 V5 C9 U. B
- #define ITCINTEN_SHIFT 21
. G* F: B" j! M$ S9 ~$ c - #define TCCHEN_SHIFT 22
2 |7 r' j. E& G/ E1 f - #define ITCCHEN_SHIFT 23
0 o* m y3 ]8 m6 F - 2 c" c8 A) O T4 M6 ?% P# `6 f7 l
- static volatile int irqraised1 = 0;
0 \" o0 F/ @0 ~: \. Q5 [( \# N. H - static volatile int irqraised2 = 0;& l7 H, _4 Z( }/ i4 {
1 |5 Z- c& O& K& Y# f% I; \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: t; D7 K2 H6 j2 T( t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @ K/ O6 b# m+ P4 Z l1 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' d; g6 R) y0 Y1 J( B7 b
' B' N' F) X2 }+ I/ d- ]2 G- dma_addr_t dmaphyssrc1 = 0;
+ [$ B+ L$ {( p* d$ |3 V - dma_addr_t dmaphyssrc2 = 0;
6 l, _; {9 M& a) w( Q+ D - dma_addr_t dmaphysdest1 = 0;5 {. A' B Y4 e" D N7 U" X
- dma_addr_t dmaphysdest2 = 0;' o. e& [, s) q0 \. P: S5 z
- ) h# ~% k+ W; p# D' y/ q5 W
- char *dmabufsrc1 = NULL;
4 N1 K8 Y2 j; D1 O5 ^ - char *dmabufsrc2 = NULL;& l& e5 G) A8 T9 G8 D
- char *dmabufdest1 = NULL;
9 x1 ]; | d2 n3 ~/ y - char *dmabufdest2 = NULL;
, g) M, u& P% V6 V0 Q! g - 6 I9 M B' S, k4 l3 H' J' v! X
- static int acnt = 512;
$ O7 ]" v1 i5 g0 r9 M& F - static int bcnt = 8;0 J% f# l! {- x" A: f
- static int ccnt = 8;
R2 I( U; J+ R9 B
0 l2 \& N/ [4 ^! s% y- module_param(acnt, int, S_IRUGO);
# C! V a$ {, b% I - module_param(bcnt, int, S_IRUGO);% B4 c$ W P* z6 C
- module_param(ccnt, int, S_IRUGO);
复制代码
2 N% a9 Q$ R4 Q5 S! g3 i# r8 c2 j" Q$ H* I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 |2 P( ~+ K) n, W! d7 `1 X6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 \; N& f. M1 F# l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 K- V9 Q& H1 j/ r6 R6 U
; f0 Z- z7 _: O* e9 f {
, d0 `- n( R$ F5 {+ d
|
|