|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 X# x5 s L9 j. Q7 N4 d
- [code]EDMA sample test application
8 R5 e1 T% |3 @! v5 n - /*# s/ d# r" R. l1 z# ^: z8 c
- * edma_test.c
$ U# m# D [3 W5 A: O - *
/ d: j3 ?/ h1 j( Y" I3 V: z - * brief EDMA3 Test Application# e. s* u& I- C
- *- g5 Z2 n' V, n) ^2 h
- * This file contains EDMA3 Test code.
' w; v' F9 B8 c4 C/ o- W2 E+ _ - *8 a, _! P/ A* ?& R$ n1 w d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) `2 o( r) T2 h: ]: I& Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% }3 f; ]! X; T$ E9 v
- * TO CHANGE.
* @7 u4 w) r" z% A$ }" [ - *
8 q; E6 f x% @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& {/ S, F3 p9 i+ N0 f. W - *: J7 W. W: [; m" K- k" H
- * This program is free software; you can redistribute it and/or# ^$ ^8 S+ k9 H3 l
- * modify it under the terms of the GNU General Public License as
h2 `$ D% a. N5 M - * published by the Free Software Foundation version 2.
& T4 [' ^# V' H& g8 \+ w' v - *
6 z3 @7 ^# L2 Q) d3 X - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; R9 G4 C/ x+ u - * kind, whether express or implied; without even the implied warranty
, |& j3 k7 K3 T# Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, O8 V8 u$ C: j! a+ X% b ^! x# | - * GNU General Public License for more details.
$ }. e4 G6 p3 U' Y! P5 S - */ T+ _$ S+ y5 F% |
3 l# }* j& \7 T3 {3 q( @- #include <linux/module.h>
" [2 F* F1 s; z1 Y9 I+ l X: \+ c - #include <linux/init.h>
- }* F y# X5 O# G/ ?; a5 { - #include <linux/errno.h>
. W. @+ E7 ]& `" z/ W - #include <linux/types.h>
, {4 s3 T8 R' {9 t9 F - #include <linux/interrupt.h>, H/ F1 R0 `3 A6 ?- i
- #include <asm/io.h>
: P r' B# Z+ A& g - #include <linux/moduleparam.h>
2 z' |% h- x5 ~ F/ _% G6 | - #include <linux/sysctl.h>
; j4 l( n$ `# |8 e, [1 w, W& I - #include <linux/mm.h>
6 `* k/ E" ^* m0 P - #include <linux/dma-mapping.h>
: u$ L( P7 V" c3 R6 n7 V - 4 ]/ R; H; C! v/ \; ]$ d6 @" u
- #include <mach/memory.h>
9 o+ Z* c1 B' g) D/ U6 f - #include <mach/hardware.h>( w a1 v1 S3 e' R3 b/ F
- #include <mach/irqs.h>2 h0 A! ^9 f$ K8 n2 ~5 \3 Y: C* a0 e" R
- #include <asm/hardware/edma.h>' Z$ a4 k5 E8 S- [' j
- ! k; }0 s+ ]' O" S8 B2 @
- #undef EDMA3_DEBUG
: R! Z: B3 u4 P: A0 Q% ^; ~2 y - /*#define EDMA3_DEBUG*/
0 s! C0 F; r1 [5 [ C1 l
! {( e& E- |' T- #ifdef EDMA3_DEBUG: j8 v1 `- V N) p/ P9 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( f$ Z( q! c" ?: L3 @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 q' q% Q2 v# G- D _( s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( r0 h, w2 f) M7 o" u8 Y( W# C" U
- #else
. l0 H" |0 H0 Q: X4 i% e - #define DMA_PRINTK( x... )# K& t! J: [+ ^8 X2 T# V
- #define DMA_FN_IN
$ E. o& L" Z1 b4 X& B) ` - #define DMA_FN_OUT& C$ Z \ J& q! ^- A I
- #endif, o' Q" z4 p# n1 j3 O
- ' z5 H! @# d" X* S5 \5 H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# @. q% {7 t8 z
- #define STATIC_SHIFT 3) X: X4 s2 z) T- O) {5 ?3 N
- #define TCINTEN_SHIFT 20* W' K4 Y- q5 } l
- #define ITCINTEN_SHIFT 21! d+ I: b2 ^, v, y K( U
- #define TCCHEN_SHIFT 22, K" T9 ^2 x7 L
- #define ITCCHEN_SHIFT 232 E) r- R, k7 H" p$ a( @8 j- ^( W
1 w. e; {# a7 R( N" [/ \. N5 i- static volatile int irqraised1 = 0;
! @9 O2 V% B* O9 o# Q" q% ~ - static volatile int irqraised2 = 0;( P6 f# {! s) e( Y: Q5 {
- 5 Q, P) X; v( Y9 j8 P3 Y p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( _' P6 @" {- H9 r4 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 S7 i6 F$ D' b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l& @1 n+ d9 M/ P
8 Q' S9 [. Z, Y$ P1 t" o- dma_addr_t dmaphyssrc1 = 0;
2 \* t! K1 X! ~3 `; A* ~ - dma_addr_t dmaphyssrc2 = 0;8 z3 ~' A# J: X4 a8 I9 b
- dma_addr_t dmaphysdest1 = 0;3 V" A% E) g, K8 [1 Y- i$ C
- dma_addr_t dmaphysdest2 = 0;
$ d/ [3 n2 I C
k! W' r# ?& l8 N6 n* k* a4 ?- char *dmabufsrc1 = NULL;7 [! l0 L2 g. D; t# a
- char *dmabufsrc2 = NULL;0 b6 Y# v1 Q3 _' ?& i( r. ]
- char *dmabufdest1 = NULL;
& \, S6 `% D+ V( o+ h - char *dmabufdest2 = NULL;( J% c0 ]4 A6 _. b% m, I
- 1 u! m" N" p. r5 d% T/ [- c3 }
- static int acnt = 512;) C* f) Z6 v( p( ^: ~9 \: C
- static int bcnt = 8;0 w! ~, w& M/ X* n" I4 h- E
- static int ccnt = 8;- J4 Z: X# j' n) b! e
" e5 u2 s4 s' {- G& J' \- module_param(acnt, int, S_IRUGO);
2 R( ?4 K$ r$ v! H w7 ?6 q0 D% I - module_param(bcnt, int, S_IRUGO);
' d; @) V0 ^4 R. B$ Q9 b( d - module_param(ccnt, int, S_IRUGO);
复制代码 % R: Y& k G: ?& Q# y
+ F4 L6 Z/ m6 L+ X/ N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ i5 _: O) p% e( d/ i( V. l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" }/ b/ j0 m6 r. q2 I2 P3 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V% \( Y: g5 M7 V* f; B, z
- V& y) z0 q9 s3 o! H& e+ {4 @3 r' s
/ m: z4 @$ x5 p% G: L; S
|
|