|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" k' m; L# ~: f: J$ k# C0 q0 f4 R- [code]EDMA sample test application
' A9 N2 i( m) T& `$ R+ Z+ s! W - /*
# B, o$ W' F4 ` m% Y. Z$ C" f - * edma_test.c
9 a* F; x7 z$ G' ?* ^. t - *
+ @4 R; W' `. c, c# y' w4 _ d - * brief EDMA3 Test Application
8 k& g: n1 @' F. R" W, ?. G - *
% F R C# h, P6 K6 X6 t - * This file contains EDMA3 Test code.
! p( ]+ k6 `3 n! o3 D& M/ @ - *
( J5 e2 a5 r. d- f3 B; f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% l, e. n+ h" ~; {. l/ S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( \! B' @- d' [
- * TO CHANGE.( `0 P: }. e: W/ _
- *
; i3 m$ b5 o9 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ w8 E8 c- r1 m
- *
9 Z7 i; ^! ~$ |! J* r - * This program is free software; you can redistribute it and/or
$ E3 `" {& J% e& F" A' n N - * modify it under the terms of the GNU General Public License as$ c" E* f5 k: j- P% G1 p- _
- * published by the Free Software Foundation version 2.
& ~/ S" c L# d4 a9 G$ Q - *) t% Q7 ~7 r0 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" y9 m" b+ k( }* B K - * kind, whether express or implied; without even the implied warranty
; B4 v. ^3 F, I; P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% b# @$ @0 l( g" s1 q8 q5 X
- * GNU General Public License for more details./ \/ h7 k5 G$ R7 u1 w1 {0 ^/ Q
- */) f* O+ @3 M- x% P* c
- ) k/ V$ N- _0 s! o# E. B
- #include <linux/module.h>, K z4 V* N J6 j% K# ?
- #include <linux/init.h>, e9 @3 _2 j5 g* b: d/ I
- #include <linux/errno.h>
! h# |! u2 ^2 P+ `* o - #include <linux/types.h>
9 q( p) K, w' g& ^% _ - #include <linux/interrupt.h>8 e+ }/ a8 K; f+ P5 {
- #include <asm/io.h>
~ ]2 A" _' V. M6 ?. n. @ - #include <linux/moduleparam.h>
7 c' S( }8 N. ^3 ?' `+ N - #include <linux/sysctl.h>) Z5 i. q/ }5 ?" h
- #include <linux/mm.h># d. D4 U0 P1 V* c$ _2 N
- #include <linux/dma-mapping.h>
r; n' ?5 X0 f
/ f P* B* \6 A; M' J6 I+ N! F- #include <mach/memory.h>0 b' K2 Y% q. `- U! x( W# _" t5 c
- #include <mach/hardware.h># J4 P1 ^$ B2 E# p
- #include <mach/irqs.h>
. p# T/ w" W8 K( X) B" B# l - #include <asm/hardware/edma.h>9 I- Y" g# {: x# r' _0 [) s* {- b
! D4 a& b0 g# P- #undef EDMA3_DEBUG; P6 N5 E6 i/ |8 r) |
- /*#define EDMA3_DEBUG*/
% ^. `+ ` Q9 C' v) H3 A2 J - " @6 V5 I; G) P. Q0 l
- #ifdef EDMA3_DEBUG
# x/ w5 q+ e6 L' _& [! K3 X! a7 d0 U# u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, C, O/ j: p3 h( h0 S( L! _6 U4 W$ ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 B0 |; s; n/ b, C. m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* z3 e% q* y$ B5 t/ ]# b* U* n& D - #else1 H: U% K- {& t4 g$ x' w& D
- #define DMA_PRINTK( x... )% H, g# s) k8 _1 c" m3 a- n4 p
- #define DMA_FN_IN
7 S% z* I9 W/ j) i - #define DMA_FN_OUT, d& I5 L) W }8 O: n" P
- #endif
$ `) l2 M$ @ p3 V - 6 y& \& k) x* ^" K" [ ], C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) Z4 V9 O$ ^. ~6 c2 |0 v t, _
- #define STATIC_SHIFT 3
q& U! Y& z- D - #define TCINTEN_SHIFT 20- ?/ ?3 a3 q& }
- #define ITCINTEN_SHIFT 21( e' g& y! X4 x* o0 c8 W
- #define TCCHEN_SHIFT 22* c( {* z4 a! Y1 ?- O9 b# w
- #define ITCCHEN_SHIFT 23
% A8 k+ W7 r3 E& s - : V" j/ D9 g/ N. S
- static volatile int irqraised1 = 0;* [1 e5 J& b4 D* q( }6 t
- static volatile int irqraised2 = 0;
' z% H) i6 u7 r0 b% e+ o- I4 ?
s6 W! X7 b2 i* p$ _ V2 S, _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Z# X- I. H1 O; w! p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ?2 p6 G: P9 C/ |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M) {+ r) P4 E1 }- R# ?- P% v$ `
- 4 \" I0 r* E8 V8 @7 [/ i3 W
- dma_addr_t dmaphyssrc1 = 0;3 ~; ], v- G( V0 i; }5 V- [6 L: f
- dma_addr_t dmaphyssrc2 = 0;
( _' q9 G# N6 j& p/ ^ - dma_addr_t dmaphysdest1 = 0; }) w. W" ?7 G8 c+ w. [$ P; s
- dma_addr_t dmaphysdest2 = 0;8 O! F9 X. {5 D
4 |# n! v1 n% O; C/ V! ^% f- char *dmabufsrc1 = NULL;
! U3 @1 B. S E$ f3 _ - char *dmabufsrc2 = NULL;
5 j5 S4 K8 Q; x - char *dmabufdest1 = NULL;
( T0 t/ ]8 z( B1 a. D6 h1 K - char *dmabufdest2 = NULL;4 Q3 N# j) J p% Q( f& s& ?
! m% G, y) O# v: h! R- static int acnt = 512;* J7 g3 q2 d. K# Z3 e$ D
- static int bcnt = 8;
0 k' x9 _- B4 U+ @& a; L - static int ccnt = 8;
- r) z, s$ @4 c* Y$ n( h7 O - ! x- x* N# O5 { o" }4 j* U. P
- module_param(acnt, int, S_IRUGO);8 I% L' @ G N
- module_param(bcnt, int, S_IRUGO);6 s1 E; A. H! T: @1 B j: ]0 V
- module_param(ccnt, int, S_IRUGO);
复制代码
6 t5 \& k, `6 z5 y; g
8 w2 j7 G/ c6 n) B4 |( t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: j0 n$ D) u: L/ Y" l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 d# P# c% |3 B0 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 y7 w) t4 q- Q0 B( Z/ F
( I P( _3 P7 p6 h/ |6 l* n( C
# d/ @7 r f1 S9 z4 X3 C
|
|