|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 ?) |' f6 q1 T: q9 T& E- [code]EDMA sample test application
2 A+ v s$ R1 w1 {- Q" T - /*
+ l+ _' L. Z" U( f0 F) D( G8 V - * edma_test.c
5 H% R! Q: [/ \7 O+ }: o - *: L; J8 I: s5 j- b
- * brief EDMA3 Test Application
3 S$ _" Z1 t2 Q/ A - *
) D( F W& p+ x5 N- J& D* m - * This file contains EDMA3 Test code.7 @9 j& P& h/ l/ o4 a( g2 `* g
- *. K2 j! T8 n8 d! f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' P$ b- g9 W* y. L5 M& U0 ^0 }6 } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 N+ V% [. P) t0 C5 V3 E- O - * TO CHANGE.
6 B0 O' k! S6 g/ D5 Z3 x - *
4 G }, d" T$ l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( r* z8 ?* R7 `% b* N9 {& d - ** E# |0 I8 x" c3 e
- * This program is free software; you can redistribute it and/or3 J7 c1 ~9 ^. V7 H
- * modify it under the terms of the GNU General Public License as3 s! P1 P: ]$ @8 r7 c3 B* f! |! w
- * published by the Free Software Foundation version 2.
. |4 |) M% e- q U0 g+ w0 g - *
* g+ a3 Z# M7 R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, ^* J! c/ P& V3 d5 F( q: |$ y
- * kind, whether express or implied; without even the implied warranty: r4 F1 F9 e! }4 c# o% G6 F3 H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. Q0 @+ v$ t4 T& a3 t0 y: J0 Z - * GNU General Public License for more details.
2 U [& b: P! H+ |3 } q, B% B - */
3 p j! k0 o' t l6 L
" v4 R& s' Y; L" t4 G m" v- #include <linux/module.h>
( e* [$ M, K1 q5 r$ T _( e - #include <linux/init.h>
- ]5 k% B( @! V) O - #include <linux/errno.h>6 f4 z- M; M$ q" A- D
- #include <linux/types.h>
7 m6 t- J/ D0 w" W1 I/ g - #include <linux/interrupt.h>
8 A+ O/ R- r9 E$ H4 h- D, L b - #include <asm/io.h>
' E0 t8 f7 k# `% ?7 h" g - #include <linux/moduleparam.h>$ d- [/ e) L# {
- #include <linux/sysctl.h>* N5 `8 \# G& \7 Q2 M* p
- #include <linux/mm.h>
" C. N! b2 ]5 L( D2 w, |6 N - #include <linux/dma-mapping.h>7 L& R/ t' ?) ^( j6 ^3 n2 c
& y0 G7 p: e+ \& c% O- #include <mach/memory.h>5 i( R" Z5 e5 j
- #include <mach/hardware.h>
R) W, N% _3 I; n - #include <mach/irqs.h>
6 T' E# P0 Q" p6 |- l3 M* ] - #include <asm/hardware/edma.h>% k1 F. ~& Z; P) t0 z) G4 p% v
- 9 _2 I3 B0 u+ Y4 A* g/ U% R
- #undef EDMA3_DEBUG; N/ s3 _) ]5 N7 \1 \: }' B
- /*#define EDMA3_DEBUG*/
T6 X+ J9 a1 K. p7 b
8 r% w5 X- h3 d) W0 ^, _7 u- #ifdef EDMA3_DEBUG# [7 e) H& D7 w; n. A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; R0 N+ b- F" k K# p( q6 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) z* f2 K9 \# P' @8 |/ `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 n3 ]7 b7 \4 z- K9 s; f$ v$ y
- #else" L J2 j3 h& l8 K# J
- #define DMA_PRINTK( x... )
- m% W2 V2 C8 ?6 I; Z3 J2 Z5 _ - #define DMA_FN_IN) \ {! U( A. `/ Z7 s: F
- #define DMA_FN_OUT7 j1 I! U- s+ P. o1 L
- #endif+ s4 o$ y3 K B" U8 V
- ) z) H, s* a. R! E, f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 m2 g% N) V2 E0 }/ }
- #define STATIC_SHIFT 3
% I9 M# s6 r- ~* S. F3 ] - #define TCINTEN_SHIFT 20* u' y. M( M% ~& L! P/ a: ^8 g
- #define ITCINTEN_SHIFT 21
& k$ T9 c0 l5 @# [ - #define TCCHEN_SHIFT 22; O$ u5 S( c; N, F& |
- #define ITCCHEN_SHIFT 23
) g/ I4 @ {2 L; c% E1 _
+ @7 ^7 M$ {, b" p% O1 r- static volatile int irqraised1 = 0;
+ N% I1 L) T0 H. [& S9 h4 W - static volatile int irqraised2 = 0;
8 t4 @( G$ i" y( p% V - 3 z4 w' ]9 B* e3 [5 A9 u& {+ {2 b: r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 w& g& i1 }/ h; t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; V u2 l: T3 Z/ }8 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c, I* d. j9 ?: Q* n; D
+ E" t: d" n( v$ X- dma_addr_t dmaphyssrc1 = 0;, s3 O- i, V# R- z: }5 `' ~. L
- dma_addr_t dmaphyssrc2 = 0;. V: r; L" h9 w) Q, s3 A' k2 {
- dma_addr_t dmaphysdest1 = 0;1 b( W% {2 t$ {. F$ x
- dma_addr_t dmaphysdest2 = 0;1 p+ N' g& t) I3 M
8 i9 n) n" Y) o- char *dmabufsrc1 = NULL;6 i3 ~3 t% o" a# N" Y
- char *dmabufsrc2 = NULL;; I+ ]6 Y* M4 ~: F3 f" f
- char *dmabufdest1 = NULL;, [% O2 k7 \' N) d8 u
- char *dmabufdest2 = NULL;
2 @6 \3 ~/ [& a- O% t. q- o# r - / @8 F3 b% r. V* z2 C
- static int acnt = 512;
; p& t# X. r+ p/ f1 Q S - static int bcnt = 8;8 |- M! F( Q" ]8 j
- static int ccnt = 8;
% w/ Z, t8 A3 D3 r) v9 I" v) N t - ; B2 e9 Z2 z$ I* f
- module_param(acnt, int, S_IRUGO);
! e1 ~" ~4 t- |" Y; _6 o% S - module_param(bcnt, int, S_IRUGO);4 s) \2 z0 r, q0 C
- module_param(ccnt, int, S_IRUGO);
复制代码
6 t# Y* {' ?/ P2 L2 Y5 f
+ ~0 ^' K$ X, S& S: v; J4 t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 c( N6 z" Q! E1 E' b) f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 B1 n5 G, _ m: k5 M1 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 n2 i3 B8 s& k
. I4 c/ `! ?3 H& L, w
2 f, v( {: i' i8 ]# [( X
|
|