|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F5 }9 M# g& x4 j* c3 U
- [code]EDMA sample test application) ~- c$ f: M) J P7 {
- /*
6 M# [7 |; S0 i! {: J$ s( n! J' @1 ]; N - * edma_test.c8 |, b D& E/ P" c9 ^$ A
- *
* J# r* k9 `3 z- x) q+ a/ I - * brief EDMA3 Test Application6 ]( n L6 I4 m% C' \
- *- \$ A% U( C( }! ]6 N ]1 Q, u
- * This file contains EDMA3 Test code.' }- Y7 V7 a; }/ R" `8 l o
- *2 c9 F. @3 }+ E/ q y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( j' O* D( ~1 p6 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# f; y9 [% l" {, B* t
- * TO CHANGE.
! F1 _. W5 F" S. O2 M W: C1 f - *
, c+ x. G5 ^; Q' N/ g% g3 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& x) E( O/ d. |8 e1 X+ a# i) T
- *
0 A0 Q9 F; g) ` - * This program is free software; you can redistribute it and/or
3 W8 K: m6 V9 W% \0 q4 {) I - * modify it under the terms of the GNU General Public License as
: h* h5 N( P7 E; M1 ? - * published by the Free Software Foundation version 2." u/ t; r7 ]; |( J+ i% s# j4 l9 u/ }2 @
- *6 E8 N3 O9 Z) _9 w' H) a! c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, O% e% I; F4 E3 H' k( j1 X$ g
- * kind, whether express or implied; without even the implied warranty% u, h6 l, F* {& l! F8 m4 q. C8 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) K3 X! P" c% {- x
- * GNU General Public License for more details.$ ~! T% v) k7 R. b6 |. B2 `
- */0 r: I) k& }* k
6 I5 F1 B; H1 j% @1 J* q- #include <linux/module.h>
* s: C- H+ P; j0 Y1 B! l) Z - #include <linux/init.h>, D/ a C2 `) j' C1 Z
- #include <linux/errno.h>, l7 c5 C! I8 o. x/ z7 Y
- #include <linux/types.h>
! a0 j* r1 q' Y7 B0 v+ d - #include <linux/interrupt.h>
3 J2 B0 K+ n q* b1 l3 M6 O8 ] - #include <asm/io.h>
0 G! w. I! a4 M - #include <linux/moduleparam.h>: ]% f, Y$ T- p2 O' H1 R& n
- #include <linux/sysctl.h>- U* r6 X8 u& v2 Q
- #include <linux/mm.h>
& [4 z; y4 y4 q4 _5 \- K; D F: V% o - #include <linux/dma-mapping.h>
; A* G/ Y9 ]( ?& {0 u+ n O, `4 {, ~ - ) C9 b- l, ?: ]) H1 J- b% f& d: j
- #include <mach/memory.h>
7 T5 L% |& K8 X8 R1 g - #include <mach/hardware.h>
8 d! F; S, T2 U6 c: w5 h - #include <mach/irqs.h>
7 K* ~, \' p5 U( [ - #include <asm/hardware/edma.h>5 i% _" N; @3 ^! z. R0 c
- 2 `5 ]. y2 J1 P H6 `& `( ^
- #undef EDMA3_DEBUG
P ?7 J. ?% _; G - /*#define EDMA3_DEBUG*/
8 E1 I) l/ \: O M
! f9 j2 c* g, c' ~- #ifdef EDMA3_DEBUG
- M; [& u- w0 E* g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 W& M) e3 C7 H4 }4 f4 o/ r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 S/ u5 H2 E- ]" r, X9 o* B/ T- C1 T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# k; t4 O) u! n: L/ M$ T1 T - #else, J1 p6 e: l4 [' q- G4 A# c/ {0 \
- #define DMA_PRINTK( x... )1 j7 r+ }: v! C Z5 v& M! t. J
- #define DMA_FN_IN! k( c6 I6 Y& l8 m
- #define DMA_FN_OUT; x0 ?) T' J- O* S' w
- #endif
) f, _2 a6 @; C6 I$ z& |% f1 y/ {% p
3 \) \$ Z* C) _) \6 r3 p/ I: C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' w- P' P( o' a7 z8 X - #define STATIC_SHIFT 3
% |9 L( G2 | ~: |# |1 L - #define TCINTEN_SHIFT 20
/ ?, n7 r4 D& n h2 X! ]1 E# W - #define ITCINTEN_SHIFT 21
0 j( u+ a+ }% }, M - #define TCCHEN_SHIFT 22
5 T1 v" M; o( c+ K - #define ITCCHEN_SHIFT 232 a% U, u9 N. W4 c9 Y8 C( F ^
5 }1 A- y$ g, {7 N# e- static volatile int irqraised1 = 0;# \4 R# A0 y% z9 \+ k- x2 K
- static volatile int irqraised2 = 0;- U1 A8 H; Q7 F8 b, e$ I
- % K3 @# I z0 E" o0 u q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( F- A+ s8 Q) y" q% m: g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" [' X0 }9 p8 W+ P; Z; J* } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l: U5 @. b4 b
2 Q) e/ ^0 Q7 N/ a4 X# |- dma_addr_t dmaphyssrc1 = 0;# @0 H2 M1 J4 R; i1 [8 l
- dma_addr_t dmaphyssrc2 = 0;0 o0 l: @4 J+ N0 [7 q* [7 S; X
- dma_addr_t dmaphysdest1 = 0;
2 }3 @. B6 v5 g5 ?3 L - dma_addr_t dmaphysdest2 = 0;
* Q' l: r4 j, c4 H5 g( M - 7 O( `5 t) m1 s2 l. ~9 w# j
- char *dmabufsrc1 = NULL;% e0 f4 o1 q4 `! H
- char *dmabufsrc2 = NULL;5 g" Q: g) H7 V( r& A5 \
- char *dmabufdest1 = NULL;7 C" g4 C W: @- a1 L
- char *dmabufdest2 = NULL;) U: i5 i) B9 o4 f
- . _$ ~3 g" v0 j$ Z4 G j
- static int acnt = 512;1 T; V: A+ i/ [& [: D9 I
- static int bcnt = 8;4 m2 s) r# }3 s5 {
- static int ccnt = 8;! U- Z. o& G Q
. @4 f: T, F7 G0 H- R1 j& ^1 {8 E- module_param(acnt, int, S_IRUGO);2 K6 z1 L3 x4 J) A) E
- module_param(bcnt, int, S_IRUGO);# i- e/ Y3 {3 o
- module_param(ccnt, int, S_IRUGO);
复制代码
5 j; |4 O2 `, V3 v- z5 K& o8 \3 F6 g& E* J; d- i7 Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
^% U' E$ `) z1 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ K8 T7 Y. a9 f+ G, `2 ~1 s& k* B! Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, C( D' s4 O/ o7 ^3 Y6 h- D# ^
% y' u0 a' C, m1 k! a9 g( ^* Z
% m/ r2 X5 t- i! a+ ^, C1 G0 v |
|