|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
l$ x# ?0 b" B2 I- [code]EDMA sample test application$ I8 n& X& h g" [
- /*8 z& E! _$ h- G
- * edma_test.c
6 U5 g( q1 m2 k& t/ u# R( Q, o - *+ c: V' k. t( b' ?; J1 |* l& {
- * brief EDMA3 Test Application" U$ a' G5 P. B* a# `
- *" E" A Z# y1 i% R
- * This file contains EDMA3 Test code.
k) W5 L7 d# | - *
$ P# d; e( x- A& w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" u U, m& ~2 F; F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ M: M6 ?$ @& A, c. c - * TO CHANGE.
; n$ w5 p6 d. }- K# q; m3 F4 S - *2 A4 W4 U: J8 \6 a, p9 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( Y1 D' ~- t6 A' b
- *& p! f6 s! E9 a) f( ~ @
- * This program is free software; you can redistribute it and/or
/ @" ]0 t- c+ V$ x - * modify it under the terms of the GNU General Public License as
1 c) Z% P) S/ f - * published by the Free Software Foundation version 2.- T/ @5 T7 M P$ b* W7 }
- *" _5 w& V) |! B/ i- h5 a( x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 J4 B5 {- O! U" K
- * kind, whether express or implied; without even the implied warranty( V0 D. H4 ]+ {) l# B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 o2 C2 l. F4 s) P" M0 I% k/ q( T - * GNU General Public License for more details.& M4 x' G, f0 T' M" ~
- */1 p j) V. |" ?$ e7 P
- ) U) f! I' U& V6 F( f! T! c; i* [
- #include <linux/module.h>' w/ U+ j/ W9 w1 I5 a* y7 g% P
- #include <linux/init.h>
) a" L+ y1 c4 }3 { - #include <linux/errno.h>- z! }3 I3 [# I: t
- #include <linux/types.h>
; l* Z% F j5 H) B, O6 e' C2 M - #include <linux/interrupt.h>
9 i: L Z/ A4 d0 t4 Z4 u - #include <asm/io.h>
9 B& }' M4 y& o2 J/ Z) n0 V! P' e* T - #include <linux/moduleparam.h>
2 J* O' e; e5 ` - #include <linux/sysctl.h>1 {+ Y7 a7 R0 S$ t
- #include <linux/mm.h>) b0 r/ ]5 U+ C
- #include <linux/dma-mapping.h>- j8 |/ b6 z! D7 T6 m
4 N& W$ L0 J* Y! n5 L, j k' K- #include <mach/memory.h>
0 n4 u7 p; d+ D$ R1 ~ - #include <mach/hardware.h>
- ?% R& i' c( a; O# Z' c - #include <mach/irqs.h>8 ?- O3 `! x0 y, Q" z
- #include <asm/hardware/edma.h>
( s# ~* U- p a& G& \ - 8 |5 p: Z) n: w
- #undef EDMA3_DEBUG6 {) S" @- q) Z6 ~
- /*#define EDMA3_DEBUG*/2 N5 N3 v5 Q" a5 W7 u ~
8 f+ `) w: |2 }- #ifdef EDMA3_DEBUG
: l: D R2 X2 p. m2 ^& l7 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 ^/ C! I9 t. ~% z4 M, L; g( F- V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ z g# u: a# ~1 ]- ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 _( J. x- m# v/ G - #else
0 i9 ~5 ~- \2 F4 b& | T8 J - #define DMA_PRINTK( x... )
) z8 N4 o% T& R5 o$ ?; [1 G - #define DMA_FN_IN
2 _9 s1 D! K9 P. |! e: s! K - #define DMA_FN_OUT1 k- j5 X0 j6 v% [5 z
- #endif4 e6 Z1 R! o( {
0 Q& T0 t/ F, d9 F! f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 H z9 l) L: z$ [/ r - #define STATIC_SHIFT 3# ~. b. ^- _3 u& a! o9 @! w
- #define TCINTEN_SHIFT 20- }) N5 Q& V& p. m
- #define ITCINTEN_SHIFT 218 B* m+ F: P+ P5 x6 H
- #define TCCHEN_SHIFT 22
9 v) q3 J' u d7 ]% ` - #define ITCCHEN_SHIFT 23
+ V. H& M, V0 P& d- u- L - # J! |) D) q4 h8 r* a* ?
- static volatile int irqraised1 = 0;9 w4 E. o: \( e# r9 g* W
- static volatile int irqraised2 = 0;
" z/ b9 `, ^6 d9 B
9 z% X' L- {; e7 a5 Q; @" C) D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# @+ K/ ^2 r9 |) u/ I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ j& Y0 L1 p% H( v0 J6 t; G% \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: D1 z1 o- ?9 S1 u
- @' U2 v: z' r. {, a* R- dma_addr_t dmaphyssrc1 = 0;
# K* d. G4 e. J7 t Z& ~: i' M: H - dma_addr_t dmaphyssrc2 = 0;
( n; R6 l% [$ `$ E+ `/ a - dma_addr_t dmaphysdest1 = 0;
; i0 q) u& H, a: y! \ - dma_addr_t dmaphysdest2 = 0;
# b& w4 X1 v/ ~% i0 m5 B% X8 u
6 |/ W, I8 g- X- char *dmabufsrc1 = NULL;
0 J0 E+ r0 }% d- K - char *dmabufsrc2 = NULL;
' h, s" M1 r; O1 O - char *dmabufdest1 = NULL;/ Y, q! i. A# _6 p
- char *dmabufdest2 = NULL;
4 R% M) v, H; L- m$ c( ~
# g) @, W0 |& P% o' o( c3 H- static int acnt = 512;6 q: ~ n5 h3 K9 v4 c; n; B
- static int bcnt = 8;
; F' x9 ]$ Q0 _2 a - static int ccnt = 8;8 e! i0 ]0 P. v# l# l. |
7 k) i1 i+ j9 O6 A- module_param(acnt, int, S_IRUGO);
$ k$ U& T$ N7 i5 r U# g - module_param(bcnt, int, S_IRUGO);
# s* s5 U6 X& ] m: F W - module_param(ccnt, int, S_IRUGO);
复制代码
- K9 ?0 G" @7 O& y
. n. J- U" ~8 p/ w8 B+ e+ t# G( ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 Q4 `5 u/ [( @) O4 @: b" B
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' a8 p1 i6 P1 K6 {+ }* v7 o 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ]# S n5 }5 c% p) `
# A0 z+ {4 d& Z9 b. F$ C' n
) I* v, X& f" C7 h! R7 P |
|