|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 ]/ ?1 S: R4 b1 r" m" k
- [code]EDMA sample test application: }; s; f/ J% F6 u& i+ j# p
- /*
Z3 d4 c8 Y( t% [ - * edma_test.c$ R) }( A: y3 |: m
- *
* H) T( n( s/ v9 F - * brief EDMA3 Test Application$ C, R) P/ H7 J, I, M9 D k
- *
! N( a, Z: G; o4 ?' x - * This file contains EDMA3 Test code.
0 W! U; e$ e; y) f# ^6 N - *+ ~& `+ D" A1 K# ~
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, l" R0 p, d% E% J! n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) c) u$ h/ A" B
- * TO CHANGE.
' X5 S+ o, ]$ g6 a) | - *9 V$ {3 \3 H1 |+ f. Z8 F7 r5 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 n: B# v! p2 \
- *) [: W( I' u m4 r y9 z; |8 d8 I
- * This program is free software; you can redistribute it and/or5 P: U+ G {( Q9 ?& ]0 k
- * modify it under the terms of the GNU General Public License as# M' `8 D0 X6 {; }% @/ a" a
- * published by the Free Software Foundation version 2." y7 ]* i4 o* q1 B5 u: b
- *, f2 [- h( g; c7 t; v) {/ l) n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 p7 j j# h2 x$ V5 W
- * kind, whether express or implied; without even the implied warranty
+ h# | t& t# p. c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( z- W. l4 b/ l9 [# I* {7 q
- * GNU General Public License for more details.% b9 m8 a( n( w% ]
- */% D8 y( |% c$ C0 f/ N7 \
- % U" I7 q6 K+ [7 j/ ?0 r
- #include <linux/module.h>2 Y: N+ ~- e8 r' o
- #include <linux/init.h>0 v% B" n4 ?* e+ [2 z' g# J
- #include <linux/errno.h>, N! Q" T& @/ M& @4 p
- #include <linux/types.h>
8 L: z1 }" s6 O* @# I( J: f - #include <linux/interrupt.h>
n1 f3 p7 ] @- S - #include <asm/io.h>
0 @1 {% O: J: B4 Q - #include <linux/moduleparam.h>! J+ u5 C3 @- L! ^$ G/ Z
- #include <linux/sysctl.h>! C4 V* h5 U& v5 T- l2 A i: E& R3 _$ Q! E
- #include <linux/mm.h>
0 w: k) g0 l& y z - #include <linux/dma-mapping.h>
& Y( L4 Z3 r9 Y
2 Q- ]# U# h j7 P) a5 ?- #include <mach/memory.h>
0 ~$ P! V* ~1 K5 s4 M. B8 { - #include <mach/hardware.h>
! @* q w7 k4 L" }8 N% [' E- K - #include <mach/irqs.h>
: u1 l! N# Y2 Z; w* d' A - #include <asm/hardware/edma.h>
8 y# K4 c' M0 b% f+ S
5 V- t* [+ h0 m- #undef EDMA3_DEBUG( m( U" T% A, v7 h8 D) y
- /*#define EDMA3_DEBUG*/
6 R) [3 N$ z. [8 O# ]" E - ; Q; N1 l4 M: T/ e! i) d
- #ifdef EDMA3_DEBUG
9 N: p; G9 `% O0 ^# I& U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* H' ]6 t9 _/ q" r% P5 x! o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ^& o) B" b5 N& B3 y$ B0 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ v1 D& h+ h9 b' i - #else
$ O3 G# Q' {2 S" G - #define DMA_PRINTK( x... )
' ~1 Z0 E" e b* l% d; f - #define DMA_FN_IN0 |0 g S& X7 |3 E% a2 v% {
- #define DMA_FN_OUT2 l1 A; s& h' j6 \" w, E
- #endif
_8 _+ e- {/ ]. X$ E" b: ? - $ r) }2 \6 F P! ^! Q: u1 e$ g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( Y+ b9 P6 i) j, I
- #define STATIC_SHIFT 3/ o# |" \! g. t1 d
- #define TCINTEN_SHIFT 20
. ~8 X$ i$ \6 M E - #define ITCINTEN_SHIFT 21, m1 x8 ?; \2 W
- #define TCCHEN_SHIFT 22& x& D" k8 @1 {& L/ J! C- w6 M9 R
- #define ITCCHEN_SHIFT 231 q* L$ F4 i6 y y% m: v( M
- 6 y8 J6 l+ B7 U* \
- static volatile int irqraised1 = 0;1 o, f& H. P% S
- static volatile int irqraised2 = 0;
, V2 t/ X* b) W
6 h1 w% f: D3 ` r' f m' }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p. [* i0 r; N3 S8 R0 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
F" Z4 V L+ B0 v* c( e& E, Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
~0 U P' o4 }9 P
1 a$ u5 o8 p0 a6 q0 n8 j- dma_addr_t dmaphyssrc1 = 0;
( o0 |- |9 f& \# C) S - dma_addr_t dmaphyssrc2 = 0;
6 {1 p1 d+ [( e. o4 q3 C) j) d - dma_addr_t dmaphysdest1 = 0;& x6 A& ]0 B$ x/ K1 {
- dma_addr_t dmaphysdest2 = 0;
3 z* q# J4 n8 w7 s2 x$ ?* ?( j `0 h
$ Y. D# M9 U5 x' ?, o# e! Y- char *dmabufsrc1 = NULL;
* b4 |" [( M) b - char *dmabufsrc2 = NULL;
3 u1 Z C! B: c5 n$ O& C" \ - char *dmabufdest1 = NULL;2 |( L5 S5 `. J3 C2 ^# F
- char *dmabufdest2 = NULL;
% _, Z4 M" \" j: w9 Q2 B. A
& Y6 X! E2 E# L- static int acnt = 512;: R: }0 _: j2 X- ?- s* z' @1 L% q% G5 ]
- static int bcnt = 8;
& b& G: ?5 e6 c2 x - static int ccnt = 8;& M! [+ c, C2 k9 O( G: P$ P- |
) ?1 x1 h# o+ |$ f' u- module_param(acnt, int, S_IRUGO);
/ F2 T: C7 ^% ]: S - module_param(bcnt, int, S_IRUGO);' S4 |0 ~7 _4 S, N3 m% D/ }
- module_param(ccnt, int, S_IRUGO);
复制代码 ' I! y0 @/ [7 B5 y: w
) b7 n; v; \' m- V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 i: u Q" V# r) P) N. W/ R* n0 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 Y7 y6 G$ e ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: t, L" M; G3 `" s) _
8 r; ?5 B7 B. ?8 {7 _- Z: L; b8 N J- Q
|
|