|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & h+ J) X( ^' c) y
- [code]EDMA sample test application* U! B" M! i2 ~$ ]
- /*
+ W8 T' o* e( J' u, `# z - * edma_test.c
$ O0 H1 i- d4 ]7 ` - *
. C7 E3 f7 u9 c$ N; a - * brief EDMA3 Test Application" b2 D5 N% ^1 p6 M0 q0 Q( Q
- *
4 z/ F5 Z/ A, J7 p# c - * This file contains EDMA3 Test code.
+ P8 T: B4 v2 u, L3 \ - * @% A+ I' B9 @5 U+ b7 [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 I8 Q( G+ O' [* c% v8 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, o, M/ C# `- d: e+ q' g
- * TO CHANGE.
# K9 p d0 K4 @ - *- w/ j: F1 N. p" J. y1 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 w1 a$ Y+ l: W9 h6 M3 g: _2 _
- *
$ L/ a( c. g" C8 A. V - * This program is free software; you can redistribute it and/or
2 P) ` [& w9 [, u4 C3 w9 y - * modify it under the terms of the GNU General Public License as6 o- q$ F8 K/ W+ C7 c v+ ~$ p8 ^
- * published by the Free Software Foundation version 2.
3 z2 T( r' T5 n6 Y% k - *
' n2 k0 F3 \& L% U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; h7 E2 C9 M7 M' d9 l; K - * kind, whether express or implied; without even the implied warranty/ n% g1 ^ A+ h6 l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 ?5 Y: F- y$ E% v0 Y) z" W' Y3 _! \ - * GNU General Public License for more details.
+ e( A: ^, O' h2 R/ J - *// {( q5 O! P, y* Z) }% e
- % J1 [: W8 h% B& c8 R: l! H
- #include <linux/module.h>- w" Y1 M6 e7 x% T% B4 B6 ~
- #include <linux/init.h>2 [$ O" c4 z: j( R
- #include <linux/errno.h>
! q/ o8 {+ [# {/ _9 p; ? - #include <linux/types.h>$ U1 t2 r8 _2 K: R4 {
- #include <linux/interrupt.h>. h9 ]( |. S ?+ T; n
- #include <asm/io.h>
) N& l4 f m a( W - #include <linux/moduleparam.h>: j5 Y* C4 P: p% m' L8 _
- #include <linux/sysctl.h>
" x2 P8 u( |( B& `, m - #include <linux/mm.h>
! v& a: n& R' d% b8 m5 | - #include <linux/dma-mapping.h>' p$ @$ l8 J0 K0 V# A, ^5 m
- }; ]8 v1 A8 @ E+ \- #include <mach/memory.h>
5 M6 o" p. k1 X5 Q - #include <mach/hardware.h>
$ G1 E3 f, u J( e3 k# ?5 n - #include <mach/irqs.h>
' L0 X! e# r7 u( R - #include <asm/hardware/edma.h>
$ D7 J; I+ [" n - ( v6 `: H! O! X. c- F& M/ U8 Y6 [
- #undef EDMA3_DEBUG5 W) z1 ?3 |; R% O
- /*#define EDMA3_DEBUG*/& k$ U- F4 x; {; r1 U m
+ ?: e* O* k7 ]% a, t$ l- #ifdef EDMA3_DEBUG# ?5 b# \8 w+ I/ L9 k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }3 b, b( ^9 C7 w9 J2 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 M& s' W. v1 O* Z# y9 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ ?1 O8 f+ q7 m1 C' c - #else
* p4 @0 o4 N @8 ? o+ {9 g" @ - #define DMA_PRINTK( x... )' O. P- g: N7 p! X$ o5 y! b- ]* J. r
- #define DMA_FN_IN
! X; c' ?! g W - #define DMA_FN_OUT l$ B2 ~0 }9 |- P# k5 V6 Y
- #endif
# x3 o& \9 d1 U- K! Q; L - ( |: n; A# s. G* o6 T, `# |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). m1 [# ~* B7 p: I" R8 W
- #define STATIC_SHIFT 3' M( [/ h' d0 `+ z! I
- #define TCINTEN_SHIFT 20
; `7 Q* s, o/ w - #define ITCINTEN_SHIFT 21; r4 o; C6 y: a* }% {, Z6 D
- #define TCCHEN_SHIFT 22- ?# N+ i* D+ A2 [
- #define ITCCHEN_SHIFT 23
p' I, N: Y1 |
+ `( j6 d1 G6 e- static volatile int irqraised1 = 0;
. e) L' n) W; V% }* L - static volatile int irqraised2 = 0;
- u; M3 L* b+ _
! P8 ]# O+ a6 [" Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ C( Y9 I/ d# M8 ^$ h/ g6 M7 m4 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: U5 n9 V/ o! U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- I# {! T# y/ P3 A
) a% L7 k3 S e6 e- dma_addr_t dmaphyssrc1 = 0;/ `3 d/ q( [9 t( d' V, I
- dma_addr_t dmaphyssrc2 = 0;% x, O9 Z% s- D; i& \
- dma_addr_t dmaphysdest1 = 0;
* v* p6 S/ N9 b9 w6 g1 { - dma_addr_t dmaphysdest2 = 0;
8 I8 i% Q0 Q& v6 N7 @$ t+ [4 F: S
; y4 e2 | b2 F ?" v3 [- char *dmabufsrc1 = NULL;
3 {* p5 W4 E7 p3 I - char *dmabufsrc2 = NULL;
' |* W; C! I+ G8 m7 i$ L - char *dmabufdest1 = NULL;. k6 @/ `& \% o( M3 j8 S- E6 s
- char *dmabufdest2 = NULL;
\3 z3 u/ k) A) I - . x. j* g$ t7 G8 N
- static int acnt = 512;2 R+ [6 r" t8 L0 y5 p5 j; v
- static int bcnt = 8;
& V7 y" T/ A, L - static int ccnt = 8;# `" ?5 z9 l& I" J* N
- - Q! g4 F: O. m- A+ ~
- module_param(acnt, int, S_IRUGO);/ d# Z) ]" f0 ~$ a* L
- module_param(bcnt, int, S_IRUGO);
}6 [9 F+ V) N - module_param(ccnt, int, S_IRUGO);
复制代码
9 \& {5 u" j7 K8 {1 ~1 |. V5 @) [: Z# N; Y& |. x( ?3 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 Z) j8 ]+ Z( M2 h9 m5 M6 W! Z2 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; n# ]8 u- F+ M3 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 N2 {0 r4 U; c1 y5 a
I6 g- R+ r0 g7 [
8 U F* N3 y+ h$ I" h" S9 k |
|