|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 b; @4 D; v; ], G4 r7 X
- [code]EDMA sample test application0 k! A; X" S3 U
- /*) G# ?4 u- R; K; k* T
- * edma_test.c
0 I! ~! m1 M( j" U - * I) ^; u, O2 r5 c
- * brief EDMA3 Test Application
9 d% u9 D0 ?9 V; ~; m! v( A - *
7 c' W0 `* M2 S; I - * This file contains EDMA3 Test code.
* z$ y Q- a5 ], N( O/ r# Y- A% p - *
9 t" T+ ~: G9 `! F5 r, u5 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 {$ j0 X& E, X5 m6 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# J% a0 _( k3 `' y, ^- g
- * TO CHANGE.
5 e& f! |% n/ `& Q7 o - *
2 K$ x+ B" l3 ^6 V" K1 o: G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- f% J$ k0 e7 L8 ]5 p: X! T
- *2 a8 D6 X/ C. G; D' z
- * This program is free software; you can redistribute it and/or3 v- j u* j# q( J
- * modify it under the terms of the GNU General Public License as" ?2 v! l0 e) g7 e# O% Q
- * published by the Free Software Foundation version 2.# R: z3 n! M0 T! c
- *
# d7 F) r4 w/ n" r+ g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 N; z$ v+ I m8 n; N6 m% I
- * kind, whether express or implied; without even the implied warranty P0 p7 k; _' s& W3 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, ~0 a. z- |4 _2 t( e, Q: X% z - * GNU General Public License for more details.
h1 H5 d6 a+ r2 {6 o5 U - */
4 z6 d; D/ l8 m2 n - & J- n2 N9 ?" r7 s
- #include <linux/module.h>
4 @1 M( } F8 X! c2 c - #include <linux/init.h>% R4 ^8 L& k. X; J2 J
- #include <linux/errno.h>, C8 S! p5 K) y j1 ?% h0 G" f
- #include <linux/types.h>
* }/ y7 {" R. u% ^6 a - #include <linux/interrupt.h>9 m& @8 a P/ ]" e. q% k
- #include <asm/io.h>
; R7 y1 y# |' y; ]0 I - #include <linux/moduleparam.h>2 z2 z4 `! I0 B) y# `
- #include <linux/sysctl.h>
( ]2 O `/ v6 v - #include <linux/mm.h>
i. G" @; L: d5 U1 t$ D - #include <linux/dma-mapping.h>
0 l# t- Q, {" }' x9 n
7 x# C3 P1 t6 t# a- #include <mach/memory.h>' z8 O, l$ c7 ?: |+ G) L
- #include <mach/hardware.h>1 b( v+ O3 y9 ]
- #include <mach/irqs.h>
8 r8 f+ R4 c) b9 } i. r% a - #include <asm/hardware/edma.h>
. D" Q7 n) s5 V- m& K; |/ |3 ^ - 6 t; T- \/ e* W7 @) l# k4 Y$ }
- #undef EDMA3_DEBUG3 Y, T4 v) E- }) L6 r/ B: }( w
- /*#define EDMA3_DEBUG*/
- ?# u& C2 W9 J
& _5 F6 A% Q& g- #ifdef EDMA3_DEBUG, ]" j& e7 j* L8 O# V: L
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ T$ Z, k2 f- p8 [$ A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); Q/ z" Y* K u/ M5 ~' `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* a% a. v! \4 Y6 V2 b C% r - #else
$ y7 u6 k3 J! m7 i0 [) V$ _5 u5 o - #define DMA_PRINTK( x... )3 k' r( |7 z9 J3 i) @: M: J) t, K4 K
- #define DMA_FN_IN7 G3 x5 F, [6 D2 U1 c/ d5 i
- #define DMA_FN_OUT
' x! k/ ~+ f% F. w$ G) X - #endif/ V8 d1 U- b6 L% e+ h
- ' i; l9 Y3 _5 S6 S3 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) U4 @3 |+ V3 {) [8 @
- #define STATIC_SHIFT 3
# Q) s; U+ ~: T$ D - #define TCINTEN_SHIFT 20
( C' `) o$ F& E6 k6 C7 ]# } - #define ITCINTEN_SHIFT 21- H, R* U6 a* B
- #define TCCHEN_SHIFT 22
( U8 g3 c) ~8 ~+ p) S - #define ITCCHEN_SHIFT 23% v/ z# o |$ w# |0 B3 W* c# {$ q4 E
" S1 P C& E5 m, b" [- static volatile int irqraised1 = 0;3 w/ n4 n8 F4 G
- static volatile int irqraised2 = 0;; H, ]! f" k: y' o7 ?$ ?) o. u
- t# b- O1 u4 v& g9 c+ p2 j9 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' Q* h% L1 q+ k ~- ]
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 S7 c p: u J9 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H2 Y% u" ^/ j0 b
- ! ^$ n0 r: U1 T, O( \
- dma_addr_t dmaphyssrc1 = 0;" w+ s* r( U& C8 E9 }$ T5 q1 e
- dma_addr_t dmaphyssrc2 = 0;
; ?+ R% d4 y! \6 O - dma_addr_t dmaphysdest1 = 0;
# \1 J! O- Y2 \4 ^) N2 L% a" S3 L - dma_addr_t dmaphysdest2 = 0;
; N) I4 Y9 a: ]+ I! J" l
' N& p. G% m) N- }- char *dmabufsrc1 = NULL;5 h& G- ]2 X2 O/ a- Y
- char *dmabufsrc2 = NULL;: a0 I/ o! [( D: y# l
- char *dmabufdest1 = NULL;
; m3 j9 o- R1 H: d/ O. R5 f/ J& I - char *dmabufdest2 = NULL;! k. k: }! m% |2 H' A
0 \- _; I, S* J3 p' t- static int acnt = 512;7 e) q1 p8 D6 }- g7 T4 N* F
- static int bcnt = 8;
8 E# b1 q, s) I1 [ - static int ccnt = 8;
* b6 p9 X" U9 E. B; W+ P
9 l) G4 v( E1 C' a- module_param(acnt, int, S_IRUGO);) T2 A$ t% S: W
- module_param(bcnt, int, S_IRUGO);
! E; S+ i5 E1 ` - module_param(ccnt, int, S_IRUGO);
复制代码
5 D% H2 T# A2 V9 t6 u
4 d' ^+ i0 n c5 y8 Y" k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: |, }, J" X8 q# b! K$ h2 ^) Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 Y( @; J! R4 U: A, n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 e0 |6 }5 i9 C! |6 R, K5 o( |
9 Q, U$ T! d& w1 }5 w- u$ N
/ X% @9 s4 q+ s' o$ A: J( f- M$ [ |
|