|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & `% B+ y7 l' Z, h
- [code]EDMA sample test application8 N H$ ?* M/ n) y1 J- N! ]
- /*
# \& u9 g, f* K' h* `7 o- k - * edma_test.c
; t9 d) U9 m4 B3 g; y - *
: S% j+ s2 ^4 K- z - * brief EDMA3 Test Application
1 y" \. Z3 ^, B - *
) M, I" l& i* C( J" [" O" S - * This file contains EDMA3 Test code.; M- f4 L; C' G9 j! p- k
- *
3 L5 X4 d h6 F2 W' G% \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ m [) E( ]( M- e2 H& V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 Y/ v: [- r* G* v' l: C: W0 n8 G - * TO CHANGE.$ i& [, p, `/ K6 U1 S4 l
- *
& q9 w! m$ q! x( f3 s. L5 K7 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 j. M9 {8 d( \3 b4 S; w
- *
+ }) T1 U) [% d - * This program is free software; you can redistribute it and/or' h4 z7 x1 y, X
- * modify it under the terms of the GNU General Public License as
2 R2 b2 G$ ^; b$ e - * published by the Free Software Foundation version 2.
/ D8 A2 J; y* `$ M) d6 } - *
( F" @* r, U% E: `" u* d' Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, H# H7 ?4 ?. O+ e - * kind, whether express or implied; without even the implied warranty/ {# ?, J5 ?' [* U* `. m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ i, ^; w# e3 @' r) {) A - * GNU General Public License for more details. Z9 n4 q6 m7 J+ u$ U
- */ M; n+ B/ e( x7 Z/ M) k5 C. A6 K7 p$ B
$ @( W* H6 D! _% n3 B. [/ }- #include <linux/module.h>
( R9 u3 s" J+ e ` - #include <linux/init.h>5 O! H6 H) m! H+ `, J( b- @
- #include <linux/errno.h>
7 I3 p8 F. }* a) Q) q - #include <linux/types.h>
" U7 w3 u; n" g7 D/ }! R - #include <linux/interrupt.h>
9 u5 p" q) H" i& X# Z( F - #include <asm/io.h>
7 M9 Y+ h/ B4 C* t4 e0 n - #include <linux/moduleparam.h>$ g/ b/ U+ `5 s' }) s+ i
- #include <linux/sysctl.h>
4 v7 E* ^4 {; W - #include <linux/mm.h>0 X& Z% |2 a2 y- C6 L; F6 q) Q
- #include <linux/dma-mapping.h>
4 s% e5 j9 G5 k+ C
" t. A1 S" }$ J( i" x# C7 i- #include <mach/memory.h>
) e4 C. b2 p1 j7 y - #include <mach/hardware.h>
2 M w( u7 t. Q5 S, M - #include <mach/irqs.h>: ?. Y& a( z( E- s
- #include <asm/hardware/edma.h>
5 C" M9 b8 M" G) J% L* P' }
* D( F& L) I" w1 ^4 B2 Y4 y3 _- #undef EDMA3_DEBUG& U# L+ S; L9 G8 U
- /*#define EDMA3_DEBUG*/
8 L @* N g& Y
% U# E F: h( Z6 G: b- #ifdef EDMA3_DEBUG
" o( q) ~( u6 J2 J4 L& z/ h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" e5 ?6 K2 L0 Y9 m* g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; c5 P2 `- J6 Y* _+ ?/ h% C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* y3 g( |- }7 a - #else
0 E$ \; D* y$ e# c - #define DMA_PRINTK( x... )4 p1 x/ U* ]" T) v) W& a0 M
- #define DMA_FN_IN5 t) o/ i0 v8 g4 u
- #define DMA_FN_OUT) K I) I4 D7 N6 A2 Q
- #endif
( \4 O+ D$ I! ^. s - $ E) D9 k" H, ]6 c# [, Z! ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( F$ Y" _; q' a7 J: g7 e D$ Y2 \ - #define STATIC_SHIFT 3* s j* }& ?) }- d
- #define TCINTEN_SHIFT 20
$ U, c7 K: D) ] - #define ITCINTEN_SHIFT 21 q% ?1 Q" n) ~: |4 N
- #define TCCHEN_SHIFT 22
7 Y* P- ^ b0 s7 u/ ~/ | - #define ITCCHEN_SHIFT 23* z- y9 h6 c( l+ h& l% _3 o% W
- ) b2 B" e/ X8 i! u
- static volatile int irqraised1 = 0;2 e7 I0 i3 p) E& {! u5 e
- static volatile int irqraised2 = 0;
% s0 H& ] `0 x& f* o7 ]4 j* S$ T7 \
( z8 D% ^5 [& Y* O& V- z- P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B' c3 S: g Y8 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 |' J- s4 y2 d0 [) y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 C/ t/ t v8 h& z
; I6 @1 ?6 F: }( ~( s- dma_addr_t dmaphyssrc1 = 0;
) [0 ]0 i# C; Q) B - dma_addr_t dmaphyssrc2 = 0;
# \* w* J8 O7 `0 z8 N! G - dma_addr_t dmaphysdest1 = 0;
4 u( ~, k8 {0 c7 c5 E$ [ - dma_addr_t dmaphysdest2 = 0;" c7 m0 F: _8 ?' D( g4 U) |7 V, @
4 z: ?# O1 w$ x& H. j: O" p: {9 J1 P- char *dmabufsrc1 = NULL;
, b9 j5 f. g7 s' y1 j o - char *dmabufsrc2 = NULL;
/ |# c O. U k; t* e! M - char *dmabufdest1 = NULL;
5 H( I9 b j7 }3 n - char *dmabufdest2 = NULL;0 l2 m0 _6 H4 A
- , g) v$ R, [6 [' V1 v. I j
- static int acnt = 512;
1 r3 d0 S0 T( J$ c8 C1 l- d - static int bcnt = 8;5 ]( ~. K; A/ J. F; V
- static int ccnt = 8;& a7 d6 D' T' P C
- $ c! C! Y. h# ^+ i
- module_param(acnt, int, S_IRUGO);4 @) o2 W: v& M3 P( @' E8 [7 T7 i
- module_param(bcnt, int, S_IRUGO);
' w: w4 e. K; p - module_param(ccnt, int, S_IRUGO);
复制代码 }# Z. p# H/ _ _, B
5 ?" |+ l/ S1 p% W* S7 x4 v2 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 l1 E) e$ q8 X0 T3 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) o% `+ k! C4 y. l; x( c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Q r( y& _' w; w2 O
S- ~3 k+ B8 C2 I) |3 ?( p2 {
% m/ l: O( G2 w9 a9 Y& H
|
|