|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* P* R# b3 L9 b+ A0 n- [code]EDMA sample test application5 U) P' r4 u2 h
- /*
. h1 p) f3 z) ?4 h - * edma_test.c7 y b( d# o& O& Q. M
- *
3 u7 G; b5 R2 k! ~+ T. @ - * brief EDMA3 Test Application* f" |: N, @1 W# e3 y) D
- *; Z7 U7 ]% d) R y4 U" l
- * This file contains EDMA3 Test code.
% b X. N9 d6 _/ |% R - *
$ \- O3 ~5 W' P) ~0 m - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! @8 A5 m/ b& A T# P0 s P/ j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 d: U1 z) F. D6 U! X
- * TO CHANGE.
! _0 A( ?- l7 l# q v - *2 D+ V2 Y6 \, L& g; [6 V4 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 \, l/ W5 e! Z+ o - *
9 b8 P6 I( H' u - * This program is free software; you can redistribute it and/or1 ]& q' I7 K6 B0 `6 O+ ?# O" D& B
- * modify it under the terms of the GNU General Public License as
: K3 { J2 ]( T8 W - * published by the Free Software Foundation version 2.
0 o# W9 P2 A% n3 o: s+ B* \ - *
8 H4 r# ~/ A' L) f9 T2 m; y7 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* E4 Q- R5 b; `/ V, g
- * kind, whether express or implied; without even the implied warranty. _! h/ n! }4 t" t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! l9 q; u1 V$ H6 Q4 |( y' T) e
- * GNU General Public License for more details.
+ B) C- a/ v, U) n - */9 t- b. \1 z, ^* v, v5 n
- 5 U& ~; V/ d( D& m
- #include <linux/module.h>
# A _( K1 ]3 a - #include <linux/init.h>( W3 ]' C6 L8 K' t4 n
- #include <linux/errno.h>
5 D7 r6 e/ u0 n - #include <linux/types.h>
0 n8 G+ p" Z* t - #include <linux/interrupt.h>* p; X' `9 K# I. o0 ~
- #include <asm/io.h>4 T% L# r$ o3 N
- #include <linux/moduleparam.h>* N% D. Q3 y# w, F0 Z, ^' j" m
- #include <linux/sysctl.h>! L1 {7 X6 K" A
- #include <linux/mm.h>
' ~, L4 g( P+ T& x: V, P6 e+ I) U! R! j - #include <linux/dma-mapping.h>
0 E+ v# i0 z$ p
4 y0 p7 s9 S! e- #include <mach/memory.h>3 F9 b# k& A% G/ v9 S% a5 u
- #include <mach/hardware.h>
- E- I* V9 n" |# S - #include <mach/irqs.h>
' | b4 l1 R2 r - #include <asm/hardware/edma.h>/ j& W3 X2 j+ N% J- N
- I2 a `. z- K4 ]9 r- #undef EDMA3_DEBUG
" q; e! u4 E8 g, F2 Y5 j8 B, ~ - /*#define EDMA3_DEBUG*/# k/ ^: U# U0 I7 [& u
- % S$ P& ]& A4 t' E" Z# x
- #ifdef EDMA3_DEBUG
: e# N2 K% S H. m9 L( o) e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" ~& \5 l$ a& O& F4 J5 e+ S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. G+ ~& W6 V' }. m8 K' x9 o# J$ k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# C3 ~; x; v5 j1 j - #else* u) @% a& [9 M* N$ E! V
- #define DMA_PRINTK( x... )
) D5 ]" A7 I: p: H7 U9 O2 a* C. d - #define DMA_FN_IN
G' `6 g, f. i# |' Z - #define DMA_FN_OUT
; a5 X" Y- }; r/ i( f; E# @) X - #endif
& y, J: v4 o2 s
9 m3 {" `4 \( k; W& B8 h2 y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 j: `% {8 `: ?$ G8 ?" D - #define STATIC_SHIFT 3! K) Z0 ~7 }* m" p9 M
- #define TCINTEN_SHIFT 20
/ D9 s/ R1 ~, b' B$ x* n( Z - #define ITCINTEN_SHIFT 210 @% a0 J- f% Q. |! m- \
- #define TCCHEN_SHIFT 22) A# G6 n+ ~" n3 m* J2 n
- #define ITCCHEN_SHIFT 23
; z8 M& W" o b' }: l
: m) v- K$ ~- ^ I, O8 X# `- static volatile int irqraised1 = 0;
" }0 L/ D' ^- _ - static volatile int irqraised2 = 0;9 E& l( f0 P6 n
' I2 r3 `, K) z. Z! ]6 T/ a! }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B8 H3 O- j! v0 `7 F9 X9 f- I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 y5 U& v: j8 P5 X) H* U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 I, k6 v2 ^* ^- V6 v8 {
- / P9 {4 A$ W/ [
- dma_addr_t dmaphyssrc1 = 0;3 [. K5 u0 l) v# O* I3 B
- dma_addr_t dmaphyssrc2 = 0;
; R- Y& N4 G' J, E: r5 a - dma_addr_t dmaphysdest1 = 0;; {3 i. U ]2 Q7 q a
- dma_addr_t dmaphysdest2 = 0;
% |3 `3 K, K6 p: G) d: a$ B
# a6 v, {: B: A; L$ f- char *dmabufsrc1 = NULL; F% B; o1 R* t$ R
- char *dmabufsrc2 = NULL;" X- K2 ^5 X, R0 D+ i$ V }1 u
- char *dmabufdest1 = NULL;' ^: S3 j' S$ t; b1 U8 Y' K9 p
- char *dmabufdest2 = NULL;
/ J9 z; _8 ^5 W2 m9 Q/ E
d, s- ~' N1 T% I% d- static int acnt = 512;
( c. ]6 w$ f0 R9 W3 {5 X D - static int bcnt = 8;3 F8 R5 P( Y4 u! W
- static int ccnt = 8;
. t3 A* w" C, |" W/ T - $ @( H7 }& N- s+ E3 Z- C5 R7 s
- module_param(acnt, int, S_IRUGO);3 }% b1 L5 {# W" X) J+ W7 V z
- module_param(bcnt, int, S_IRUGO);7 u0 t _! j5 }4 K' Z+ {( l7 G
- module_param(ccnt, int, S_IRUGO);
复制代码
; Z9 R& U5 y+ j5 l* l4 z
4 |2 K; c) w' c5 K0 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; I5 Y9 P& b& j7 a" @( z% i2 ^, j5 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! {9 r# |' w6 V+ \; Q* L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 a$ V, q2 ^' ^- l
) m6 y$ F& I1 A5 P( Z
3 ]. [! c4 b: W' l! p
|
|