|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 t# Y7 i' D2 S6 n1 Z, M; W- [code]EDMA sample test application
1 U L0 ]# H. O) h/ x - /*
p+ W1 a% K' U8 f# p* ]/ k( G - * edma_test.c$ f5 h# R6 X, ?. `# x( q' b
- *
, H9 M9 G9 N6 y$ q - * brief EDMA3 Test Application* v5 K# y' t8 J; J: _& i5 c
- *( g5 M! C9 c) l9 ?: }
- * This file contains EDMA3 Test code.1 @/ C6 u/ d( J/ l5 R( R( U1 D& ]0 Y& m: [
- *
9 u7 d' H+ K- [- | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ a( S2 D' ^0 t: e0 X2 z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( A: x5 o4 l" I j, X8 ^8 f
- * TO CHANGE.
1 U2 u9 D2 |8 A) s! j" H7 \5 t - *
# m6 C* R! W5 d* n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# ^* G+ j4 F, s - *
" V4 `/ q& o. b/ e - * This program is free software; you can redistribute it and/or
" C, ?) N+ |5 Q! t9 s: Y' j - * modify it under the terms of the GNU General Public License as7 }- T: ~$ t7 z
- * published by the Free Software Foundation version 2.
1 N/ L) G O% g - *; V2 Z/ T$ y+ H2 h5 V a0 V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 X5 x- ]8 N' X
- * kind, whether express or implied; without even the implied warranty i$ h5 B0 l7 q, }3 l7 @8 z$ ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" V' m$ P0 ?/ V/ y% G! s - * GNU General Public License for more details.
% i1 _: g3 q' ~8 Y$ M - */* X* P; ^3 B% a
- / g& N d0 k: J# Q: Y5 U
- #include <linux/module.h>
/ ~/ a0 Y" ~# A7 ?% D9 }" \ - #include <linux/init.h>& D& j" d Y6 g8 u2 i$ Q
- #include <linux/errno.h>% E3 x5 l7 |) h! `% w! r% E: e
- #include <linux/types.h>
& E9 C/ {, B3 \; U. o/ y( q- S - #include <linux/interrupt.h>1 ?% ^) W" [! t: A' H$ I
- #include <asm/io.h>
6 b' D) ^! p( `9 j( F$ ` - #include <linux/moduleparam.h>
5 u+ w p8 g, Y5 D2 O: Z- L - #include <linux/sysctl.h>7 m# g' ]% x( N3 v
- #include <linux/mm.h>' f" d3 q1 z2 L
- #include <linux/dma-mapping.h>
d$ h, c- d0 f# o8 _8 I - , f" I q1 F! m6 [! `
- #include <mach/memory.h>
* t- X! F! r3 j5 x4 Q6 W5 M - #include <mach/hardware.h>
* g& B5 M/ Y' o: b6 x/ ?4 N - #include <mach/irqs.h>
6 M) z4 g4 v; N2 s' \ - #include <asm/hardware/edma.h>
) s& k- b+ R- u- V; s+ Q - . e% |9 Y' I( Q% I+ S
- #undef EDMA3_DEBUG8 D2 H8 g5 i7 z$ r
- /*#define EDMA3_DEBUG*/8 q$ b6 B" U; P: Z6 E
7 l) v7 i2 | a7 g' k! H& o y2 P- #ifdef EDMA3_DEBUG/ T9 z1 E- N4 I* Z4 {$ S2 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, W, F: c' Z9 |" o' [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ Y# ]7 h# e8 O4 x8 L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 p1 X8 E( B0 a* N$ h. D3 s& ~
- #else
2 u. e9 r1 |4 a! y! t: } - #define DMA_PRINTK( x... )* r4 c- p+ Q8 X4 D! v% L
- #define DMA_FN_IN
3 a _0 q( U# ^* ?% I1 q. |$ O: n - #define DMA_FN_OUT
9 s! p l8 Q% Y' S3 z8 f - #endif. q% G& p; O; |4 K1 {4 I
- 2 Q# i' r: q! b, p8 W _) B8 }6 f1 Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' z" @) c1 Y% z O+ U
- #define STATIC_SHIFT 3
0 k; u9 ^( D1 V7 d$ s& M - #define TCINTEN_SHIFT 20* n- X7 |5 `/ \. q7 P
- #define ITCINTEN_SHIFT 21
P" v/ Z; M- {# p" g5 w' Y: ^+ O - #define TCCHEN_SHIFT 22
+ O0 c4 {4 d/ _5 q! _ - #define ITCCHEN_SHIFT 23* O7 S! u! i/ n7 ~( d6 P/ _. s. Z
2 @% C! K0 ?! g. d: D0 W- static volatile int irqraised1 = 0;6 s7 O# e6 r( w" w7 Y! s
- static volatile int irqraised2 = 0;3 D4 n( }* B0 i& p i2 I
7 r" K5 \4 R9 g J7 I' N6 A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ J/ t# [; E, l' V) g6 J9 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i: S* m$ I# ^$ X+ H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 `* k+ N& N$ Y6 z. j, S* t
9 h% N( g7 x! U- dma_addr_t dmaphyssrc1 = 0;
0 w3 E! \0 n) N; N3 @5 O# a# E - dma_addr_t dmaphyssrc2 = 0;( I. M# Q ~* O
- dma_addr_t dmaphysdest1 = 0;: j7 G6 I5 a- P+ ]: I4 B
- dma_addr_t dmaphysdest2 = 0;
* ^/ c9 [. D6 B! z, K% u# X' } - " U; C/ c4 O! y& P* p
- char *dmabufsrc1 = NULL;
8 j! q+ f( W+ l9 B - char *dmabufsrc2 = NULL;& Y" B4 [$ R- L# q9 Z
- char *dmabufdest1 = NULL;+ c- P* Z+ X8 K! U
- char *dmabufdest2 = NULL;+ {7 a( U; ?: G1 g% h, @
- . z+ a1 B2 G* Z
- static int acnt = 512;
' P9 X8 j& C" L3 l; P. m - static int bcnt = 8;
" t u3 {( {" |4 d: Y$ e - static int ccnt = 8;
. j8 \; D, a4 Q6 [- U
' T) l6 I) R( f( g8 E; G- module_param(acnt, int, S_IRUGO);
) t) `, o2 h1 G- m, x' n0 _" n! c - module_param(bcnt, int, S_IRUGO);
2 h2 t* L/ J- r# s# g, J7 u& q# q - module_param(ccnt, int, S_IRUGO);
复制代码
8 S. ^! E: ]$ ~9 e9 W6 e5 I- V/ t4 O: k; N" k- u* U$ R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 M0 C3 A, `. ^- t" @4 D2 J9 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 |1 d! l3 I/ E D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% j, `: Q' k, n# {' {5 m7 V
0 Q Q$ d5 Z, ]2 z+ Y; R( k" S! e( M4 ^2 V7 z
|
|