|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' l* [4 L/ n8 ^' t& j( o- [code]EDMA sample test application* e8 K: p: t0 `: {
- /*; u+ p i3 J6 }( @1 h
- * edma_test.c" Y' J) t/ N! t9 u7 i& T
- *2 D" V+ g( R2 U) q( n. Q
- * brief EDMA3 Test Application
9 `: z9 d+ }7 k e+ P1 C7 G - *
- v) Y1 q3 d- Z3 t' B - * This file contains EDMA3 Test code.' Z( M$ H3 H" H8 x& I
- *" M" o! v: _2 r. J" X7 M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 z3 D8 I7 X1 p5 }% E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. y8 c( H& p: T! v! D+ G, i. _- Q: q
- * TO CHANGE.
7 e6 a! r( Q) _7 `* ~ - *
2 \+ \- b: T) R, Y7 y" ?$ { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! `- r# `3 w9 `6 X, X t - *
; v( U2 M& \) H' J1 s - * This program is free software; you can redistribute it and/or
2 u+ M a' Y& w6 g( r! j9 g - * modify it under the terms of the GNU General Public License as
5 s+ C$ B& |1 ^. q D' V* S - * published by the Free Software Foundation version 2.
, f& z' R1 g9 ~6 o0 q/ u - *
& X. C: E$ W5 c8 O# b1 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! J' q/ E' O6 W9 v. I% B8 x - * kind, whether express or implied; without even the implied warranty. \& ^8 ?0 n& s+ ]" y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( ?5 N! a4 L$ T5 b, i7 j - * GNU General Public License for more details./ [9 v1 B8 j* w2 V% N9 p8 f8 E
- */2 t2 a! x# H. u. v# {
. X6 k" y' f. ~9 F- #include <linux/module.h>) e& n+ _) w3 M# ~2 ?3 z7 ^; k
- #include <linux/init.h>
: M3 ^+ T" M. ^' { - #include <linux/errno.h>
) F1 D Z- K& G" Z - #include <linux/types.h> d8 J1 x+ H3 e+ N/ l' h; v* w" h
- #include <linux/interrupt.h>) R$ H, D- F; x5 a6 |
- #include <asm/io.h>! q* i$ F9 h4 a1 y% g8 m
- #include <linux/moduleparam.h>9 k* ~3 b$ u1 U8 _
- #include <linux/sysctl.h>
K f+ \ r+ J Z1 ?# Y - #include <linux/mm.h>
% f5 w7 C a, X. X& L - #include <linux/dma-mapping.h>
# b6 `4 }5 A% c( N0 y* o
2 J" i M2 x, C2 Y3 ]- #include <mach/memory.h>
) F9 @4 }+ E0 Q& r9 E8 y - #include <mach/hardware.h>
7 |7 V( e. @9 H+ `4 W - #include <mach/irqs.h>8 `$ K2 a' j' z; p7 P9 J/ K
- #include <asm/hardware/edma.h>
( l: X% U1 x& R$ ^+ {2 E* I" f! Y# b% [
3 a8 r$ B2 i* I0 c- #undef EDMA3_DEBUG7 {( B; Z; _7 ~, v: {
- /*#define EDMA3_DEBUG*/+ b7 R$ c+ p/ f
- 0 o$ E5 C9 `- ~7 l' r8 }
- #ifdef EDMA3_DEBUG
* a9 P) P+ ]& w* c/ |5 r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 g* l) r6 ^* X: W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); {. E% J3 H2 {- R- x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 H, [( o' C$ J: G5 W# n, C' I - #else
8 I6 n" C4 u, A' _( k - #define DMA_PRINTK( x... )
, P9 Y7 G# L* Y( I; E7 U - #define DMA_FN_IN
8 E) N) Q$ E* h8 u6 _- E - #define DMA_FN_OUT, V$ w) T( V: h- I# Y
- #endif
, O( `3 |' ^; K$ x- V- T% a - * j) C/ G1 O: A. J8 y0 \+ w1 Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
\3 B( G0 B, U9 a - #define STATIC_SHIFT 3
( d' J! k4 ^# z$ k2 L - #define TCINTEN_SHIFT 20
) i- V! u* s1 S# p0 n - #define ITCINTEN_SHIFT 219 {; W% ?! R% x& D' G0 k8 K* c _
- #define TCCHEN_SHIFT 22* a. P2 Z g8 `( D
- #define ITCCHEN_SHIFT 23
2 g7 C( ]* Z& Q$ D
' Q( O3 }% Y8 w' F$ _6 O# m" M- static volatile int irqraised1 = 0;$ C! b4 ~; R1 F1 L6 f" Y8 w
- static volatile int irqraised2 = 0;# E0 ]0 ^; h( \) g
# I' F* m# S. f% m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. W1 J7 P- h8 ?7 o7 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 J4 k1 n3 l8 h; c* b1 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 t# L# V0 L' c( \, ]3 v- [
- % V2 f% S9 v) X' [/ j
- dma_addr_t dmaphyssrc1 = 0;( ]- R. {" }/ w
- dma_addr_t dmaphyssrc2 = 0;: t3 b3 i( D. K+ x) j# l
- dma_addr_t dmaphysdest1 = 0;' E5 i. x+ ?& x+ y/ `
- dma_addr_t dmaphysdest2 = 0;) M2 T# N6 \( w) i1 ~
3 d& y& ]5 U9 i0 _- char *dmabufsrc1 = NULL;
2 W% L; K. I# W6 t - char *dmabufsrc2 = NULL;
( M% e$ ~1 _1 j6 C - char *dmabufdest1 = NULL;$ ~8 ~& y! j- `5 u' a7 W
- char *dmabufdest2 = NULL;1 M& b- {! o) R) R, b
- 6 z- _% l7 a+ U/ m1 s
- static int acnt = 512;
4 ]8 T6 f( j, d7 K. e: O# u - static int bcnt = 8;8 L* S( l4 U& A
- static int ccnt = 8;6 H ] a! O% E# \. T, _
5 R. ?* Q: ?# g B- @1 v- ~- module_param(acnt, int, S_IRUGO);
% l- Q, @; a. B/ ]" y( @+ d7 Y - module_param(bcnt, int, S_IRUGO);
$ G3 \0 E: u3 c3 c7 ]9 h - module_param(ccnt, int, S_IRUGO);
复制代码
; W) J) ^ j5 [( P, V$ k
+ @/ H5 s. |3 w' k* @. S 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# R2 G ]7 `! w2 u- U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: c- a3 z/ H: J9 t2 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; n2 K- d! f# f' S/ a1 R4 g) O) M4 d/ L) w" U. R
9 U/ K' s4 t) P4 g1 ]
|
|