|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; Z, O2 ~0 z. x% } h
- [code]EDMA sample test application. g4 D) e. Q, @; k
- /*: \( B" K9 X; U# {
- * edma_test.c( c1 K& q( _/ W/ a9 ]! [
- *
+ a. |' w6 B1 ^/ O7 t2 a9 N+ G8 w - * brief EDMA3 Test Application4 @% X% o) m. J8 X1 \
- *" g7 E" a" J2 e6 }; J
- * This file contains EDMA3 Test code.
3 t5 g5 n' X, v. u( T3 d: P" \0 G& r - *
4 y& D+ H3 k7 F; n2 \ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( J/ P+ C% f! x9 V; d. m0 d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' d: m- ?, q! `
- * TO CHANGE.
$ F! l) c3 u0 w! a# S - *
7 v4 l+ j2 B5 A; n7 ~+ I. S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; z/ p8 u- w+ f$ Z, b4 @; n* A& D - *
/ W0 s. C. I3 E6 ]& @& a- a - * This program is free software; you can redistribute it and/or
! @$ F* d4 {. X: ? - * modify it under the terms of the GNU General Public License as1 ?8 q5 r: r% a: w9 a
- * published by the Free Software Foundation version 2.& _& {8 {! b. g- {" H$ n: v
- *( m1 ^# ^# I$ l+ r% z. l+ [* E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ Z* R- | w/ V) Y/ _+ W+ {& y B1 |
- * kind, whether express or implied; without even the implied warranty
2 O; ~, E1 g9 W3 b3 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 W* S: _/ @6 ~7 g) Y
- * GNU General Public License for more details.
# C, e1 Y' B6 E; Z6 n8 w8 D2 \. i - */
B1 E, l: [& m! H/ L, ?" l
4 M& K5 w$ h5 i4 ^5 C3 n6 B- #include <linux/module.h>
$ ~# r4 q P- M4 H - #include <linux/init.h>5 u3 H& D! C& `8 l& B3 P H, ?
- #include <linux/errno.h>
& x3 i! S5 L* e/ |6 m6 R! M - #include <linux/types.h>7 \: G9 O F$ |% A( a* G% n% ^
- #include <linux/interrupt.h>
" G: ~9 E: t U' c1 j - #include <asm/io.h>
& Z' c) `) O% K1 x/ V3 o - #include <linux/moduleparam.h>
, b* h2 `; w! ^! z - #include <linux/sysctl.h>6 p/ V2 z& \ ]# V. T2 Y
- #include <linux/mm.h>
1 o+ r. L1 C G& W - #include <linux/dma-mapping.h>
& k9 O3 I0 O8 d2 r! V \
% n& x& u, G6 i& a9 _! `) T) c- #include <mach/memory.h>
- J/ @9 ?) r* p, L, ]6 x - #include <mach/hardware.h>
/ r2 }+ h% e- s0 C4 P" e/ ~ - #include <mach/irqs.h>- w) w- f! H$ \8 x" N* }1 b
- #include <asm/hardware/edma.h>
8 T0 B$ n8 m& i1 c3 c+ h - % e6 t7 d- K8 J9 a
- #undef EDMA3_DEBUG0 L) x! \! X$ c. V7 O; x3 u
- /*#define EDMA3_DEBUG*/+ }' S8 b& |: ^' j3 }. D
- % U# J- i2 d3 \" A0 q
- #ifdef EDMA3_DEBUG" Q5 H/ U& _ K/ S* Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( K$ R4 D X7 Q ~' E* ]# r4 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* B4 G: I8 _ @8 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 I5 d f6 \/ V, W0 B& |) ? - #else2 F8 K4 W6 G) ?
- #define DMA_PRINTK( x... )- j( O3 u" O. y- G
- #define DMA_FN_IN
8 t) _/ C2 D0 C - #define DMA_FN_OUT# }2 x% d0 X$ L$ d1 _4 c! K
- #endif9 q5 L0 T n* ?* y: S
- 7 B* J0 @& C" ?! _& U( J& l! Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; v' m' q- D0 U) z - #define STATIC_SHIFT 3
! I$ ]: r" ~' W1 n; K - #define TCINTEN_SHIFT 20
1 i( b8 m6 k) _4 v5 z+ D - #define ITCINTEN_SHIFT 21
/ B; `) A8 Z5 ^% ]4 C' H - #define TCCHEN_SHIFT 22
- s! H2 ]5 O6 j+ ? T8 y - #define ITCCHEN_SHIFT 236 ~4 ]- i9 i' y' e) s2 r
- x# n( X" A! ]. h, H3 `+ c
- static volatile int irqraised1 = 0;9 t% }! o. q5 g- s _6 p) H
- static volatile int irqraised2 = 0;- P' g/ Z8 j. S; j; r, F( }5 L. v4 F9 X
/ W* J. _# o7 C( n! Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 E( i. l L( L m( `4 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 o" I9 G, `' Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }% i( x' x" T+ t& d a& W! i- M
, B# e w! j1 C7 k( x, _- dma_addr_t dmaphyssrc1 = 0;
4 U& A2 w* S4 R$ {, G8 m O - dma_addr_t dmaphyssrc2 = 0;
! \$ B4 k3 m5 z9 n - dma_addr_t dmaphysdest1 = 0;
S2 u8 X7 a. e3 L7 H" } - dma_addr_t dmaphysdest2 = 0;
k4 K1 O( k; C. T, F: ^6 W - 6 {% @; E7 l0 ~( z* T" H
- char *dmabufsrc1 = NULL; i1 D# \) @. n; N; A1 }) v
- char *dmabufsrc2 = NULL;" {2 ?7 K7 z! p% K- A4 s' o
- char *dmabufdest1 = NULL;% E8 H6 J4 J/ D0 Y' ~" G& ]8 I
- char *dmabufdest2 = NULL;
1 Y1 K1 ^% c3 o5 S/ X: U3 F - P3 u2 n. t# ~- d: Q7 m
- static int acnt = 512;" r `- u5 j: a# J$ v& w
- static int bcnt = 8;
) j1 o( d C. e3 C* `0 A9 Z4 A6 n/ c - static int ccnt = 8;
7 ?) ^, [1 J1 {, H% @8 F# ^
1 ^, d9 l/ N) Y2 T$ e- module_param(acnt, int, S_IRUGO);' ?: K, R- l1 i& l% m0 a$ ~- q
- module_param(bcnt, int, S_IRUGO);" K. x+ X @& L5 {+ `9 d& P" M
- module_param(ccnt, int, S_IRUGO);
复制代码
% Z8 H, @, V7 s5 C; s
" I4 |5 ^& N3 f, g9 w, C6 ~% U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 T9 H' e4 {9 t- [$ N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ e8 F; p9 @0 U0 u* x, p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 X# a A# O1 i) A, K x! W* B$ r8 R
9 h8 ~7 X( i. x
7 \* U3 }# _% }$ K |
|