|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " I8 u; O: ~7 \, k. _& D- U2 O, Z
- [code]EDMA sample test application9 I$ m) ]7 z0 U8 u8 O K( \
- /*! d* k! f, H( n2 e9 w7 @+ M
- * edma_test.c' }- @ P2 p% @" l& u* |
- *& b; z, O5 Q2 X9 r2 `3 L
- * brief EDMA3 Test Application$ s8 U$ ^# v! l3 Q1 c g
- *
8 g+ o, Q. w8 O - * This file contains EDMA3 Test code.: F. [. k9 U" [* |, f
- *
8 E- G3 t/ P" M) C$ A& j4 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 A- b3 _3 B; k+ B$ O+ K# Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 K, T- n/ s/ S2 t8 ]2 u - * TO CHANGE.
, H+ a7 w0 c/ s4 H - *
2 b) O& v8 r2 Z/ E* v" m5 _0 P- C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; I6 `( [( R% @; Z - *
( \; A; E* {# ]0 F2 R; f/ K! i% N - * This program is free software; you can redistribute it and/or7 A4 W* r' f2 [9 Y3 x
- * modify it under the terms of the GNU General Public License as r% k$ N2 a; q* w2 Z T% o1 z( s& X
- * published by the Free Software Foundation version 2.' r' V6 O. @' g( H1 U3 Z( w( P
- *8 u" f8 Q/ G6 C3 X2 S4 b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 q# T! M1 g, G/ C/ S - * kind, whether express or implied; without even the implied warranty
* t6 h- Y) O0 G; X8 O: M! Q7 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 `( P' K' \) c! J( k5 f7 s, i/ \5 l - * GNU General Public License for more details.1 Y( u2 t: Z! c+ q, T: `5 `/ Y
- */
$ L$ C- p. J) ~9 V8 W- p: { - ! W; h% O9 T% h: v$ N3 z+ c n
- #include <linux/module.h>
7 B( @6 O+ x2 e/ X8 v/ ~ - #include <linux/init.h>, B; N8 J) G V. p' O
- #include <linux/errno.h>. G1 o5 l- D1 {( t3 [# Y
- #include <linux/types.h>
' B. e0 j# Z# T$ n& I& Z - #include <linux/interrupt.h>! J k* E! i5 o- n% S7 p" _4 W
- #include <asm/io.h>5 \7 o# e- A' t- H( F+ V5 x& t: Y
- #include <linux/moduleparam.h>
! {& u! T2 W8 y8 o3 t% @ - #include <linux/sysctl.h>
# {4 M: q1 c* ? - #include <linux/mm.h>
o. P0 e4 H0 V* K$ x$ {/ N - #include <linux/dma-mapping.h>
) t) g" G3 j9 D/ [ Z9 J+ W( G - 9 |. \ e9 u" J0 A8 a8 N
- #include <mach/memory.h>9 G% H# l2 v% _* \4 z: N
- #include <mach/hardware.h>, }' S. E4 K, U4 q/ A: p
- #include <mach/irqs.h>
7 F0 _- _* \* G+ G0 c - #include <asm/hardware/edma.h>
' f. G( [; K. |4 v- n f - : A. ] h3 b( u& }, m" Z
- #undef EDMA3_DEBUG2 B$ O! ]0 Y- g6 ~: ~5 F+ y
- /*#define EDMA3_DEBUG*/
. G {" x2 ^$ m( J8 Y- ]( z - 5 L: h/ u% h6 S& r9 w9 L% ?; ~. ?
- #ifdef EDMA3_DEBUG
; ]) U3 r, h& {& ] T - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
{% o# i. d @* L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* a% N4 w! V. ^, j* Z! t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 F1 W% B8 l* E - #else: W& s- c6 ^1 N1 `# E
- #define DMA_PRINTK( x... )6 K5 r! q4 S7 P+ i1 N! p
- #define DMA_FN_IN
: r/ }4 x! ]3 l W2 Z1 }4 F) w. N) s t6 A - #define DMA_FN_OUT' M \' j+ n, ^8 u9 b
- #endif
+ }) Q7 V8 U/ a: n- Y
1 I6 k/ h1 z$ ]0 o* h- r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) Z8 s: r6 M4 \2 }6 W o
- #define STATIC_SHIFT 3
8 G7 X4 W' o4 `* Y# @ - #define TCINTEN_SHIFT 207 c% _; l6 I: w; }1 C. h! M
- #define ITCINTEN_SHIFT 21' j5 r2 H% o- X6 u8 X
- #define TCCHEN_SHIFT 22
( F1 W. r0 t) ?8 }7 m - #define ITCCHEN_SHIFT 23/ B* y- D8 w7 F7 y
- ! h: I2 p. G+ F) D' j
- static volatile int irqraised1 = 0;% g* D% `" K, x0 }; W% e1 T
- static volatile int irqraised2 = 0;
t6 q/ [- |+ h
1 q. e1 o: E. ~9 D" a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 Q) v) |/ v( s. A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: k" D9 Y9 ~9 Z& V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); `& d4 b. u$ n0 M1 R+ @$ ~
- 3 I5 q3 ^* M+ h/ d2 k& a
- dma_addr_t dmaphyssrc1 = 0;1 f& K9 v% D" \% s1 h
- dma_addr_t dmaphyssrc2 = 0;, b [ j& a6 W
- dma_addr_t dmaphysdest1 = 0;5 Y' G! |/ y" j8 x0 p7 \
- dma_addr_t dmaphysdest2 = 0;5 E5 Z7 f A. [8 r6 q2 K5 l) x
- / ]" M; V: p# b* o" s' v+ e
- char *dmabufsrc1 = NULL;
( b& h# v' J8 N/ r - char *dmabufsrc2 = NULL;
# h6 D% X, J% R; \; b' N - char *dmabufdest1 = NULL;" y2 t3 p. Y: J( J: I
- char *dmabufdest2 = NULL;& B' Q) F# E6 @7 H$ d
- d3 I# K& x- V% e x! C! q
- static int acnt = 512;
{! \4 `. K( s( { - static int bcnt = 8;+ E7 h$ T" i2 Y# k
- static int ccnt = 8;+ h; [2 ^, u( l& p, r: {% ]
+ I, j* C, a( w$ r" c+ U- module_param(acnt, int, S_IRUGO);, G+ w |) ?. Z0 C' F. E
- module_param(bcnt, int, S_IRUGO);. p% A t$ j; z1 z' o" Q/ a1 o3 V
- module_param(ccnt, int, S_IRUGO);
复制代码 9 N, q) ^" Q" l% g0 t
8 u) o- P2 U$ J3 T9 k! p/ A5 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ u1 |- }' N/ ?4 \7 g0 H6 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 t8 M @0 X6 c2 s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 w0 k8 X$ V. C& y) Q
7 P* i9 Q. M3 o* q. s% a* K0 P% \7 _1 k2 b. \& E+ T
|
|