|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - \0 P F0 D( u2 s
- [code]EDMA sample test application
% J9 W! s$ ? F# \5 f - /*, i- k4 n$ s# q& a4 X& \3 h
- * edma_test.c0 B2 q9 e9 Z7 E0 U
- *1 S1 _) n7 j9 ]- X" ?
- * brief EDMA3 Test Application
4 `1 P+ e0 u# x5 v% d' X1 L b - *, \5 y- _7 L8 o4 U+ K4 B
- * This file contains EDMA3 Test code.* x; N3 y0 y$ M1 `8 G, x4 t7 \7 Z
- *
% N- Q0 A" m4 z4 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 L o1 o7 v* Q- w$ u0 x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 d8 N* t& b1 C8 S& H/ z
- * TO CHANGE.
2 B: ]" v" Y+ ?6 \3 W - *9 `' F& B8 I/ y8 U' J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& ^: V: p8 Y; K - */ Y0 C+ Y' h2 r/ {7 J ~: G, w
- * This program is free software; you can redistribute it and/or
7 i9 D5 m0 ~ i$ G' F - * modify it under the terms of the GNU General Public License as
0 `2 H2 o! n. D3 x& H+ Y. Y - * published by the Free Software Foundation version 2.
- B8 l6 \0 Y" y$ a& {* q - *
/ X9 j$ E7 F- C# L( T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! r+ q5 ?' {1 b7 w6 H - * kind, whether express or implied; without even the implied warranty5 `7 ?& t2 V' d2 k3 H8 B+ z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# [ t; Y' ?; K% ?' k - * GNU General Public License for more details.6 V- w- h+ J ? _* g# S
- */
9 s6 ?0 ], y: k7 O" n
! z( r- w# |2 f# X( ]- #include <linux/module.h>1 ]. [* C* Y; @6 `1 }( x
- #include <linux/init.h>
4 h0 r( }' V! \) M' |/ {& l - #include <linux/errno.h>
+ s( n% C: p1 |+ D: a# u' B, S - #include <linux/types.h>: o |% `. A3 L7 o
- #include <linux/interrupt.h>+ r* _ s w/ K8 W
- #include <asm/io.h>
3 {+ H1 b: K+ y* |" c1 U' c - #include <linux/moduleparam.h>& G0 o* o5 q# N* T7 e
- #include <linux/sysctl.h>6 ^6 V" u. t2 x) w% x
- #include <linux/mm.h>
5 p" j( G3 D) B8 h& _ - #include <linux/dma-mapping.h>2 B: v4 p; i) d) p4 ? @, l3 X
- + k9 v7 g5 D+ K" J' [
- #include <mach/memory.h>
' h+ Y# e* {# z) K - #include <mach/hardware.h>
1 |2 T! p' z( E# X3 n - #include <mach/irqs.h>' [7 y! }- ?# ]" o5 B; ?
- #include <asm/hardware/edma.h>6 a i3 u }# k# f, a+ S
- * e! c; L$ h# F( j! b
- #undef EDMA3_DEBUG( T# t) G! \9 ~3 ^& j
- /*#define EDMA3_DEBUG*/5 N( G. O. F4 ?7 Z r j
9 N( k) h1 d; @0 s6 @% G- P4 [$ l- #ifdef EDMA3_DEBUG# C3 q% b" g& z0 U; E- f1 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ Z6 s/ z3 d+ m w) ~( a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). s1 I- h P# F y" ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, n* T2 Q% t8 r6 X$ H1 h - #else$ l0 [6 Y! z7 K! ^+ J
- #define DMA_PRINTK( x... )
; G j% k' V2 u6 L3 L+ k - #define DMA_FN_IN5 W0 U) X# U/ \5 ~! @ y: \8 z
- #define DMA_FN_OUT
* |- s6 ?( [ ]" m - #endif
" b: U- u% y9 J1 [6 \7 D - ( f$ P& a9 B& d; X9 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 B) N0 b" o! \; q0 X* I - #define STATIC_SHIFT 3. B6 B5 I2 |% Q/ p% Q
- #define TCINTEN_SHIFT 20& O# x8 T8 `- V6 {
- #define ITCINTEN_SHIFT 21$ g, W4 L7 Y( A+ F2 c# h2 P5 Y' o
- #define TCCHEN_SHIFT 22& s1 C6 O* l! c5 Z6 K
- #define ITCCHEN_SHIFT 23
# U' ~9 ^, q! [! U3 ]! v - 8 r k \# d7 b4 q
- static volatile int irqraised1 = 0;1 w6 L, p! q, a/ S
- static volatile int irqraised2 = 0;* m! E8 v& u- T1 ^( T& n
- 5 e2 G/ O7 d4 ?7 K/ v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" a. X% U; D% S% k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 \# F, y! R, y) \9 x, W; A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' w2 L% s x( N) A) q4 | - $ j7 U$ v3 Y9 n
- dma_addr_t dmaphyssrc1 = 0;
" p: }1 | D2 O8 |& ^% { - dma_addr_t dmaphyssrc2 = 0;
' I& k& ]% `3 |' A9 Z3 Q - dma_addr_t dmaphysdest1 = 0;
6 f* a6 s7 s. E& j# Q - dma_addr_t dmaphysdest2 = 0;) p" X4 P8 }& B% }. y: h- e3 a4 \
- ! T4 `; T& q% @: z3 B$ o! M4 Y* R
- char *dmabufsrc1 = NULL;& s3 N! a* p+ d" y
- char *dmabufsrc2 = NULL;# b- g$ T& l# @ s4 |* J* C
- char *dmabufdest1 = NULL;
" P* D! ]& G b( u4 A5 i - char *dmabufdest2 = NULL;- D: C) _* E7 [& O* w
2 C2 P4 G/ L% D/ J- static int acnt = 512;( L5 R: V) \ ~' o
- static int bcnt = 8;, f. J4 H% y# r+ x" Y n
- static int ccnt = 8;8 [6 {( T/ q: l+ r5 G2 E' ?; B
- ( g; e$ a) J9 m' Q( _' A( B
- module_param(acnt, int, S_IRUGO);
! o$ J7 ?! o9 v9 Z. H. ^9 j - module_param(bcnt, int, S_IRUGO);
5 C9 p7 t4 V. G ~, O5 h - module_param(ccnt, int, S_IRUGO);
复制代码
* R. _7 }9 a' V, T/ i M v/ J8 f" Q6 L; @. M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ d2 F7 t0 o$ P' y& M- j2 _& marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 P3 q! o. h" X: E* d1 ?7 W) ~. B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 Q/ n \- N$ i7 J
& E8 K' M: U+ F8 l/ M X
# o& |* W0 w1 X. W; c
|
|