|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 h; h4 Z2 }8 e- [code]EDMA sample test application
7 b2 E2 c6 R' [+ _7 n5 u% m6 L$ u - /*
( s" r9 W& {- M+ m/ [ - * edma_test.c
" f, }$ q: E3 I) H; |4 M - *
$ V8 Y, {! X( H0 M$ d1 A/ b - * brief EDMA3 Test Application
% o- q4 o, k7 D* H/ Q! `4 x1 f - *& A+ t1 U1 m- d: a9 d- N
- * This file contains EDMA3 Test code.5 z6 Z* e" o' y! x/ N. V5 n/ N9 H& ]: j
- *
2 L+ U7 w% V' x7 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ J% l$ u" z" j: ], s4 ?; T6 Q; w. w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 r" C w2 I8 W8 G' x: }; u - * TO CHANGE.
_) O& P0 r" q$ A8 y - *
5 s1 J5 N, J8 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ q% g" K$ Q. E( M7 C - *9 ^9 |1 s A8 V
- * This program is free software; you can redistribute it and/or
/ v: [, l# G# s) I7 x" j, q+ c - * modify it under the terms of the GNU General Public License as V- A+ M0 g$ `' o1 Y! |
- * published by the Free Software Foundation version 2.
/ V1 k4 P) U7 Q1 B - *
7 I& K+ `5 G+ @6 \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& e$ h$ H3 d% n. \% T; o- i7 H/ W - * kind, whether express or implied; without even the implied warranty
: l! c9 p) i# ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 W$ u- m7 b+ ?+ m, z9 q T! l
- * GNU General Public License for more details.2 V" e) }# i5 z5 ]6 d) v
- */
s+ ?' F$ U- n( j6 i9 K; Q' o - * a5 n0 z0 R& W* G* G g0 J* d
- #include <linux/module.h>. m ]2 c5 ^- Z: T+ Q5 e9 @
- #include <linux/init.h>" c2 S) O2 E2 S. I
- #include <linux/errno.h>: O* N1 W$ r: X5 I$ {7 {$ m; d/ h3 m
- #include <linux/types.h>8 v4 j3 c$ Q# s) `+ s: p' h
- #include <linux/interrupt.h>" C( x& m: f6 s3 q( X+ K
- #include <asm/io.h>, W- o6 c9 Y0 u v3 J
- #include <linux/moduleparam.h>
9 Z. W0 @/ b, ~ - #include <linux/sysctl.h>
2 i2 }# A, }4 ]5 K& W6 j - #include <linux/mm.h>
7 P* L1 d5 C6 u. [6 p6 Y. Z - #include <linux/dma-mapping.h> [6 e/ W0 d! [1 Z: I. D
- : K) d# {$ N# P$ M4 ? J7 }" X
- #include <mach/memory.h>
2 G- P/ Z/ G/ l$ k x/ u - #include <mach/hardware.h>
5 g% E5 U4 L* @& \) T/ x% C; U - #include <mach/irqs.h>. T% n# K; q# x3 l
- #include <asm/hardware/edma.h>
% a2 L" J# h. ~5 M+ e/ x
; m/ X9 _3 k, ~4 Q. I8 ?- #undef EDMA3_DEBUG, \% e6 y% K. f0 M8 ^ `
- /*#define EDMA3_DEBUG*/
: @9 y% z. C f p1 P4 ? - + r9 {6 D, c- X$ ]! P+ A3 f- O: J
- #ifdef EDMA3_DEBUG9 t# Q( ^& H6 X0 v) r- @, d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% q+ q. C; Y9 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 V5 w& t( Q. O2 X7 s- q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 \% J6 r3 l e$ _% O( Q B
- #else
" f" y8 p) g/ I6 p - #define DMA_PRINTK( x... )" Z: X) Z) f% y
- #define DMA_FN_IN) W _" U7 Q+ q$ v; b3 ~
- #define DMA_FN_OUT6 R) [2 t% S' w7 A
- #endif
2 V5 d! U; L# p( w+ H! y
# d9 w/ Q6 Q4 a8 }) D- v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. [1 u) R& ?9 c& U2 ?& b. A - #define STATIC_SHIFT 3% K. W. a5 N0 g% P5 `
- #define TCINTEN_SHIFT 20
$ e U' k" l9 n' u - #define ITCINTEN_SHIFT 21
# c g, W6 f' c - #define TCCHEN_SHIFT 22
u0 `5 g) L1 a - #define ITCCHEN_SHIFT 23# [1 `7 f2 z+ ^) h# P- Z7 _& k
- 2 W9 f/ Y; v& a# g5 }
- static volatile int irqraised1 = 0;+ u5 j( A. k+ B7 q" ?4 K4 h
- static volatile int irqraised2 = 0;" k/ Y# N! h, [
- $ v5 L6 p' H& _; o! |4 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 c0 ^! u1 p2 f8 ~- q+ q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: B" G6 X& {; O- K7 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- D2 L- ]$ j( ?1 c
; O8 c$ O& F4 D' L d- dma_addr_t dmaphyssrc1 = 0;9 F4 O% U0 y9 |9 q
- dma_addr_t dmaphyssrc2 = 0;
6 S6 O; s! D$ ^( G" P I - dma_addr_t dmaphysdest1 = 0;
0 n* e" S6 B8 F& [ - dma_addr_t dmaphysdest2 = 0;$ ^1 r4 S3 r4 s; s- C* [
9 J! h1 X! O y% k& e' X1 L- char *dmabufsrc1 = NULL;
1 s; q$ ~; V+ J+ b& u. q3 a - char *dmabufsrc2 = NULL;2 Y) S% t( P$ {( X' y2 S' D3 m
- char *dmabufdest1 = NULL;6 S/ g: L: W* m7 R2 h8 F5 v7 U! M6 O
- char *dmabufdest2 = NULL;
: \: i: M/ W' v - + K/ p7 K( _# V$ @8 G
- static int acnt = 512; J7 @' E2 `$ O& h
- static int bcnt = 8;
4 H- G: ~3 W4 V; F, a- Q( X) _ - static int ccnt = 8;( a( D$ d7 S# `+ Y
- 0 B+ A* _- ~, k8 m
- module_param(acnt, int, S_IRUGO);
+ m5 z/ o2 c1 b+ W* L) | - module_param(bcnt, int, S_IRUGO);* X3 G7 z, B5 k1 ^
- module_param(ccnt, int, S_IRUGO);
复制代码
! B! r9 X4 z: C% @+ g1 Y
, |8 e, }% {& S7 C" c4 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 r3 p+ q0 T8 I' T/ R 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ^" v' ^0 O, X' h' n: M" r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 s$ X$ v# ` m5 L" x
4 F" j& I" d% f0 Z
6 F8 J F6 b9 U/ Y |
|