|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 w" g- _% W& k, D2 Z, _
- [code]EDMA sample test application
+ t. P4 N& }% v7 @6 M3 [& ^ - /*
# @, p) ]/ y- t0 f; Z" D# k( L1 K - * edma_test.c
/ y! B% B% ], ^; W- v/ L# d2 i( L" I4 e - *1 M# o" d- { G; f' h- W3 j
- * brief EDMA3 Test Application
' e. Y* j/ E Y8 D - *
. F# o& j( ]1 D2 P* ~ - * This file contains EDMA3 Test code.
8 {2 N$ Q8 A; [/ `! }2 F/ r' n) `4 z - *
/ h) y7 z! F/ ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) b9 z! U1 q6 `* `% _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' f0 t8 Q9 w: {% M
- * TO CHANGE.
5 S3 u, n# R+ M- M4 {3 V - *% z; p6 A; B. y6 V3 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" q! N z w! A( `$ e y3 G& |) ?
- * u7 G/ O$ l) m& w2 p* G) P
- * This program is free software; you can redistribute it and/or" G3 m( f) N X2 K8 z2 j
- * modify it under the terms of the GNU General Public License as
* l1 ]' c: ~& j, f1 O7 c( R - * published by the Free Software Foundation version 2.
$ A! E6 ]: K" h - *8 |% A. r3 e( n0 } @% C( E* v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 _4 W- P: W. A+ f: `/ w' y
- * kind, whether express or implied; without even the implied warranty
: w0 t" y0 n/ y) m7 { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ m5 x$ I$ o) k
- * GNU General Public License for more details.
8 V5 s |! D. z* y, q( \+ c - */
7 e. |/ e1 G+ A' {
1 H# [ x- v( l" {- #include <linux/module.h>2 w/ ?. i6 b% i% A, T6 d8 d! \
- #include <linux/init.h>9 b b1 ~6 ~9 e
- #include <linux/errno.h>+ R* P( r1 g6 B9 B
- #include <linux/types.h>
. R4 o' W% H( d" |" N& M - #include <linux/interrupt.h>
! T. U) h ? a; H7 v; k! t - #include <asm/io.h>
) r5 `0 B+ _7 }0 U2 |( ?; m& X - #include <linux/moduleparam.h>
- _$ a& z2 _2 g* m0 u" W0 S9 {5 \( M - #include <linux/sysctl.h>
- F9 ~- D; }6 c( O; Z' t8 e - #include <linux/mm.h>* s Q, u _3 E; O- e0 h0 D( j, q% I
- #include <linux/dma-mapping.h>
, G/ g7 j, T5 R! }8 h* I - # x* Y9 R: X5 c$ ~- Y
- #include <mach/memory.h>: E8 J$ g; i* a3 c7 u9 e! O
- #include <mach/hardware.h>
3 c. T9 P, [7 N( P - #include <mach/irqs.h>
2 L$ o: `+ Q: e - #include <asm/hardware/edma.h>
6 y. z `, y, t* p) }2 W8 d
& A& H; ~+ ~% ?7 _7 W- #undef EDMA3_DEBUG
& P2 ^: L8 M+ D/ k) b# \ - /*#define EDMA3_DEBUG*/. K' R8 R; Q1 E- t
- " m# ~$ w+ t: y7 Z4 N
- #ifdef EDMA3_DEBUG# m0 D" d& l. b" y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& S' b+ d& i7 z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# n7 \4 [. a. A2 j- t; {( S5 |* J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 C0 N5 ^2 q# q- o0 q9 [ - #else
% I: M& ~: S" r9 o - #define DMA_PRINTK( x... ): t8 U% |# T; q7 `
- #define DMA_FN_IN
' J& n& [1 a" t6 H - #define DMA_FN_OUT2 A* ^) J! L2 L
- #endif) o- W" g0 [" |" J5 u m
- ' D9 ^: `; _$ Z |) c V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- e3 E# @% S, D }- \1 x/ C
- #define STATIC_SHIFT 3' J+ ?* O) p: V( i) P; L9 A T9 A
- #define TCINTEN_SHIFT 20$ w1 s6 K; Y! U4 C
- #define ITCINTEN_SHIFT 21& ]0 z3 ^- ~, c/ r' b7 C
- #define TCCHEN_SHIFT 22
2 G9 O! C+ _& R. j* E - #define ITCCHEN_SHIFT 23* V. v2 Q) ]: o6 Z' A% z. A
- * L* K5 n4 G/ D% C
- static volatile int irqraised1 = 0;
* X% M4 d% U+ U2 G - static volatile int irqraised2 = 0;
7 T8 o* T( ^/ r' g% s9 ~
' N) \7 q/ r, j- K/ f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: h, \' X3 o/ D4 C+ }4 m( l7 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& z7 y" y u2 }8 m# [' s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t1 B. B3 r1 b" t4 N! D
- % Z1 q) z/ H/ a. P5 G# R0 k
- dma_addr_t dmaphyssrc1 = 0;6 ^2 b1 p8 W# z/ b
- dma_addr_t dmaphyssrc2 = 0;
* I" C4 {: u) ~ O/ O" n$ b - dma_addr_t dmaphysdest1 = 0;% [7 g( X* V3 q M- F* c* J5 o/ O
- dma_addr_t dmaphysdest2 = 0;
A# ?% j M) I) ~! o. i' G1 y6 }
( `4 ^+ M% G; m$ S$ s- char *dmabufsrc1 = NULL;% \. _* C3 X* U" x8 S% m, z9 ~7 H
- char *dmabufsrc2 = NULL;3 m$ w7 a# ]% {1 w& P h6 k
- char *dmabufdest1 = NULL;
) n9 r7 m9 z; Q2 `* f7 J- R5 b* I! ` - char *dmabufdest2 = NULL;8 `# i+ I( m) c. E6 ^
- # x( p8 B$ E! A: T A
- static int acnt = 512;
+ S! b$ R: B+ S3 V - static int bcnt = 8;
! p) b q5 z- o( a# h/ L/ U - static int ccnt = 8;( I* k0 m1 z4 V+ T$ `$ O4 t) J
- 4 z* g1 Y; }- M4 g* n5 A$ ^) _$ l
- module_param(acnt, int, S_IRUGO);( @+ I& @% H# a% P: y( X/ m9 t
- module_param(bcnt, int, S_IRUGO);" K7 B# f& u/ s0 ], ^5 _
- module_param(ccnt, int, S_IRUGO);
复制代码 4 O( K/ v7 d% ^ o
" i& ]( v, u, L* Y5 q' o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( W, l/ @3 u7 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* J; B% _* k, E# i) C/ G: O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 x; k2 S) y" n( B
- u4 ] \, X, v/ k" \# F% C6 i$ k# W" i* ~" y
|
|