|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ m; @, m! Y( a& q( d; _
- [code]EDMA sample test application
/ _4 \* U9 W+ `: L - /*! o; ^: E6 |: q# x, c0 l
- * edma_test.c9 {: q4 g. U8 a1 I+ _( [1 I4 ?; ?
- *1 _. Y, z4 R w: Z
- * brief EDMA3 Test Application4 ?5 p, ~0 B# `) k
- *
3 i+ A* d R9 h8 s$ ]4 [ I! b - * This file contains EDMA3 Test code.# t4 W/ s3 U- {% A B3 e1 r
- *" r, Y! A6 a2 @* |2 j* n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: F3 l7 R6 r" H" T+ Y/ [
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( E8 C5 x9 v8 m
- * TO CHANGE.
' O x& q0 r. O7 |5 C5 J* R - *
$ {4 `: B, _* l/ @5 V& ^6 O' g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, t$ H" S; s& f* [+ ^2 b4 f+ F
- *
& U* `) v$ k: Y' @# T - * This program is free software; you can redistribute it and/or
8 s" u* t2 T5 C - * modify it under the terms of the GNU General Public License as
, H0 ~' F& X- ~/ V! v - * published by the Free Software Foundation version 2." ~9 b! _" L4 D; `* P; Q8 j
- *
% @) z* e" j. l% w# g9 p" F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; p) [- D1 ^0 P6 z: g- \
- * kind, whether express or implied; without even the implied warranty
2 v8 c# a% m. z3 v/ h* m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' C1 _# _6 u _6 p - * GNU General Public License for more details.# N: x, L6 d% B! q( j, J
- */
" t: h: {- @3 ^5 [' A, } - ( Q! ~$ k! P6 I' D; R" j
- #include <linux/module.h>% V6 N8 t5 u% d
- #include <linux/init.h>9 k) A4 H, T" p; _# A
- #include <linux/errno.h>
0 H: h% ]$ o8 | j J - #include <linux/types.h>
! w# x0 v, `. i; z+ u. y - #include <linux/interrupt.h>
\, u' h5 f N2 K - #include <asm/io.h>
: c6 f6 m* @# @8 [( z - #include <linux/moduleparam.h>3 Z; X* C0 P) i! P, V
- #include <linux/sysctl.h>2 N6 u6 ?; e+ C @! R0 j
- #include <linux/mm.h>( \5 |) J, K0 }- ]! q8 c
- #include <linux/dma-mapping.h>
4 N6 j* e2 o$ M
* G0 v5 X+ J7 q" v; u- #include <mach/memory.h>
+ w. [8 v& p; V' j4 b, W - #include <mach/hardware.h>
2 C2 f+ _) H, p- K( B& C - #include <mach/irqs.h>8 ]6 L7 P D O2 ~
- #include <asm/hardware/edma.h>
% N4 \* w8 A3 o: r; \" ]4 I. A1 Z
$ D- t4 w: {) M- #undef EDMA3_DEBUG
3 p1 {: h. R/ I: g0 v1 E - /*#define EDMA3_DEBUG*/; E& q4 E1 Z. D. I: ~% z, H
- 9 Z8 L2 q, a" Q% m' P
- #ifdef EDMA3_DEBUG [* d. V# \1 ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); G3 I$ U5 B: t7 C- Y8 I* O9 Q1 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* @6 _( X! p; q$ Q" w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ d3 {" `& w# K# e- A5 Y1 ^
- #else: X7 W) B' E& n+ P D+ ~
- #define DMA_PRINTK( x... )' c1 d2 Y& i% D' _% n
- #define DMA_FN_IN& S M6 `. ^5 w2 o% p0 X' x0 [
- #define DMA_FN_OUT M# x! ^2 x0 d% N; S
- #endif- r: A* U9 D+ s8 E: `
- * l. y: u6 q, m: S% ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ R! D& @9 ]2 x2 n3 O1 ^' B- V - #define STATIC_SHIFT 3
0 _3 z y9 R. D/ _! Y/ ] - #define TCINTEN_SHIFT 203 z( e% q, N& j) V) u
- #define ITCINTEN_SHIFT 21
1 b7 L6 w" z9 ~/ P( I2 K. _ - #define TCCHEN_SHIFT 22( s$ `( c4 V% F7 W0 b
- #define ITCCHEN_SHIFT 233 U0 T( U' ^+ i3 x. r8 `
- 2 U; Q3 b, I) A& {# F$ o1 X
- static volatile int irqraised1 = 0;5 N |) @8 n) q$ W0 I+ ^
- static volatile int irqraised2 = 0;
2 D' O! g9 `- [
- Q4 Y# C) @9 q; y F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ [# d& q( R; l. d0 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 _9 }( \* N: s% f/ M4 e* ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 x2 F1 q- n) R- g* ?
5 E: U6 j' W* u: h- dma_addr_t dmaphyssrc1 = 0;
6 P7 k' D0 w- x; c - dma_addr_t dmaphyssrc2 = 0;7 c, W2 ]+ u! s) M: L5 K" c3 N! Z( A
- dma_addr_t dmaphysdest1 = 0;1 T( e/ k& {- D: Z
- dma_addr_t dmaphysdest2 = 0;
* l% F: h, ~6 h( J1 \4 q$ P/ E - 6 A2 p, R, L5 r2 a
- char *dmabufsrc1 = NULL;
1 V. Y9 D# U" F$ B - char *dmabufsrc2 = NULL;. [: E, J! y G5 } D2 O
- char *dmabufdest1 = NULL;
: I% d4 H, J+ l1 u7 @7 F - char *dmabufdest2 = NULL;- Z, @3 L# W* \
- 2 {0 E8 D( \) [6 G1 }5 X- C
- static int acnt = 512;7 R( C6 s, M3 D, T9 C
- static int bcnt = 8; p0 k& J8 P1 s( J% [' K
- static int ccnt = 8;
( a4 R1 L0 s/ A, F, g$ ~8 v7 S. c% v - 0 x) k' X% F6 ?. e* c+ c
- module_param(acnt, int, S_IRUGO);4 n2 ?2 y. d! }7 j5 Y
- module_param(bcnt, int, S_IRUGO);
; {7 o3 `8 O) S1 r: B- y - module_param(ccnt, int, S_IRUGO);
复制代码 0 x2 i; @3 Y' _1 v
9 ]( }+ i2 z8 T5 K0 b X8 @" `5 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 H# \5 ^8 s7 N |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: k/ B. `, Q( W* _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ~9 ]/ a! ~4 O0 m2 t! ?9 w- y) @& Y/ w; t
F: s% P: P4 @5 x
|
|