|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 }# o' a1 K/ R$ H( s- [code]EDMA sample test application6 ? O- k8 I1 M: `
- /*
j/ S( V& u- I& ]4 p - * edma_test.c5 @$ u" ?% p: x# k& A0 R) I6 u
- *
/ e3 F( h( F) b2 l# o - * brief EDMA3 Test Application$ u5 O1 b# V3 D/ [
- *
. n8 x6 V3 o9 k# f0 v- e - * This file contains EDMA3 Test code.5 [, L5 Q% K- k$ M O/ k$ Q# w
- *- w0 |( U- k, Y) T( _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" n" |; L/ y0 S1 l7 b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 n% z9 ]6 J, Z - * TO CHANGE.+ [8 ]) y! x" H% V1 c/ N& I7 n+ q7 F
- */ n- x% Y1 V7 D0 x1 `2 k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; s* b, s$ G1 J1 D
- *$ Q. ^4 M! v) ~( m- ^* W! K
- * This program is free software; you can redistribute it and/or8 x, g x* Z+ }1 F3 [1 B3 S6 f6 d/ p2 e
- * modify it under the terms of the GNU General Public License as% Y' F! Z* F8 ^+ u4 v4 `
- * published by the Free Software Foundation version 2.% a6 ?& u r) Y4 ?' q) @
- *7 ^+ H% D2 }, m$ z1 w' e# y9 @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 j; t# V6 ]. j* F/ Q2 ] - * kind, whether express or implied; without even the implied warranty+ P4 C" C7 z3 } b- m, l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 @4 k7 S- |# @: {* c - * GNU General Public License for more details.$ _5 b( t+ Y5 D2 m) S$ u P
- */- r# O/ I; N/ n1 o" y8 \
8 H1 b. M! _! n- #include <linux/module.h>
# b! N* [5 y4 p O& N" u% n - #include <linux/init.h> P7 W8 S, e3 i( c. O
- #include <linux/errno.h>& R' {) h+ \ w4 }" ^
- #include <linux/types.h>5 B% P; S& I j# Q" ]
- #include <linux/interrupt.h>8 f, j& U1 A: R# h
- #include <asm/io.h>
. y$ f& l: L1 f6 w S) F/ h - #include <linux/moduleparam.h>
, s" x7 m3 {3 K2 p* r6 m - #include <linux/sysctl.h>
4 Q: h" Q+ }+ O6 t' F @2 M, ?# n- P - #include <linux/mm.h>
5 m( F0 z% n/ V5 u; ~# m" s - #include <linux/dma-mapping.h>
. J0 k& a, X" F* W3 q+ u) B+ }9 g - # n3 i! m3 I* g1 W4 \2 c- v
- #include <mach/memory.h>2 j9 c+ i" Q) }" ?0 m
- #include <mach/hardware.h>
" g0 g8 \' y) E+ k s2 f - #include <mach/irqs.h>! i) Y( ^ f B) V1 N& \
- #include <asm/hardware/edma.h>
. f) u4 s3 c l: @7 Q3 G( ?& l& ^) I; ? - - S! p' W6 g2 `7 t; l
- #undef EDMA3_DEBUG
( _6 l7 D; z; z* K( [ - /*#define EDMA3_DEBUG*/
. d- @* F* F7 ~' W7 S - * w& t3 S0 o. \. h' i
- #ifdef EDMA3_DEBUG9 F1 @3 P, u, {+ c' I; B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 @& w# k, s' }& G2 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( s9 ~& C$ {6 I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; o, N0 b! ^) ]9 @* e) s6 H - #else+ B/ w0 Q" m4 n/ D: w, D% @: q
- #define DMA_PRINTK( x... ): m( \) o$ B! ~4 i. T
- #define DMA_FN_IN
3 v% g, f* x7 e2 x - #define DMA_FN_OUT1 G/ m! w1 l C) a8 F' T2 ?! s
- #endif
, V/ I! u" j/ p* \% R7 ~( Z o/ ?! g - & P, r) e `6 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! _4 ~6 Y& V& v) }& g
- #define STATIC_SHIFT 3! g; C# V* b1 w V1 Q" p
- #define TCINTEN_SHIFT 20
* ?% _; g. d8 D* D$ S! r7 H - #define ITCINTEN_SHIFT 21
, F# Y* O- {* \ - #define TCCHEN_SHIFT 22
' c5 q" n6 e ]( \ - #define ITCCHEN_SHIFT 23
4 }; J+ @8 Z4 S1 ]0 X
; _3 A5 V; l5 J i9 ?: Z- static volatile int irqraised1 = 0;' w) _4 c$ a! a, C
- static volatile int irqraised2 = 0;
: R' D$ y8 \7 f+ B, x" T - 3 d; E& H: {% L* {7 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' S# y3 ?. n5 n; s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Z4 {! Y" ^/ v! U4 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 h' F. {0 X1 v# B1 P
5 O. L% D+ i1 p: l' Q- dma_addr_t dmaphyssrc1 = 0;/ [* t, B8 J0 J! W: K8 F% c
- dma_addr_t dmaphyssrc2 = 0;
4 l9 o) o+ i' Z$ |- E' E; g& ^ - dma_addr_t dmaphysdest1 = 0;
" ?4 }7 P$ m3 h* L7 ` - dma_addr_t dmaphysdest2 = 0;/ y* O2 W7 N3 I, ]2 B- d3 L
. V) L4 N. K6 i4 Q' s/ W6 H- char *dmabufsrc1 = NULL;
/ K8 F7 v6 l' G( w - char *dmabufsrc2 = NULL;) G2 B8 C- b* @/ A
- char *dmabufdest1 = NULL;0 s4 j: T3 I+ n
- char *dmabufdest2 = NULL;+ J d. {( I& _# q
- . P$ n6 j' \; ]( |4 E9 O
- static int acnt = 512;5 v# N$ R: }2 T/ F2 J6 z
- static int bcnt = 8; |: i! m- I1 e
- static int ccnt = 8;
& R2 y, H( v* T' u/ Z P+ P& V - : c- }+ ?+ }3 |8 _: U: e, B
- module_param(acnt, int, S_IRUGO);
# O! S' g5 o# ^6 X5 Y% L; ~6 T3 G - module_param(bcnt, int, S_IRUGO);5 B3 k! a6 ]2 A7 ]
- module_param(ccnt, int, S_IRUGO);
复制代码 : s9 F; b0 I6 k( P/ Z/ i& J
+ n5 K1 ^1 M% [8 |. i9 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* B# s ?1 d9 |2 |9 Y( C: g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ W4 s$ e `. K/ o! F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ w0 G! V6 a }5 a* s
# D# ~' [5 z0 S0 N0 G p5 @, q
* l& g' ^% h% l! G- J |
|