|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% `2 `9 }7 a1 k; Z+ d, p! k- [code]EDMA sample test application7 r' Y, {1 O& E+ D+ H; [
- /*
' y& Y, m4 [* r" [" o8 z* M0 L - * edma_test.c) R- C+ r, K5 n0 v3 H, q! }
- */ F0 p+ H! ~6 t* E1 H
- * brief EDMA3 Test Application
- P& s4 @' u$ a5 ?% L0 t. ~ - *9 \4 @1 P) V; e3 K' V( B; P1 X! f
- * This file contains EDMA3 Test code.
3 E5 } B q1 K5 t+ g - *: p# k* V' z) o9 K! K4 t) ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 y# b/ J: e- W9 C5 E2 m- U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ @( u; H( A" v, b1 K
- * TO CHANGE.
2 I! j) ~/ M4 a) | - *
/ P$ ^* U x% A C- m8 a: T! R+ y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ }% S3 |) k% {
- *
8 s- d7 y/ b! }# h - * This program is free software; you can redistribute it and/or0 g6 a1 j! c i6 ~+ V& b8 o) R. T/ p% m6 {
- * modify it under the terms of the GNU General Public License as
0 O0 A$ F7 u0 v: G+ H - * published by the Free Software Foundation version 2.
6 K |6 ~$ \1 @; G- e6 Z - *% Y: k' w% p' ?* h2 c+ }4 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 |8 p3 K" d! N8 O
- * kind, whether express or implied; without even the implied warranty! `" p+ {- g1 R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# V4 s! T* G9 [ - * GNU General Public License for more details.
" ]$ z' h8 D- T0 d3 L - */
' Z4 r0 y3 j3 N) {. S, C
7 T8 }( ^% p; B$ I7 x5 q4 L5 q3 P- #include <linux/module.h>
( p! d% C3 k5 E @& S" ?6 n - #include <linux/init.h>
. j- V0 _' Q* H5 O, r - #include <linux/errno.h>$ B4 i4 R4 O( j* [
- #include <linux/types.h>% C, }8 K* y$ N4 e% S
- #include <linux/interrupt.h>/ ?7 d' n4 k4 M. x; o7 `9 V; ~
- #include <asm/io.h>
% `/ S5 a4 p) A0 x - #include <linux/moduleparam.h>
5 D; s+ z( J; V; F- _0 D - #include <linux/sysctl.h>" j3 x) M0 e8 y' U3 I$ L' @+ Y: g
- #include <linux/mm.h>, j3 K6 I4 W. N* c3 W# u
- #include <linux/dma-mapping.h>$ G6 N/ Q5 c3 S
q1 q* R3 t6 C, a) O+ o! S- #include <mach/memory.h>
4 @' m: ~- a# H3 D4 z - #include <mach/hardware.h>
4 Y2 s; ~ w) c - #include <mach/irqs.h>
7 S4 F! y: X4 g8 b" \2 m3 | - #include <asm/hardware/edma.h>
, c) j2 m4 s" J3 [2 l | - / ]% B+ [5 q9 w5 W& F
- #undef EDMA3_DEBUG' i' [2 K" X2 b
- /*#define EDMA3_DEBUG*/
1 v0 x* H( w# L4 o
5 V8 J4 \$ A `" j( P( ?- #ifdef EDMA3_DEBUG
i, M! R' Y4 x# x7 i4 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 L% f. `( U c }: u/ w1 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ Q z3 a1 v3 q. \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- b3 J+ n9 J; i
- #else3 Z4 y8 O1 O- {4 q$ ]
- #define DMA_PRINTK( x... )6 \( I6 p/ o. a
- #define DMA_FN_IN
: Z& w7 K& v- a8 _- S2 { - #define DMA_FN_OUT
( d/ A+ Q% ] f' ] p/ t0 F - #endif
% [9 [+ k& X# h - h5 L3 k% ?. _. x. d. O# d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 z5 \0 Q, S& g8 ~& m
- #define STATIC_SHIFT 33 m4 b/ ?% A9 W5 b
- #define TCINTEN_SHIFT 20; g* d' a: S0 x8 W
- #define ITCINTEN_SHIFT 21
. r& y8 ~) ^- P - #define TCCHEN_SHIFT 22, v+ }2 K' I. ~: g
- #define ITCCHEN_SHIFT 23) b/ \4 w! A w3 P0 {
- 0 m! M7 S, j0 |7 }" z" V z5 S8 T
- static volatile int irqraised1 = 0;- \2 c/ p( r; M( q
- static volatile int irqraised2 = 0;
- u7 a) `% c; T - * k3 Y) p U8 i( a. B% l% Q$ m$ R- Z: G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& Y8 X+ p. p& p, L% [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y0 e$ j0 S9 U9 K' z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ B" W4 m- K4 h! @+ X0 | - 2 w6 a0 G, F" D% q# a0 Z; P9 y
- dma_addr_t dmaphyssrc1 = 0;
/ h0 c5 c8 h3 I8 B# o, h/ _ - dma_addr_t dmaphyssrc2 = 0;
. W9 s3 B# B b" { - dma_addr_t dmaphysdest1 = 0;. ~( n, c7 K2 i+ S8 U% h
- dma_addr_t dmaphysdest2 = 0;
?5 ]- U6 x4 G6 x. H - * ?. K( K, G! ]3 M
- char *dmabufsrc1 = NULL;5 O# o' K: W2 z* a; C1 g5 U
- char *dmabufsrc2 = NULL;
2 H8 J+ G: f8 ]; H" |7 f* b+ t - char *dmabufdest1 = NULL;
, q/ i( ^5 b( j, Y5 j - char *dmabufdest2 = NULL;
. Z3 U1 U; x4 T7 I c& o, m - - n. l* h! i. H9 N& Y
- static int acnt = 512;
, R1 E. a8 _- ]: `5 K - static int bcnt = 8;
- I& |3 X4 c* [! D& z - static int ccnt = 8;
2 E/ X3 ~, _0 r' H - # |+ D; {+ t! U% y
- module_param(acnt, int, S_IRUGO);
* W _) O' v" P9 A+ ?. P - module_param(bcnt, int, S_IRUGO);& Q) h: H Y* M0 V. g S
- module_param(ccnt, int, S_IRUGO);
复制代码
4 \. W: @ |* j' k% B1 S+ m% w- I3 q( p3 q: m) T6 c- Z( C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, q) x( G7 @+ l. x# X9 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- t' n$ F9 S3 l9 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% e% ]8 C- K: x6 |( B5 Z+ g0 f6 f
# x8 F: ^8 C4 S, b: F, n. x( L; D
" b8 O8 I" j3 c4 T2 n
|
|