|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 i+ Z* B4 M4 V% R8 G/ d
- [code]EDMA sample test application5 M0 U2 ]1 }) g5 z
- /*
/ t5 I7 S) j' _/ f, W( [ - * edma_test.c
" E9 O( [, Z ]9 h& ^ - *
% H/ l$ s! _$ R( Y& H - * brief EDMA3 Test Application
* }9 X6 H/ x0 I! e* [ - *9 T- Z' [/ q2 F) m! ~
- * This file contains EDMA3 Test code.
# G+ Q; I' j! b) @6 N* H# o - *) I' a8 ^9 }8 p# D0 q' }: L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 _; s0 r; K6 R; i% ^/ U f ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: I. L8 X2 h1 c7 ~1 M, K; k5 F( j
- * TO CHANGE.
8 K4 w* M' I, Q7 J - *
, P. p* e9 k4 G' r: ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ?, A1 c* E$ A/ O, j0 C h - *( q9 _% s/ z9 s/ S/ k
- * This program is free software; you can redistribute it and/or2 F* ~" b- Z% z2 W
- * modify it under the terms of the GNU General Public License as
1 X0 s* a6 H9 H9 p2 }6 K - * published by the Free Software Foundation version 2.. Z( i* F3 S7 \$ W2 ?4 M$ \
- *0 u9 A& G" \( p' C3 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, I" Y# p5 j( d. E5 }
- * kind, whether express or implied; without even the implied warranty+ l" J6 f/ i! R) c' [4 ? t2 T3 B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 P" g1 f0 }6 @3 Q - * GNU General Public License for more details.2 i S% L0 Z* [! p: y
- */
3 u2 T( e; d( }. j2 [
( B8 V* U& a/ c4 y5 A4 @- #include <linux/module.h>
5 J( t# [+ t0 E, Y% { - #include <linux/init.h>
1 Q6 O' h: O P; ]7 s0 y5 z ] - #include <linux/errno.h>
3 \4 V& d# ?4 |3 e! b6 z; u) l - #include <linux/types.h>+ c2 b3 Z# Q9 F) S( S+ {, M
- #include <linux/interrupt.h>/ W, b; ^. z3 S
- #include <asm/io.h>5 d' K! F7 L( {3 u; S) M4 f& _
- #include <linux/moduleparam.h># U5 y4 g8 G4 ^, o
- #include <linux/sysctl.h>
! D, M- m7 N; }6 w. r. g; s - #include <linux/mm.h>
3 `# T5 [9 z/ E1 I7 x - #include <linux/dma-mapping.h>
6 |- P+ @+ x2 F - 5 N0 k/ |6 ~) k
- #include <mach/memory.h>
4 k* ?: V; r) f, O- n( \ - #include <mach/hardware.h>8 X5 q" o2 R5 {; x
- #include <mach/irqs.h>9 u( k S i V
- #include <asm/hardware/edma.h>8 d+ d2 x* g* z( {* y- d
- : |: o3 q3 J$ K3 w6 Y& k8 H0 ^
- #undef EDMA3_DEBUG/ _' N9 }# i% t% I9 y' R: _% e
- /*#define EDMA3_DEBUG*/
5 b4 p) I# P7 ` B! x
" K% r: w( W% T$ u0 Q- #ifdef EDMA3_DEBUG
: D# r/ C W0 @2 S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- r) I: d% ~+ R" T+ W) Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" ], g1 Q" g4 ?- ]4 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. `$ ?; D- s3 q/ U A" R D4 R - #else* ^/ A$ h% v) A- j3 A
- #define DMA_PRINTK( x... )
, b9 S+ {1 U7 V3 K - #define DMA_FN_IN
0 @& N- B" d! i2 `! Q6 k- a - #define DMA_FN_OUT1 O, D. G4 V+ a' A6 u H
- #endif
5 X4 O7 b; u3 Z/ l- B
/ a6 d) {3 |8 t" c) h3 M9 t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: O" W1 g$ u8 D0 r @ - #define STATIC_SHIFT 3
0 N6 `: o& r; U. C& E - #define TCINTEN_SHIFT 20
7 P b, H7 c. l4 j9 L" I/ u - #define ITCINTEN_SHIFT 21
3 N8 T0 O: u% B" ]( r7 c - #define TCCHEN_SHIFT 22* c4 n: H! ^5 d# r
- #define ITCCHEN_SHIFT 233 E& K' c; L# o V; ^" _# M
- - @1 y9 N% r% |
- static volatile int irqraised1 = 0;
9 k) r( H* D+ U$ n+ w - static volatile int irqraised2 = 0;9 `" \8 N' s, J
! E# L/ {( D/ W1 U$ o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& e, w b0 w4 f; l, ~5 {; w7 G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ y4 X8 z6 I O- ` i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& c, t2 @( h' {$ ? - 7 h. k0 _, O! w. ^, L# Y
- dma_addr_t dmaphyssrc1 = 0;
0 G# R- }; Z) g: V$ w' ~; ^! R - dma_addr_t dmaphyssrc2 = 0;1 Z% X; {' P* H- i$ T
- dma_addr_t dmaphysdest1 = 0;
. v* i$ |. G: M* }0 ~" ? - dma_addr_t dmaphysdest2 = 0;8 c4 T0 W+ z' [( z
' a' D% M' X: C- char *dmabufsrc1 = NULL;% Z7 J- w9 {. z0 f
- char *dmabufsrc2 = NULL;% v1 O8 ^9 s+ H! t
- char *dmabufdest1 = NULL;1 z- a& F) L0 u% N/ I0 H: T+ x4 z
- char *dmabufdest2 = NULL;
% k: Z: w$ c+ K! m& P
0 }& ?7 l% e" K) t- static int acnt = 512;
" J6 C o0 F! s" ] - static int bcnt = 8;/ I2 s, {# R- ?0 V+ i
- static int ccnt = 8;
; Q5 |7 B2 D1 k7 | - ! s1 H9 U K L$ ?9 F; C
- module_param(acnt, int, S_IRUGO);
J' w l) m3 z0 V6 w- E' K8 e/ S - module_param(bcnt, int, S_IRUGO);6 ^& x7 a* b* Q2 m6 k- }
- module_param(ccnt, int, S_IRUGO);
复制代码 0 n2 n& T6 i8 T* G: B+ Z [0 C' F
4 U1 r4 F. ~9 d7 n, h9 N( u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 c3 S5 x& b. r& ?" M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; X- D5 b- p3 C5 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 c7 z' f, k# N G+ [
# E; {6 v' O ^/ _
. H* Z9 S) t3 l |
|