|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" k' j+ x5 ~5 g/ t; x$ x% S- [code]EDMA sample test application5 `/ D& k* V" P" a1 V$ _
- /*
* U3 N8 b3 e! b- i7 b f. V - * edma_test.c% Q: v+ W) ?8 [0 G7 z. r
- *; H: d- r3 e# T* X* z( S
- * brief EDMA3 Test Application4 K& H. q P7 B" Y- N6 W! O0 x
- *
* j9 n) e# ]2 j& Z - * This file contains EDMA3 Test code.
8 E/ s/ T# b0 g z* T - *$ s i1 _- H! W! E4 c. y" s9 c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! F' _+ h% I& |' [% O5 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ |3 \: V. H4 K/ D
- * TO CHANGE.
6 u4 }) D5 E+ } - *
, u4 I8 ?$ c/ o% f: ~6 p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* O6 \1 ^+ d ]3 L: B2 v2 X
- *& B. U: [% `5 U, Q; Z/ ]( `+ Q7 g
- * This program is free software; you can redistribute it and/or
0 r/ D3 o# R6 j! ]8 D - * modify it under the terms of the GNU General Public License as$ N* m) [4 `' t! w
- * published by the Free Software Foundation version 2., [* `- J( h- { N9 D
- *
6 p A3 e$ s, i; ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% H$ F) P( \5 V; n, [ - * kind, whether express or implied; without even the implied warranty
) x, b% U! K) @! r( C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% s+ X/ W& F! @
- * GNU General Public License for more details.
7 A0 H5 Q% Z. i% F - */" q% h* R7 k+ ?/ Z- L; l
- ; {. a$ c, N% K- m) U8 v
- #include <linux/module.h>
3 y$ S" I' q; P/ e# k) j - #include <linux/init.h> E) Y+ C3 Q- }5 U
- #include <linux/errno.h>, d+ o2 c# q( L7 C7 }4 H& T ~
- #include <linux/types.h> C" D9 z+ V5 w" N
- #include <linux/interrupt.h> X5 z" B9 R& @7 O
- #include <asm/io.h>' |, G9 B$ w5 c7 A- z8 u
- #include <linux/moduleparam.h>( ~3 D; m% d8 a1 [2 i3 F$ j8 y
- #include <linux/sysctl.h>
: Z# K$ g3 x7 H - #include <linux/mm.h>
' Q; Y2 e( D( p - #include <linux/dma-mapping.h>: ?0 V! e: Y/ Z# d7 |# K6 Q' S
- / \2 c( @# ?- ? a/ o
- #include <mach/memory.h>5 g4 o2 w/ Z5 y; @. E. a2 K" z
- #include <mach/hardware.h>
9 @( n% S0 i" f! j: \& L, M U; {- L - #include <mach/irqs.h>
3 F. o( m$ o0 @ - #include <asm/hardware/edma.h>
2 v) T7 S; T% z; C, s5 L - 4 ^, K7 x& g5 I6 Y% W- ?6 ]
- #undef EDMA3_DEBUG
$ T5 I* F; y, L' ?1 T - /*#define EDMA3_DEBUG*/" C$ U2 z+ M$ i2 C3 L
. U8 {( b4 t$ [- #ifdef EDMA3_DEBUG
/ q% ?; r) K) Y* Y" m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' o N8 ^' S' F y/ R: N3 r* ]% a- L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& H# l0 g4 G4 t% a* L6 R) n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
u% [: S5 D+ U# I8 y! W9 _8 ^/ Q0 ` - #else4 K: ~, @' U" k! }5 M. y
- #define DMA_PRINTK( x... )
k S. l# u* J" g1 f - #define DMA_FN_IN/ ~4 \0 L. W4 C# K
- #define DMA_FN_OUT5 A1 F9 n1 E3 g C
- #endif
+ P2 \, U& i, R( B/ t. Y6 c
7 l' A# \( P2 w8 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ c I' _9 h1 l/ D4 @$ i4 A4 z8 i
- #define STATIC_SHIFT 3
8 n2 f$ F' p, t# O) V2 r - #define TCINTEN_SHIFT 20" x; n: X- v# t7 c5 d: b3 G1 }5 N
- #define ITCINTEN_SHIFT 210 l/ l. m# m, d, s! e; V6 d& L
- #define TCCHEN_SHIFT 22
. F& `3 X s2 x" c/ m - #define ITCCHEN_SHIFT 237 x/ Y/ p0 S5 t+ K0 x+ D8 `. m: r2 Z% ^
# @- O7 v( f0 C$ u1 j0 U- static volatile int irqraised1 = 0;
$ A& O, V3 y, Y% j1 P2 S) W8 f3 T - static volatile int irqraised2 = 0;& |& ` ~! s" \
! b& H, J/ d: S6 ]9 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T+ t* J0 _ x* Q/ d! k% m3 d, R5 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |0 X7 ?; n* Q2 D, V' l& X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, X/ j& ]; s) Z4 @$ W& A
7 Q2 }* b/ X( H& B5 J' @( V- dma_addr_t dmaphyssrc1 = 0;1 n& N# ]% E2 h w0 o- k* Q9 h7 i
- dma_addr_t dmaphyssrc2 = 0;
0 }- s4 [1 b% p' \' m8 m - dma_addr_t dmaphysdest1 = 0;. B5 J, @+ [ H- H+ H/ y, a* u/ {1 D
- dma_addr_t dmaphysdest2 = 0;
, z" B. @1 t1 |# X' y n - ( N; c- Q& x! Y% {' O
- char *dmabufsrc1 = NULL;
! n5 v; p0 Y# ?# g; }- q' h* y - char *dmabufsrc2 = NULL;$ D: O$ X5 c0 q, F! j
- char *dmabufdest1 = NULL;
' P- V9 g& |5 ^$ Q - char *dmabufdest2 = NULL;
( Q( {6 T) V* d8 n! Z - " i5 z8 L r2 F" t
- static int acnt = 512;
g1 W' |( g' W. O2 j' r - static int bcnt = 8;
2 H6 m* m2 E% I; B. h u - static int ccnt = 8;- n! d0 e2 Y: `1 m
: i* t, d" i) X G8 D: P1 Y- module_param(acnt, int, S_IRUGO);
% o6 ?3 A4 A& z! q' |& }. j: F - module_param(bcnt, int, S_IRUGO);1 O2 D( ]7 W$ d) Z" F
- module_param(ccnt, int, S_IRUGO);
复制代码
( d9 H* K" c1 \# W8 H- t3 n
& Q! d9 }/ R7 ] H6 c& S2 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 y( @' A- A% `2 x2 N9 c oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. [% B: }7 E* [3 M" x7 L1 B6 G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 g( C) f1 q' d) M6 P/ u$ N8 x! J7 h: C' M0 K3 v. |7 E
}0 x5 Q* z4 l0 G. Z4 m5 l |
|