|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: J/ g6 p& N1 D. s- [code]EDMA sample test application8 w/ s% g, s9 t4 a. _( f) V. r3 J2 |
- /*
# G Q1 J- D# n/ N w+ P# f! C - * edma_test.c H' S. s P! E2 n8 y* {' m
- *8 m/ ^, [5 R" {3 h+ I% z, s% ?8 ?
- * brief EDMA3 Test Application# V0 {) W" ?; w3 p; U1 l$ h
- *. q, O5 B0 D Q+ I% n
- * This file contains EDMA3 Test code.- K3 g2 r0 X- j/ t6 G. W: ]- \: s. k
- * C3 ~# b9 Q! ~* z3 `2 l# j3 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# s, \7 _, ^' d, J1 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT R+ { J6 A5 o0 J- A! F# s! U0 _
- * TO CHANGE.7 u) y% E# W3 `2 N' `
- *
2 J! {/ V& Q5 `7 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) S9 g) D. V8 c: D y" D' M
- *1 j. }! G# a! F/ h$ n7 Y) @
- * This program is free software; you can redistribute it and/or6 M% ^) E! X4 }' }; C2 Q& g$ W0 L& f
- * modify it under the terms of the GNU General Public License as
# J& [* z* z2 ?2 \( E4 t- x% r - * published by the Free Software Foundation version 2.
3 w3 F' t* e% O - *
( S8 G$ C3 Z% w1 R' q' J0 ]( g6 s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& i* ], K' c' |% q - * kind, whether express or implied; without even the implied warranty
h( O: ~( o7 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 `0 J8 C/ m3 f0 Y2 j8 z! j/ X6 R - * GNU General Public License for more details.
! `5 u5 p) R, Y - */7 Z9 K. i- R7 ]# {8 p% n
- # F' x$ e1 C! I- H* [( i" P$ M
- #include <linux/module.h>
( Q, v+ d/ b8 s( m - #include <linux/init.h>
a ~0 M8 @! R0 R$ c; Q. V. B - #include <linux/errno.h>
, H! S$ [7 B" ~% A1 \4 s3 y - #include <linux/types.h>- X! M. \! @& p8 [ \% R7 k8 K9 e
- #include <linux/interrupt.h>0 a# m- e, y3 X& \
- #include <asm/io.h>
6 i# @, F% F2 f* W1 U - #include <linux/moduleparam.h>6 @2 ?8 _: }' h, D, m2 ^) r: Y
- #include <linux/sysctl.h>
' K( S1 O. w$ @$ Y& f - #include <linux/mm.h>
( ~- ~8 z+ z* X4 \/ i/ J - #include <linux/dma-mapping.h> @9 l& G; i" X' U
/ z7 O' r$ x) `' R- #include <mach/memory.h>7 \; {0 B2 F7 e/ y7 Y5 \
- #include <mach/hardware.h>; ~. U# S3 ]4 t4 J
- #include <mach/irqs.h>- ]; g* U; C- P" P% @0 J8 d- t
- #include <asm/hardware/edma.h>% _. S9 L: J) [, Y4 E
- . c P" b: n" a* w6 ^; ~; H4 ]
- #undef EDMA3_DEBUG
# U6 u( g G- A- [& B# K( z" r - /*#define EDMA3_DEBUG*/
3 O$ |/ o+ D" } y" t - 2 o! @+ j& k% s/ c7 d; b
- #ifdef EDMA3_DEBUG( a6 T& a/ p9 ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 X4 n( o' c, `/ ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ p) B3 m: ~- H8 b1 }) S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ m0 \: x+ x* n, u8 j4 K+ S - #else
) ~5 A$ o; [- O( \- i - #define DMA_PRINTK( x... )
! B8 a3 [7 J1 b; c! l0 o - #define DMA_FN_IN2 {0 n$ q: I: s2 w: l& M
- #define DMA_FN_OUT* j. U6 {; n* G( Z; y! g/ T
- #endif$ t8 _9 L ]0 Q$ Q8 r
! e: S3 \" J0 M' X J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ p. _* |6 G2 c- V - #define STATIC_SHIFT 3- X% u; x2 j& U) n* b1 i, [7 b
- #define TCINTEN_SHIFT 203 T! a* Q$ `( s7 E% }& l/ R
- #define ITCINTEN_SHIFT 21
7 N# `( G8 I5 u' [: c - #define TCCHEN_SHIFT 22
8 O l$ g1 c7 l* C! P4 w - #define ITCCHEN_SHIFT 23, k M: O( T& W: n j' B
- 1 D4 d+ x: ]6 i7 K( s+ v6 M
- static volatile int irqraised1 = 0;* {* X! P/ z) n- O1 [
- static volatile int irqraised2 = 0;- B' p" e3 X; t3 C# i
( d7 F w5 R( G% c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H) M4 S! L! v% o, E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) ]* e4 _, v9 k7 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; c; v( `8 d1 n8 c, s' q - 8 \$ k! x0 x. u# P
- dma_addr_t dmaphyssrc1 = 0;
# m# \' H. F' F! o - dma_addr_t dmaphyssrc2 = 0;9 W$ X j# W! f2 P! }5 y% f
- dma_addr_t dmaphysdest1 = 0;
# P+ ^: i4 ^5 x) z, |8 V9 I) n - dma_addr_t dmaphysdest2 = 0;
1 ^. W: d0 X, r4 u6 b
4 H9 w* a4 E$ _* L( |- char *dmabufsrc1 = NULL;
. C7 N" Z- c9 Y) D8 S, Y8 c- G - char *dmabufsrc2 = NULL;
: t6 V: H9 i: Z7 s" K3 O& I1 b - char *dmabufdest1 = NULL;7 J$ _6 L$ J6 A! _, b4 | p/ ^9 s+ Y0 s
- char *dmabufdest2 = NULL;! G/ \5 m. z# m, E1 i+ v6 v' \6 b$ E
$ t( F7 J4 X' h0 L- static int acnt = 512;
) t) O3 ^3 H! k/ m6 k# F) B8 s* o& l - static int bcnt = 8;
7 f) c9 D, K) g* l - static int ccnt = 8;. S$ n8 o9 M. {* A
/ F, A& `# s, j, p r& A- module_param(acnt, int, S_IRUGO);4 O# K8 h, y- ]* M1 J* D
- module_param(bcnt, int, S_IRUGO);
0 g- M Q: c' `) | V: r( { - module_param(ccnt, int, S_IRUGO);
复制代码 0 [+ R3 B Y# O3 z$ b
L; e j) z; Q% [) D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 `7 K: Y3 B6 B3 e: v5 T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ^8 R( Y4 v6 j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* T' M+ B( Q5 X
3 u7 p( Q. t! R' ?! g( e9 ~, t
5 J% g3 A n2 T( x6 V |
|