|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + e3 }6 M% R3 j7 P
- [code]EDMA sample test application
4 k [ v5 q+ A0 `$ i7 x+ T - /*
; x3 v$ q& o7 ?0 M) D }1 _) z - * edma_test.c
) I" b2 d2 K) m: X - *
& k/ d. w8 I- _/ P - * brief EDMA3 Test Application
F/ Z. k$ V- L$ M- h - *" V6 j& x; A; S$ O5 [' s3 R' `# f
- * This file contains EDMA3 Test code.8 d- s2 t: | p% I: E6 E
- *: w7 `- X7 `5 B- a/ p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( B2 o: C( z2 E' s7 {2 F, f6 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& C( \; d* z) k5 ~
- * TO CHANGE./ _/ r0 v; @" P( k9 Q
- *& z% h# [6 \6 e1 r7 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. _, Y P% ^& Z# m' e
- *
; n5 H! \2 I4 Y! c+ O - * This program is free software; you can redistribute it and/or
3 f' V4 |$ c' P6 {: R( O - * modify it under the terms of the GNU General Public License as+ p% z- P, \ B2 _1 U- g( c9 |3 ^
- * published by the Free Software Foundation version 2.3 I! Y& g0 O% w/ Q6 p7 |9 R N
- *+ b: l b9 `; w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 ^: [& \7 I6 k - * kind, whether express or implied; without even the implied warranty% @9 W0 @( [8 c. `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 W. t1 M% v) T - * GNU General Public License for more details.
1 N5 _! j+ M0 P6 x1 r3 e' O' y; T, [ - */
. K0 E$ @9 P O) }8 X! e - / ` t/ F4 I" M; e4 A: \0 Q4 o
- #include <linux/module.h>) P2 ]& V) U% E9 p
- #include <linux/init.h>
) L& l/ U- j; @2 }$ t - #include <linux/errno.h>" b9 ^( X1 c9 ]6 S0 t* a8 h
- #include <linux/types.h>- L* C% V0 z: T
- #include <linux/interrupt.h>
' [- G% e4 L# }+ T6 C - #include <asm/io.h>3 K, K; C* Z0 N7 ^& x$ @% P9 z7 g
- #include <linux/moduleparam.h>
6 S1 i" v, k" C* {3 W, O7 O - #include <linux/sysctl.h>5 a5 q" I" S/ N' P9 H8 z
- #include <linux/mm.h>4 n! y$ g3 @: c) c6 \" z3 V
- #include <linux/dma-mapping.h>
& Q7 S3 \7 m, l' {9 V+ _& i' r - ) e% i _ S: v) M
- #include <mach/memory.h>( S w$ n2 H3 O) ^; ~' G- s! s& D: }
- #include <mach/hardware.h>
6 o" O2 w3 P- z' \+ _# L& k - #include <mach/irqs.h>
1 _6 J' L! h1 D7 u* w - #include <asm/hardware/edma.h>% {1 Z8 G6 J- o. P$ |
4 r7 v6 y0 I# ]3 s1 G* S- #undef EDMA3_DEBUG
5 [' R5 t2 p' h* e. s - /*#define EDMA3_DEBUG*/) g# u# L) [' Q! _8 T0 p
- - \; Y$ H/ s0 P
- #ifdef EDMA3_DEBUG$ u. a v$ m" d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 u9 M* Y8 r9 u; c; v3 @, V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
d" I3 P5 |6 a3 l2 W8 B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 }' _& @) m$ w - #else7 `" @9 b# ^) `% a2 Z1 S
- #define DMA_PRINTK( x... )
% d/ H# e1 V$ `3 [3 R - #define DMA_FN_IN% D8 S7 Z D- e0 o8 B/ |' W
- #define DMA_FN_OUT
* M/ d- L; o2 ~( A: a+ a" s - #endif
+ [5 v/ r$ q6 U+ _8 o$ k* y - 6 `. p( ]" H6 D: x0 Y+ q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( L1 n7 b! ?) w$ Y+ s
- #define STATIC_SHIFT 3
8 G) m* D# H( g2 p% F: B - #define TCINTEN_SHIFT 208 @$ B c9 Q( M! k
- #define ITCINTEN_SHIFT 21
& Z' D: T3 X% _! V1 Y" ^$ s - #define TCCHEN_SHIFT 22
- I" q' W: v4 c/ e* p - #define ITCCHEN_SHIFT 23' V7 }0 R4 R* |' W% R8 G
/ m' f7 O* k" i4 ^, l, A- static volatile int irqraised1 = 0;
' b' [. b0 J- A0 w - static volatile int irqraised2 = 0;
- a% _7 Y( w/ Z1 W3 R( U - 1 x2 [% g \% l& s( g2 \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |+ X2 {% O N7 [+ f9 q1 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 @+ e/ @, y3 Q: B5 v' w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% \4 |; `5 h! |' [* _) V' X. ~% \
- , y' F' E: I ?( v
- dma_addr_t dmaphyssrc1 = 0;$ Y9 z5 y4 @9 d
- dma_addr_t dmaphyssrc2 = 0;3 ~, s# a: z4 B% Z. x! j m1 k
- dma_addr_t dmaphysdest1 = 0;
3 [$ O, z% G' c - dma_addr_t dmaphysdest2 = 0;
0 O. |# E" g6 A7 l+ ]8 s" i
( s5 q9 m$ {* I9 I- char *dmabufsrc1 = NULL;
4 e: _# O( H" l( c) ]5 F: T& ~: ]5 G/ l - char *dmabufsrc2 = NULL;5 l! Y2 @% D Y: j4 s! D1 J N
- char *dmabufdest1 = NULL;
, H6 |& I9 y0 x3 r$ I - char *dmabufdest2 = NULL;
/ w" w5 \5 P9 a& O& R6 W1 ?, { q
. _9 ?+ q' Z1 r# J6 C- static int acnt = 512;# F' N2 j/ }9 P7 R% [- e' q
- static int bcnt = 8;
1 `* d- ~" J7 M) \; f+ R! [ - static int ccnt = 8;
% @) D- [" z- f7 i1 I' ~ - : t% ^# o1 R$ n. \% O \: B
- module_param(acnt, int, S_IRUGO);
7 F* O' c+ E/ W) h - module_param(bcnt, int, S_IRUGO);
3 P6 s A" V, D( J. u& i$ t7 ]8 P& q/ f - module_param(ccnt, int, S_IRUGO);
复制代码 * I2 g) N+ w5 a0 W
5 K6 [0 F4 c. k* `/ { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& z+ q( G2 }0 N, e/ q& {! S6 s$ H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 Z* s; T7 W8 U: f `8 p2 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 I+ Q% s+ h( q2 w: V: K5 u. A& L4 O' @" v0 h" {0 X. j, @' t
9 u" }3 R! g0 R L$ x( q3 {
|
|