|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % r# p, I4 I( n: p3 y/ H2 P2 ]
- [code]EDMA sample test application0 u. v# h' ]4 ^
- /*& ~- v' Y$ h0 ~8 }. W2 e
- * edma_test.c
& A. k6 s5 I' I8 [ - *) u8 G8 P5 o* l+ L% Q; T/ ?- e
- * brief EDMA3 Test Application5 Y+ N! Q& `" f g% w4 P a h
- *
% J: H! N2 U- z# G# w2 Z7 W - * This file contains EDMA3 Test code.
S+ Z/ K$ z' p; t - *
% ~5 L. s9 P# J: P" j$ Y& \2 z4 a5 E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 Q( G5 u' h; O i9 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: K, I6 G" k3 V( K- o! p1 Y
- * TO CHANGE.
2 i d: b: \1 P8 D5 e: I; W - *
; C3 B- o7 |+ Q1 M* X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ m! ]7 D* ~3 t& L4 L - *" [; @1 h+ R9 p0 N2 X! K
- * This program is free software; you can redistribute it and/or' N8 ?- ]! k7 E7 b. {
- * modify it under the terms of the GNU General Public License as) Z4 C! X) ? ?1 I" | n' N8 C! T1 S
- * published by the Free Software Foundation version 2.- S" i) h' o3 j& X" b& y
- *$ Q5 |) [( z7 k/ f2 t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' A: v- l/ u, ]& f( x - * kind, whether express or implied; without even the implied warranty, _' G, T7 l9 B! n) n' n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 V, T6 q- H! p& @ - * GNU General Public License for more details.
. ?; ?% d% N- r7 c) a7 k - */$ C& Q# N; y, d4 S+ M' Y9 y
- / I! ?/ ~8 {; \! b1 T
- #include <linux/module.h>: x& u1 V7 e" r" F/ y/ X
- #include <linux/init.h>
; V, a# b3 K# m7 s, Q - #include <linux/errno.h>, e5 H" p' c; l0 G/ N
- #include <linux/types.h>) T. e; c; n1 i+ p: r
- #include <linux/interrupt.h>
2 c6 Q; W" x7 A1 O/ N - #include <asm/io.h>% O% q5 r* I# C/ ~! B0 P; }
- #include <linux/moduleparam.h>/ F1 ^+ Y2 ^0 d: p6 j1 @
- #include <linux/sysctl.h>6 J5 h5 N2 U: D- F7 I8 ~6 U6 ~. {$ {' {
- #include <linux/mm.h>
I# D, m6 V# B4 y - #include <linux/dma-mapping.h>1 U% B- w# e3 k' p2 t
- 0 Z. Z+ j% B! D2 l
- #include <mach/memory.h>3 c- f8 x7 Z/ |6 Q3 i( p9 F+ t
- #include <mach/hardware.h>
& {0 y0 t5 a9 N/ ^ - #include <mach/irqs.h>
0 N2 P( m& P+ [( m2 C - #include <asm/hardware/edma.h>
0 d' ^% b6 {8 ^' N
9 C* l; |' U* Y% c% m; ~7 z( g- #undef EDMA3_DEBUG& `. I* }3 d8 _0 g
- /*#define EDMA3_DEBUG*/
' {" Z. s/ |1 M
$ O2 C7 M4 _5 c) x- #ifdef EDMA3_DEBUG
! N1 |' j9 X% p& {+ N% q+ C2 B. a2 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 F4 ~8 v+ ~' x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 ^1 F* v3 h6 h; X+ k! w/ M$ q6 \4 p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ w( V, [ B) y0 v9 Y9 ^
- #else+ c- u9 E- I6 x1 d* ]* v3 M
- #define DMA_PRINTK( x... )! ]4 Z2 z; }/ \7 z( h
- #define DMA_FN_IN
: o- ?" c! K5 _3 B, f - #define DMA_FN_OUT
0 s0 ^& \; ~- h9 L8 W5 _2 Q - #endif
3 J) `- `0 l9 Q; J
' R/ a: X3 ^# ], ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 r/ Y. B e7 i
- #define STATIC_SHIFT 3( J$ ^* r1 T! A* M: B& T& d; B
- #define TCINTEN_SHIFT 20+ b" b/ U7 f* r# z
- #define ITCINTEN_SHIFT 21
$ x5 R: _, {; G) q8 T: \5 A8 j" ] - #define TCCHEN_SHIFT 22+ z$ U- O0 |$ Z+ b( Y
- #define ITCCHEN_SHIFT 239 J9 m1 G; t; k, O8 [9 b0 F
- # |& O5 X8 L/ {: s% y( b+ S _
- static volatile int irqraised1 = 0;9 U1 @" ^3 f& C
- static volatile int irqraised2 = 0;
6 z+ p ~* ~" C( @9 q0 V7 n$ `
& w# Q1 M( K7 t! t! @( a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 m/ c2 O! d: s1 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; X5 g0 U2 O5 E) t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ]3 D& O7 X/ q: f$ O6 a2 Z; o. w - - F- G1 D( @! ~, T! D& O
- dma_addr_t dmaphyssrc1 = 0;
% J- _- v" F& p2 v/ \( k: i - dma_addr_t dmaphyssrc2 = 0;
6 A. ?& x: J% G7 }# r5 @( x - dma_addr_t dmaphysdest1 = 0;
) n2 n+ i$ w7 C& ]/ ~ - dma_addr_t dmaphysdest2 = 0;3 Z2 Z; N, ^: @! U7 D8 r
# C8 S$ W x7 P) l- char *dmabufsrc1 = NULL;, P1 [" c" |. c2 }
- char *dmabufsrc2 = NULL;
" ^7 A/ i3 O. Z; d" g% x - char *dmabufdest1 = NULL;
) v- K) B% e( u9 s, | - char *dmabufdest2 = NULL;
4 e: a/ v* e A ?$ t% V8 I+ f: J - - X4 O/ E4 z; U7 d* m
- static int acnt = 512;
. @; M' [1 s3 d7 r }+ A( M - static int bcnt = 8;/ `4 o5 r6 o; E; N% O. R
- static int ccnt = 8;
5 U$ H$ s s6 z; M7 b - ' q0 b2 L+ l8 d& p& R* X9 f! [
- module_param(acnt, int, S_IRUGO);5 d/ m2 P' U; q# Y) n1 z7 Q
- module_param(bcnt, int, S_IRUGO);
) f! P5 V1 q& `- q" l - module_param(ccnt, int, S_IRUGO);
复制代码 + s3 s6 ?) i1 e
& T4 U* S5 E) U# m. {" P4 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# _" D6 i) q" o0 X x; o' z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' ^% H6 y4 }! @" \7 _* z2 i5 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ `4 u5 e$ Q2 a
% V) l" f2 N5 S( e n
8 @1 G7 C+ N+ J- x) @ |
|