|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 d m7 M& G5 j* a( a8 K& e: R- [code]EDMA sample test application
/ E. S$ m7 Q* q - /*. x3 E7 E6 B% b3 B5 n" Y2 g
- * edma_test.c
( y$ Z9 z2 [/ S$ k5 r* U a4 \ - *) _' C9 _5 t5 N4 p% {
- * brief EDMA3 Test Application& m% S' I3 k4 a5 G0 w" Z
- *
6 c# Z4 _, o7 S! z+ i - * This file contains EDMA3 Test code.
3 U: f1 P ~; d2 o8 a6 D4 ^ - *
5 Z+ T, i1 O# M/ [& S3 \4 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 H: V7 m+ U' V" T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ f& f; F* I+ }5 p& u - * TO CHANGE.
) P4 r- B$ y" t+ s+ q7 \ - *% w/ J: {7 Z" e- h( r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ }% [; O! ^1 U2 K8 @! X! h* P - *! M7 x9 m4 l2 r" `( _- }/ p2 a
- * This program is free software; you can redistribute it and/or
' o; F" x1 `9 w* o - * modify it under the terms of the GNU General Public License as( K# k5 I+ d$ P9 R' H( m
- * published by the Free Software Foundation version 2.
+ v! l6 t8 e6 F - *
+ b& s f* ^- u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' Q5 T3 y0 g, r/ [* @' z9 b - * kind, whether express or implied; without even the implied warranty6 g+ ]6 v" B" z9 N, o4 y6 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ]$ {. b: L# [& Y8 J5 |
- * GNU General Public License for more details.2 x2 d: V& i# h/ }0 R% Q( a
- */: G; W: S: s1 ]5 `
# ]$ K }! B% ?6 K. P- #include <linux/module.h>; w) B! B2 l, q" F) c! u
- #include <linux/init.h>% C0 D5 p1 ^: g6 b
- #include <linux/errno.h>
2 _8 v* e* J) I- `0 Y4 w$ O( ~ - #include <linux/types.h>+ p Q" q- L ^8 d \: f& I& A0 P
- #include <linux/interrupt.h>
0 `6 Y! f2 e) ]& R - #include <asm/io.h>
5 s; a% X/ X, o5 f9 f9 ?- |$ i - #include <linux/moduleparam.h>
$ L% o' l- S9 K! m - #include <linux/sysctl.h>* e/ p0 T+ v) l, @
- #include <linux/mm.h>
6 U5 P4 n- M0 N8 l, N- u+ W - #include <linux/dma-mapping.h>
. B* r; Q8 B8 x6 J. ?
+ G( C& Y8 ^, T. A& q; R- #include <mach/memory.h>
5 a T. N4 i! l3 ] H q @: w! J: { - #include <mach/hardware.h>. g- W5 h& x/ c. W+ V
- #include <mach/irqs.h>
* u- I7 D( O* A; k$ a3 E - #include <asm/hardware/edma.h>4 T% S9 z, f+ T/ h$ F5 t
- ! l8 Z8 u: X2 w0 C; A, _, ^
- #undef EDMA3_DEBUG
6 y. Z$ ]% T3 r - /*#define EDMA3_DEBUG*/1 U% H/ o% |( }& S3 U
: z& k! J; k4 k$ u1 F$ { @- #ifdef EDMA3_DEBUG) D# `' i% _' a; B. p- V y7 O1 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' N/ ^+ ^$ b% ~9 T: E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 q- c' T) ?5 Y" r' B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 z% q. t3 Z+ ?. g( T2 @+ E
- #else
+ j1 w9 n! ? L- }7 S7 { - #define DMA_PRINTK( x... )
3 ~; F4 ]1 H7 l2 T$ E# [. W - #define DMA_FN_IN5 l) n& H7 x" h) Q) f) {% ~) H5 i
- #define DMA_FN_OUT* N7 b r3 a4 e
- #endif
J+ w. r6 x3 `* S0 e' R" ?( M
" B0 ^) E, _. ^$ Y9 @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 S( G# j. r. V7 @4 l8 W9 I" A - #define STATIC_SHIFT 3
1 p6 H4 K; C3 O* d2 p2 q5 l - #define TCINTEN_SHIFT 20/ y4 B% K# O$ E
- #define ITCINTEN_SHIFT 21
( A/ r; @6 J" `* z - #define TCCHEN_SHIFT 22
; f4 _ _2 {5 V9 ?: V - #define ITCCHEN_SHIFT 23
& {1 _# @8 p+ m. m' `5 o
' A8 ?8 I* J; F0 M8 Z- ^9 J- static volatile int irqraised1 = 0;
- ]) @" y0 l: i/ {- L - static volatile int irqraised2 = 0;% X8 j7 z+ o/ h3 c* Z
# d* K4 q9 O/ x0 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 S& Z- a1 E/ k. x2 ?% a! g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 [) j* f4 {! x" V# c7 f; N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" O2 D& y) i) Y5 B
$ c4 B; p6 u0 r% G } E: I- dma_addr_t dmaphyssrc1 = 0;
" `5 ^) Z6 \9 K/ D - dma_addr_t dmaphyssrc2 = 0;
1 B! d& R5 G; Y0 C: d8 T - dma_addr_t dmaphysdest1 = 0;
3 ^ h9 P8 {7 y4 A1 ~. Y* T - dma_addr_t dmaphysdest2 = 0;* P+ i' ~3 j" |, ~& |) O8 A) X
* H# m% h6 O: X0 k _1 t5 G- char *dmabufsrc1 = NULL;
+ z5 t" N* c, N3 l4 h( ` - char *dmabufsrc2 = NULL;
; o3 g% ]% o$ t& |& b7 b - char *dmabufdest1 = NULL;
8 z6 Y# w3 m2 l% A2 v - char *dmabufdest2 = NULL;! K$ h7 p# Q# P. q( w* ` d
4 U, F* [ Z. w. C+ A1 J- static int acnt = 512;
$ P2 n \' Z6 g& V - static int bcnt = 8;
1 Q0 N% m" s- I1 F- \% o - static int ccnt = 8;
Z8 r& C# O7 |. K- F8 u - z! N* g. y5 K# B( a2 m% ~
- module_param(acnt, int, S_IRUGO);: p* q. J+ D6 n6 A
- module_param(bcnt, int, S_IRUGO);
* ?( j3 M9 ^* J2 Z - module_param(ccnt, int, S_IRUGO);
复制代码 + O. s' g1 K7 i( U
4 p) }2 @6 T& b/ V& I3 D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 p. q g `4 | H$ H" _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) `9 ?4 T& U% c" B8 ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* f% U1 Q; L7 w
! ^& Y! ~5 y0 C. w- v$ {, \
* i% t2 t( A* J; k( q |
|