|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 l; H' I% Z" ~, C R& {2 q7 U
- [code]EDMA sample test application
6 J2 v, I9 q6 m, S" _& D - /*$ D* ]2 @9 ~5 I: t. q8 T' w
- * edma_test.c
' }, U) c" R, _ Z3 H7 x - *$ A: B# C( [$ [' c" b( `: q
- * brief EDMA3 Test Application& ^: v! y6 f; M) @+ |9 L
- *( R% P; m4 l/ X2 e: [5 C0 Q
- * This file contains EDMA3 Test code.
) j7 P: ?9 D: v, W! d d% k - *
; B: f' F* u0 G' p& I* P% u0 ^ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 I- U$ O+ i1 ?6 q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Q9 E. _$ d+ e- c' p: h9 r
- * TO CHANGE.
. _# i% P) j6 {1 B. d7 M6 | - *9 K4 j& n/ |! V4 |, Z g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// f* I+ [1 J9 q
- *! w' a* }% P' T3 x/ p- G4 l1 r1 G+ L5 J
- * This program is free software; you can redistribute it and/or& A* O/ C& p+ j" l z
- * modify it under the terms of the GNU General Public License as
/ Y" u Q) z' e# [+ l - * published by the Free Software Foundation version 2." t! e) D5 b( ]1 v7 T9 \
- *+ M. W0 C! F [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 Y9 I& W6 j! A9 T" ?0 r/ | - * kind, whether express or implied; without even the implied warranty& s O) X( r; a: N* i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* M0 I' w# y8 \# q5 K - * GNU General Public License for more details.) Z) k0 {3 I( D0 Q: O& F0 T9 [
- */9 x5 Q4 l* n; S7 ~: [; y
- / h. j5 g! }2 I! G) ?8 k/ ~
- #include <linux/module.h>2 i6 ^8 f4 q: W
- #include <linux/init.h>& o5 u- ~/ }# T5 D5 d% r
- #include <linux/errno.h>- x! _# _0 [. U1 @$ b
- #include <linux/types.h>1 z+ F! C* y0 r! H$ q, z
- #include <linux/interrupt.h>* m0 N! X2 I. q/ K( I l/ X9 l
- #include <asm/io.h>4 t* `# H8 l) A: F6 v" m3 W, E
- #include <linux/moduleparam.h>
' H# F' M) w$ j+ A/ g3 C& q - #include <linux/sysctl.h>- z$ R3 K9 y! M$ {
- #include <linux/mm.h>
8 U' P4 C/ N: W' ]& q3 D - #include <linux/dma-mapping.h>/ c# k" ^7 I6 e% o1 k, b: @& o5 m+ E
- 2 f1 F/ w& C; j( m) a
- #include <mach/memory.h>0 Q1 X* ^6 C* W( m: G
- #include <mach/hardware.h>
) ~0 J/ \* N& K( y6 t+ R: ]; { - #include <mach/irqs.h>
l J( X% m5 j1 N3 U: Y; r: \ - #include <asm/hardware/edma.h>
) S) F3 t3 D7 M- ?/ ]9 I
9 E9 w3 [3 X. v1 C) p- #undef EDMA3_DEBUG
; W3 b* M# h' D) I/ Z1 g4 U6 e/ |5 W - /*#define EDMA3_DEBUG*/
9 m! H; K3 y+ I. G, r - . J+ Q; H5 |+ E* o; ^
- #ifdef EDMA3_DEBUG+ N7 _, I6 G7 F4 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 J7 ]1 X' N+ t2 I4 N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& W) D1 w# [! X& l0 n* B+ G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), F$ q4 O4 H( P# R: x6 }8 w) \& x
- #else% F8 o6 k& Q: G0 _+ n/ M( h6 E
- #define DMA_PRINTK( x... )
+ v0 w1 p" L9 F - #define DMA_FN_IN
{9 Q8 X% _3 A4 ~( z' c# j - #define DMA_FN_OUT1 Q/ k. m7 K$ Z4 h' `
- #endif
1 n' S+ A+ _) w - ; \# k( z! ~% d3 ?' j# M0 I9 Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) s' Y$ I4 N+ B, Y7 F
- #define STATIC_SHIFT 3
6 F9 K7 o0 }1 M, Q2 \2 B - #define TCINTEN_SHIFT 20
9 k5 T* r+ T4 ?4 d - #define ITCINTEN_SHIFT 21
3 @& ^2 _% ?( Z8 ~ - #define TCCHEN_SHIFT 22
$ \9 a' {$ N1 s9 U9 _" L - #define ITCCHEN_SHIFT 23
; n3 C# F: ~' F# b
$ w4 W# r: h& K$ T h5 n S; B5 e5 ^- static volatile int irqraised1 = 0;
( A; C# \9 G! I9 a - static volatile int irqraised2 = 0;
, f! K9 V0 k, N) d( F; c - + G8 ^8 u V# [2 B& A0 M5 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) s5 Y4 y5 X$ _0 o# }1 m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& H4 s& g m. g% T( M2 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a4 `7 l o& K% J0 j
' ?0 u5 a: P; \4 E- dma_addr_t dmaphyssrc1 = 0;) I0 ?3 ~& D, s/ I1 E6 t( @
- dma_addr_t dmaphyssrc2 = 0;
+ P' O. _+ _7 s - dma_addr_t dmaphysdest1 = 0;* ?+ r& f) u5 r
- dma_addr_t dmaphysdest2 = 0;
! ]2 K' N3 D- b3 C7 a+ U
; s% W: {. z$ ?" R+ Y: r- char *dmabufsrc1 = NULL;/ }/ ?/ U* V* B( n J( R
- char *dmabufsrc2 = NULL;# c" d2 e0 D+ i
- char *dmabufdest1 = NULL;+ w/ c# j8 H1 M e5 D( M! H' {
- char *dmabufdest2 = NULL;
) ]) r& X. ]# l% A6 j2 A* w - 9 b6 a4 m: a ~0 E6 G+ a2 t+ L, B
- static int acnt = 512;
, U. O3 i& w" h7 H ~ - static int bcnt = 8;
: C; T: ~! y- ~ - static int ccnt = 8;
9 O: M2 ^) o1 G- P0 R - - h) J/ r* v2 g( I; z% j
- module_param(acnt, int, S_IRUGO);3 P7 U* i2 {( N0 i4 T
- module_param(bcnt, int, S_IRUGO);. _6 s& f1 V$ [% j5 @
- module_param(ccnt, int, S_IRUGO);
复制代码 ; k! ^0 l. A, N* {6 O( T% t
7 t5 q E$ a" A3 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 P8 R% O% k( ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 J3 g& W6 V+ [' z" G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 y& m) H3 O, S* m5 u( T1 g
6 M" ]% F8 o, {8 @ F, M m
# ]6 G. Q$ m8 Q! e& o" G |
|