|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ Q2 D+ S, Y E. J& ~
- [code]EDMA sample test application8 N5 \3 I5 r1 h& @6 Y
- /*
+ S* f9 E" g& ?+ L - * edma_test.c# O8 t( q; `4 Z
- *" x6 g: Q+ j q1 a
- * brief EDMA3 Test Application, M. J& U# ^! ^ d/ n
- *1 U4 \' q6 X2 @1 d, b
- * This file contains EDMA3 Test code.& r3 k: |& B1 S5 H2 [4 D
- *( f4 M2 V& W& T2 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ y2 w6 j4 m9 `1 \6 ]1 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 N* g O- D7 N9 ^+ y - * TO CHANGE.5 f8 K* p5 a' { F9 l) h; o
- *
5 O1 B9 S8 |. ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ X8 N0 s4 N, J
- *" ~9 m% o$ s( s+ q
- * This program is free software; you can redistribute it and/or
# j0 Z0 y6 D* } - * modify it under the terms of the GNU General Public License as
% _4 \' S* I" }# F7 T& l) d - * published by the Free Software Foundation version 2.$ z& y0 |7 ]; s: W
- *, X# z6 F/ L# s7 H/ G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. S: j- C; A) \( `% ]( a. M2 F
- * kind, whether express or implied; without even the implied warranty0 u3 h i( z: G* Y+ n+ Z+ b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. K) [) U, a; {/ A: z7 M p% Q - * GNU General Public License for more details." G9 S) j* d, R7 o' C" C }6 d
- */2 D1 S8 S$ ]6 E, p0 K
- * Z3 M* ?5 U$ O. c
- #include <linux/module.h>
0 U, B# S5 S; Q& \$ G4 ? - #include <linux/init.h>
2 F) {' |* O4 \' c0 n - #include <linux/errno.h>
- I4 V n) w! k6 |; q - #include <linux/types.h>2 U1 j* N# ]) m) @. ?
- #include <linux/interrupt.h>
6 U" W( l1 n2 m1 ~7 ` - #include <asm/io.h>
6 t7 w, w0 m' \) q- o - #include <linux/moduleparam.h>
* A' [; K! B6 e& a8 [/ B7 A/ | - #include <linux/sysctl.h>% @* O" }' f; _1 |
- #include <linux/mm.h>
+ R* p; c* X$ Y - #include <linux/dma-mapping.h>6 N& Q' t% i# ~
/ |& \& l. U( p" U7 P9 u* V# R: U3 R- #include <mach/memory.h>
9 ^4 \4 M% |- n3 m. H! i; c - #include <mach/hardware.h>
; k0 X& H0 Y) X& u x; X) t - #include <mach/irqs.h>
7 Q+ i; Z: J3 [+ Q# l - #include <asm/hardware/edma.h>( Z, l# } y. e( k# m( ^
- ! h8 @# ]5 i' P8 L" }' W
- #undef EDMA3_DEBUG
- I& y! i# M) ^$ R; l1 N8 O - /*#define EDMA3_DEBUG*/! y& {5 C9 u# @6 _/ u/ E9 }
& ~% }% h$ C" v% S% s1 p8 ~4 t- #ifdef EDMA3_DEBUG* J) Q. P) _' Z6 j2 D4 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) {9 ?) P& Y( M8 V+ Y5 d9 i$ q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 P+ D2 X. E6 A* l) Q& K6 z( F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, L% u! @, }/ [' ~ - #else
9 S+ x8 t) s7 `4 Z$ r0 O2 ? - #define DMA_PRINTK( x... )4 j* q7 L6 |1 `; G9 B
- #define DMA_FN_IN
4 h1 ^, M. k% j - #define DMA_FN_OUT
% K( c' f( v; {6 P j - #endif: r( x a0 q( @; H8 f
- ) m( L/ V- {+ q' u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' g! R" j1 s- H/ i4 T+ S
- #define STATIC_SHIFT 3
# y" U# @& F4 X/ r) w- N: a - #define TCINTEN_SHIFT 20
7 h( Y: k& b, P+ E9 H! { - #define ITCINTEN_SHIFT 21# B7 h, b9 b) E4 N
- #define TCCHEN_SHIFT 22% J, s) [/ x' i$ {- t
- #define ITCCHEN_SHIFT 23
' K) t; G( F5 w9 j4 s* R - ( y9 {8 n) v/ F0 e) H2 [! U
- static volatile int irqraised1 = 0;4 D2 l- X u _5 }3 {
- static volatile int irqraised2 = 0;
6 k, i( k6 M: \ E& _ - 7 l1 C7 `2 b! n( r' J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~1 U( U) a( F e! [3 }! a8 z9 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# F( O6 u. y8 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a/ N' ?: b5 o* i$ q
: n6 I1 c+ n& z8 ]- dma_addr_t dmaphyssrc1 = 0;
; v! \6 }& {; K0 t - dma_addr_t dmaphyssrc2 = 0;+ w/ T w8 E3 W/ a' w! L
- dma_addr_t dmaphysdest1 = 0;
3 L8 `% |* h% `7 N( U& X - dma_addr_t dmaphysdest2 = 0;9 Z3 C. g' l; Z) }; m
" M c: w- t" [0 h+ W2 W- char *dmabufsrc1 = NULL;
6 o1 p5 a* a) U( s' J" d2 t+ _ - char *dmabufsrc2 = NULL;1 x& w% v* a: J
- char *dmabufdest1 = NULL;. h9 a: j% c8 _: X/ u1 ~9 }
- char *dmabufdest2 = NULL;0 A* O8 N) w- r% y0 O
, U8 q. z( c) z- static int acnt = 512;/ i# k" t: Q( J7 M) J' F$ w
- static int bcnt = 8;4 u" u L1 b5 k, \" U7 ~ @
- static int ccnt = 8;% O8 J8 A1 S$ v2 T: l+ c0 R
: U8 v0 F; M i! g" k9 r- module_param(acnt, int, S_IRUGO);
6 n7 ?+ \' a8 j5 j - module_param(bcnt, int, S_IRUGO);
0 B4 H d3 u8 ? - module_param(ccnt, int, S_IRUGO);
复制代码 " F# C7 @" H, E% E+ {
* S q8 A0 V9 y4 Y: b- M0 M7 I& N% Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
i6 h# p4 ~1 v$ z. g) J6 J' H, Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, n$ x' ~- F) a4 a# q$ |; o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 J0 @. \/ n3 \- e9 r9 {6 f
I3 m5 j8 j' w1 k$ a3 i+ T8 w# S, B
|
|