|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / k, l* [& U: z5 X: k
- [code]EDMA sample test application; C. B$ s2 o- z* K
- /*0 e; c4 z- P: e2 }0 ]( I G$ S
- * edma_test.c
5 q6 `9 o( G( K - *$ Z, M0 ?5 p8 ~. Z
- * brief EDMA3 Test Application
# s* n- _- P$ M* r' u: Y& y- k - *
* y9 a) z* G6 ]/ R: ^3 Z) K; }5 v2 x+ J - * This file contains EDMA3 Test code.
: i4 |# _) ]; a: N1 |0 G - *
9 O7 [( f3 b. p. _# ` Z4 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 {5 m. t1 d4 `8 {/ K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 ^' h, P4 a$ a% @3 Z. u: S8 l& J - * TO CHANGE.
: k$ W, \( b9 a) S$ [% C) b - *
' w: A" S' Y! q( o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. m9 G* U) ]- v9 t# {7 z! b, J: C
- *
3 m& c2 D, n% o7 q' F# Q, g! y$ b - * This program is free software; you can redistribute it and/or, r# K; P/ k9 O
- * modify it under the terms of the GNU General Public License as8 O1 u5 {' G" o4 Q" D
- * published by the Free Software Foundation version 2.
' e, W, q3 V; \+ J/ t% P3 J! V7 k - *
/ T* u/ c) r3 t3 m+ F ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any v! o9 g* k5 c4 Z0 h
- * kind, whether express or implied; without even the implied warranty1 P8 L/ O D) g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ `" @$ `$ c7 T3 \1 n, ~$ \* D - * GNU General Public License for more details.
$ N; {' T9 C4 {5 ]' M( _4 Q" U% u6 X - */" f- n- e3 z5 D
3 s/ R6 J% B9 o5 s1 P _2 c3 Y- #include <linux/module.h>
2 p: F& Y. ~% e1 M - #include <linux/init.h>/ y& H% K; Y2 w; H1 s
- #include <linux/errno.h>
% T/ g& k1 i$ ~ - #include <linux/types.h>' `! \; `! D: S% T; l0 I
- #include <linux/interrupt.h>* l c+ V% b# O8 f0 \0 Y
- #include <asm/io.h>- A+ e6 W% @/ C+ V+ {
- #include <linux/moduleparam.h>; E- ]& Z5 N) N$ `! K0 e
- #include <linux/sysctl.h>
: F8 @( Q% M6 H; `' p8 r - #include <linux/mm.h>
# T7 ^; u( q" c5 d6 D3 G/ w - #include <linux/dma-mapping.h>
: i7 R1 f5 D2 m5 I
$ S$ X! v7 c. `' r7 Q- L$ [- #include <mach/memory.h>& Z+ \: ?6 _7 h6 W- B( x. k
- #include <mach/hardware.h>
: U8 y$ X5 l2 s* l3 {5 _ - #include <mach/irqs.h>
{! R6 }# r9 m: A+ T - #include <asm/hardware/edma.h>
( m0 s) t; i$ V5 ~ - 8 u- d s S- V1 d7 o4 L6 b
- #undef EDMA3_DEBUG
2 [& j* d* j9 S% D5 x - /*#define EDMA3_DEBUG*/: p6 i( e- ~0 X' [; |. }
2 t' a& f9 Y/ y9 q1 D: q7 b- #ifdef EDMA3_DEBUG, u4 [8 v! R+ \
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), K5 u" o6 | L4 u3 L* ^; G0 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( }6 @- J9 q) ~; Z4 k7 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 V: P! Z; l( E' o" n& }
- #else
5 w" h7 d* h# [) `) ?) g - #define DMA_PRINTK( x... )
' w. w, X) E8 o. E+ f1 R; ^ - #define DMA_FN_IN, a) a0 D7 ~ @) f
- #define DMA_FN_OUT1 Z# p- J+ |/ E3 i; E
- #endif- S% z( k/ x$ ^( d& [1 M
- + q L- X: R+ P; p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 j/ b* N: e G, S6 i - #define STATIC_SHIFT 3! d8 h% L, y) ?% R3 d9 O* J+ [0 ?
- #define TCINTEN_SHIFT 205 A; a3 ?* g- M% R0 N
- #define ITCINTEN_SHIFT 210 s- e% L( @, C' z( d" u/ X
- #define TCCHEN_SHIFT 229 s1 w2 j8 u2 J6 V
- #define ITCCHEN_SHIFT 23& O7 R9 e8 T( o" g
9 S/ c! T2 ~( k* s: b- static volatile int irqraised1 = 0;" q8 a# I- T m
- static volatile int irqraised2 = 0;
: F* L1 C4 x! x0 u5 y% s0 q - 0 S9 g5 y7 W+ G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ L0 |$ Z- @* @& Z( w/ K3 m$ ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; l# C0 k% A+ a' L7 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 t% _8 x& t- `* c# C
+ e/ W" N @ i' g2 u" w) p- dma_addr_t dmaphyssrc1 = 0;3 ~: ]1 U2 h+ v; Q! K( t
- dma_addr_t dmaphyssrc2 = 0;
5 h$ }$ p3 H* r% ^$ o, f - dma_addr_t dmaphysdest1 = 0;
! w0 [) m3 u: A3 [$ C/ t - dma_addr_t dmaphysdest2 = 0;: P" j6 T8 Z. ?5 C
- 1 W X! M4 [+ Q$ E4 S: L N" J
- char *dmabufsrc1 = NULL;6 A, d& f4 q# `. A
- char *dmabufsrc2 = NULL;
- L2 X2 B% Y% t7 Z" v! C - char *dmabufdest1 = NULL;
/ W- o" C0 E; M2 `/ | - char *dmabufdest2 = NULL;7 X* ]9 i* g* \1 U! X
% w Z& {( {9 \% t' k# p% q6 g- static int acnt = 512;
2 D, P0 V' Z. i" u7 r! V" ? - static int bcnt = 8;
T5 Z& o& r8 F: z4 ? - static int ccnt = 8;
6 B+ x9 Z4 Y! Y) U3 y6 x' u - 6 m0 p! d: k2 m9 _6 x1 ~
- module_param(acnt, int, S_IRUGO);
& x2 m! m- O: ~3 d: k* K0 m - module_param(bcnt, int, S_IRUGO);% x8 b% P' l# \4 Z( `# i
- module_param(ccnt, int, S_IRUGO);
复制代码 , ?5 o$ m5 m2 N* M1 v. }7 A
. f& }3 J% u0 J4 |, ~, y6 d# \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ w; E u8 u+ T, T- X- S6 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ?0 B- O2 v9 ^9 E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 Z. p [4 J5 L
' z. k, K3 b; B! ^) H$ J
7 W& y2 l. @/ O( L |' h& G
|
|