|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # V: s. j6 N* H; N+ U! f$ T+ P
- [code]EDMA sample test application
1 |, \+ i0 N7 l4 e+ i - /*0 o/ j' y, L# O* _8 O
- * edma_test.c" K' k# ~( G: X
- *
2 l% A% l/ I" w# Y: x j - * brief EDMA3 Test Application
$ f: l; f) ]. E/ ^ - *8 }+ T0 i$ @' U. T; ?. ~
- * This file contains EDMA3 Test code./ J# J1 b+ K1 s% V0 T I
- * @ ?2 B& d# q( A8 H8 x/ G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; o$ j0 K" G; B4 }6 S# b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 T1 K- N1 M9 D
- * TO CHANGE.5 _( H, C* \" _* O' L3 f0 i% h
- *. \1 h g4 x% j# z9 ]( g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 X# t: ]; Q: ?7 `, ~1 \& l - *9 p" G) J* z/ m5 D) j b1 ` Q
- * This program is free software; you can redistribute it and/or
& h* ?# Y+ X; X - * modify it under the terms of the GNU General Public License as
/ R0 O3 F5 O3 C' k0 F - * published by the Free Software Foundation version 2.
7 C) W( {! v0 }: ~& ?0 ^4 l - *
+ ?& `( F8 _$ c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 h) @* o% O D8 B - * kind, whether express or implied; without even the implied warranty
, P: ]1 H+ `* K3 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 n# ~7 I( _6 x I - * GNU General Public License for more details.7 d+ b, J6 c/ S6 D8 u* ^
- */* H: {# G6 ?0 A, }
& j" t# n: v2 ?* ~7 {% I- #include <linux/module.h>9 u* e5 t! o8 v h- p
- #include <linux/init.h>0 g; _7 ?) o4 F- E+ N
- #include <linux/errno.h>
' K# n8 U$ @9 g/ u5 q+ T7 `) { - #include <linux/types.h>
1 R, s* R- K1 m' P4 v - #include <linux/interrupt.h>0 I3 U8 i$ L R9 @8 D) X3 P2 v+ @
- #include <asm/io.h>
2 V+ n$ K4 y* O- h& a; g* U! _ - #include <linux/moduleparam.h>8 x/ c4 d7 H0 v6 E3 [, }0 @& E( h
- #include <linux/sysctl.h>1 ]+ j. n8 q8 W4 D6 [2 ]
- #include <linux/mm.h>% w! `! L1 _" k# L+ H3 [; {: k* Q
- #include <linux/dma-mapping.h>' A L5 }9 S; ?
, }! N( _0 R1 h- #include <mach/memory.h>
2 v6 }& v3 \2 E# T, J) B" T - #include <mach/hardware.h>
& o* S1 z; M% R$ i% K+ \2 |% h - #include <mach/irqs.h>
4 f5 Y* Q6 a1 \' f8 ] - #include <asm/hardware/edma.h>
9 G3 m \4 Y* _: u - 1 S% o1 k9 {9 [* `/ n4 h' M
- #undef EDMA3_DEBUG8 D# }& z8 J8 ?6 F' }
- /*#define EDMA3_DEBUG*/
- f' \* \5 Q3 [) P8 M+ A d5 t! W! g1 _
! x+ ]( t9 p1 \9 t5 l- #ifdef EDMA3_DEBUG
* H! Y( _( i2 m8 t. a/ ^: \. \5 k% \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ [9 S9 T% M* ~8 T: G! g( _& z5 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 o+ a, E+ a- `7 R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 i, J( c' I6 I! o1 I+ W5 M# Z7 h - #else9 M6 O& @8 x, K( \1 W+ U3 M
- #define DMA_PRINTK( x... )! e I# M. w, U1 }& ~2 h% U( V
- #define DMA_FN_IN
: M8 G" r3 ]+ l9 S - #define DMA_FN_OUT
1 i+ K( p+ f( Y - #endif* V3 T1 M4 w* r, A8 u3 Q7 w& b) F
- 9 H% p- F4 U# R" d+ C. Q! O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. Q7 b& c- o/ n( a- C - #define STATIC_SHIFT 3
; y# k. G J* b; w2 `7 J% z7 Q. H. j - #define TCINTEN_SHIFT 20) S# W$ A4 P0 Y0 z/ t/ [
- #define ITCINTEN_SHIFT 21
, P8 ^* Z& I. ~- Z f# p# g - #define TCCHEN_SHIFT 22
: x+ B6 w7 O4 g/ Y/ V5 k - #define ITCCHEN_SHIFT 23 v1 l& h( b5 R6 P$ a$ F$ W
- E% S) T0 h) E. a- static volatile int irqraised1 = 0;
8 T7 K7 r! _/ _5 w0 ? - static volatile int irqraised2 = 0;1 Y8 R9 t% w, A- j! }) _
- ; o7 h2 a: ?/ Y: J* g4 Z& R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E$ x3 e1 |0 n( Y, x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p" d8 R2 N+ b4 j. L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ G5 a* ?, u4 u+ ]6 J
5 {" C4 R/ l& E0 O9 K& |$ P6 T0 g! s- dma_addr_t dmaphyssrc1 = 0;5 A' B9 k) X' T) m1 y* E3 T; O
- dma_addr_t dmaphyssrc2 = 0;
& R: t& ^2 O( I x$ w8 C R - dma_addr_t dmaphysdest1 = 0;
! o1 S4 K8 d! _8 b, h - dma_addr_t dmaphysdest2 = 0;
$ T6 ~! @* I# D - ' o5 ?2 k4 z( j/ T1 {2 e" \. [1 N
- char *dmabufsrc1 = NULL;
6 V' d/ z$ ~9 s+ N E3 i7 {0 H - char *dmabufsrc2 = NULL;& R* G% C B8 U
- char *dmabufdest1 = NULL;
T2 c1 E' E2 u7 }! L2 o - char *dmabufdest2 = NULL;
/ `9 p9 `. |+ T5 ~; ?0 @" n
' J- [+ ^+ L* y, F' h- static int acnt = 512;9 P- u& r* l; X/ S. P. n6 d% j
- static int bcnt = 8;
( }" x& [' R; o0 H( z - static int ccnt = 8;2 d' f. H2 |" h- T: l' R# q6 J _
- & O' f3 T( s) t2 d- a& p4 C0 E8 C
- module_param(acnt, int, S_IRUGO);5 Q- a" w# d! f4 E/ j/ f M
- module_param(bcnt, int, S_IRUGO);# K1 w6 r) m, G7 v ?
- module_param(ccnt, int, S_IRUGO);
复制代码 6 ]* B9 j) C- ], j5 O. r
1 S; ]' _8 ]' g# p* w. W' _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# @. ^! ]% x6 J8 ^0 m6 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 U& d; a! q E! o3 C5 I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 H0 O) H2 \! m8 T
6 w( O& R" ], [# c: Z1 h4 w+ P* ^+ y( z* j
|
|