|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% x& i) p; _- e! l- [code]EDMA sample test application/ y5 Q6 [& b$ X k
- /*
4 t; h1 `! C* z* H' V/ E2 d& V - * edma_test.c
/ ?( a& m0 h* {( F1 J- Z - *
4 V8 ?- F7 t/ F) h - * brief EDMA3 Test Application! z7 w9 r+ S9 Y& H+ P7 m
- *1 d3 R+ \, a( x* x, M6 C, e: K/ E
- * This file contains EDMA3 Test code.: n/ g+ m2 a+ N4 Z9 a- O1 W Y
- *
$ ^0 c6 L+ b! I- d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, v) Z6 A- Y0 f2 r& m' Y5 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 B/ F8 }1 S& y4 q$ _+ f
- * TO CHANGE.
+ v! V2 x) B$ U9 ] - *. z, \5 K x; N' q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ q/ Z* K/ F" i" K - *+ ^5 ^0 h7 B4 Q6 E/ V. h
- * This program is free software; you can redistribute it and/or
h R# i( i: \ - * modify it under the terms of the GNU General Public License as/ X9 d* f1 _( m* y
- * published by the Free Software Foundation version 2.' Y( k N4 E) Y$ J" Z/ E
- *' Y4 W' i* {5 m3 Q; l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 T% w6 H0 @3 Q! H* F$ ^9 {7 f) ? - * kind, whether express or implied; without even the implied warranty
L6 X- V7 r' p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ]2 l; i. ^* W1 T - * GNU General Public License for more details.
% l, J) c" k# T, \: W4 G% l - */
6 P' F7 e9 L5 M) p: K+ k
. e1 }3 H3 _& @ i' O0 X; |- B- #include <linux/module.h>2 V* P* W" K! h& _
- #include <linux/init.h>
: V. P3 `) g4 C9 Q, B - #include <linux/errno.h>
' ?0 G+ h, t% y1 ]0 k - #include <linux/types.h>
9 W. R8 J) L4 x. Z1 h" Q) Z - #include <linux/interrupt.h>
3 T+ d2 f N; b# |% }% ~8 x - #include <asm/io.h>
+ s+ \1 i# k7 ]% J8 c - #include <linux/moduleparam.h>6 J* B9 @: p; I- g7 t$ p
- #include <linux/sysctl.h>
. e8 i$ G0 H6 M$ L$ m( o - #include <linux/mm.h>' @; z2 p: z' I8 a7 q. i7 g
- #include <linux/dma-mapping.h>% c2 } S3 \1 \$ i
- / q- @$ c5 l0 w& O. f+ {! o, u
- #include <mach/memory.h>
5 b/ {+ @8 F2 R/ Q7 N, k( m* y& a - #include <mach/hardware.h>
0 P# _# n; c! ?8 L - #include <mach/irqs.h># M; o0 C) `. C) O- G
- #include <asm/hardware/edma.h>
% T Q1 W7 q( \3 S: Y' E
6 }0 O; u% @) K; d+ R( G6 L- #undef EDMA3_DEBUG7 I9 p) O+ C ?9 M, ~
- /*#define EDMA3_DEBUG*/1 u b, G" g7 q7 f/ V0 r
- 8 V; A' t/ x" A* Z: t
- #ifdef EDMA3_DEBUG7 ~2 t; V1 G8 G2 q* E3 S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 K4 p$ t# P `5 v7 h4 p4 e7 E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% a! T" _ j# [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 b; B8 ]9 R1 u2 N0 S; j
- #else; j4 s$ v8 ]' w4 j- P1 f
- #define DMA_PRINTK( x... )( |4 \! P# J* ?+ f; w# X6 k
- #define DMA_FN_IN
1 z( q0 y0 I2 b6 `, K) ]% ?+ @4 i - #define DMA_FN_OUT
9 h: V m6 Q1 D - #endif
! n- r. ?# W- N' D9 _0 J
. f: q! ^+ p0 {7 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768). H) y8 U: w* U8 J
- #define STATIC_SHIFT 38 u3 q0 z2 K0 m! X& W/ X9 V
- #define TCINTEN_SHIFT 20
: W! a/ Y) t z4 o' E - #define ITCINTEN_SHIFT 21% S0 }8 B2 \( U% [, U* o3 `) B
- #define TCCHEN_SHIFT 22
% }3 }, p9 x6 z2 J6 y/ t - #define ITCCHEN_SHIFT 23
0 K( I2 ~1 ^! m* B2 c9 R9 r/ n0 Z
! J* U3 }* V4 b- static volatile int irqraised1 = 0;
$ o& d! p5 s" T" K! p) z( D - static volatile int irqraised2 = 0;
6 t4 ~, f* Z& P" }7 Q - , |! o& V x3 l' j6 j# X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 F3 { b1 f' E8 v$ A: S# [1 a! o* I, D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ?% c; F# F4 g" C, Z" I5 m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F& g( H2 \1 ~
* |! ]; ~ @% H: a9 Y$ \& f- dma_addr_t dmaphyssrc1 = 0;$ u# n2 ?+ O% O- i+ @
- dma_addr_t dmaphyssrc2 = 0;" P& c' i$ |& ]: I W
- dma_addr_t dmaphysdest1 = 0;+ J& E# P9 c, A3 ~9 [# Y* B
- dma_addr_t dmaphysdest2 = 0;
9 ~' M, c- |$ O7 j* E$ W. J - 2 S% I. y9 I, i' d/ ^
- char *dmabufsrc1 = NULL;
7 X/ [" W6 v8 j - char *dmabufsrc2 = NULL;" ?8 C" G' S. X
- char *dmabufdest1 = NULL;: [7 M$ ^% [" d( u% h0 q q
- char *dmabufdest2 = NULL;! I& a# ]3 p- N/ h
- ; I$ Y' g7 }: p# f
- static int acnt = 512;
9 x8 [: o" F1 | y - static int bcnt = 8;# B7 x1 [/ E2 o
- static int ccnt = 8;
) }9 m+ ^7 r8 _1 Z
6 J) _& [* @- }: d% r% Y' ?- module_param(acnt, int, S_IRUGO);) V, L* R- H" q. p, o
- module_param(bcnt, int, S_IRUGO);
/ {+ n4 T! W" P - module_param(ccnt, int, S_IRUGO);
复制代码
7 C, }" v, [7 \8 D$ R( g3 I5 [# Y. f f) R2 ^% j2 i8 t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% u, j- O8 e1 ^' a' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' [+ T1 e: l k7 d- d2 w9 ]& X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- @9 v# H" Y, B
& a; j' a+ ]7 I) C
8 W+ a. A: P* U0 u% D3 c |
|