|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z, V. }" s; j, S9 z( l, ?5 m% `
- [code]EDMA sample test application: N6 x$ q. U! E9 e1 }: B8 K
- /*8 Z: x' R- g5 L7 m; \. q) u/ |: F
- * edma_test.c2 m, t: {3 M! l2 U. u
- *, y- G% N7 E9 t$ E
- * brief EDMA3 Test Application
* a: `& B$ |# R) ~5 D& `, y4 P - *
4 m" X5 x3 l3 f - * This file contains EDMA3 Test code.& \9 _8 [! ]: [% ]. o* A3 P* N
- *; l" m1 ?4 n0 _) J5 v% ]0 S R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* D2 |2 M, i9 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& |; h# m) E z- f: Z; _ - * TO CHANGE./ ]2 w, t4 B! u) ~4 x1 w
- *4 d0 v. _/ y1 ^ t: Z6 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 f4 |) D" v- B+ w* X1 T8 N
- *3 _4 U4 z+ F! r) z( S
- * This program is free software; you can redistribute it and/or
2 J0 F, {; @2 M- h - * modify it under the terms of the GNU General Public License as& ^8 t7 J* V* Z+ ?7 E- d; C3 P
- * published by the Free Software Foundation version 2.
! f8 g4 J1 E& i" L4 |4 k - *- Q# d& J- e! J& W7 T# J4 S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 w' v- p, t1 k0 t- e! t, d - * kind, whether express or implied; without even the implied warranty
# B& c6 R* r) o" Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ G( t. X. a1 s8 C2 U
- * GNU General Public License for more details.3 d6 y$ _( ~3 E7 v
- */
5 A. Q% S- v! R: N! K - ( B4 t7 m; a- O3 U) P/ A6 U
- #include <linux/module.h>
1 q# i% v$ y" s3 ^ - #include <linux/init.h>
' c7 I( t3 N3 ? - #include <linux/errno.h>+ C$ `$ _7 N# e/ Y; e
- #include <linux/types.h>
$ ~3 V! \& ~7 d( B% ^# s. g - #include <linux/interrupt.h>
0 } c) `" h \/ G! k - #include <asm/io.h>
: n5 A' e- `* H1 x& Z K1 | - #include <linux/moduleparam.h>' _. m2 l2 ]8 a9 p' h4 d" l
- #include <linux/sysctl.h>
8 J, D3 q( E. l4 B' L6 x - #include <linux/mm.h>
; {2 t. T2 ~. R& M0 A) S - #include <linux/dma-mapping.h>
' U( x6 B1 g9 e1 D- U6 c' ` - - P( ]( J# P0 \
- #include <mach/memory.h>
) V$ M6 X3 s+ \6 p Z - #include <mach/hardware.h>, g( q- y) E* X0 X( c; j, z! T
- #include <mach/irqs.h>
- D5 w8 f3 R* r, o, p - #include <asm/hardware/edma.h>8 @! ^: N [ B7 n9 g- m
- 3 X, g! }4 D) P+ l
- #undef EDMA3_DEBUG
" O2 e9 g- {5 `& b3 r/ h. p( c - /*#define EDMA3_DEBUG*/9 \+ a* F; p% p
: _; p8 B2 A; ]2 J2 ^) i- #ifdef EDMA3_DEBUG
7 l x4 M* T+ d; [$ S @; [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 G, P) r. b5 F1 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 C# e( Q E0 z! y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 B( N' L! d: C" O) q" V* J
- #else7 t9 y% X$ e& N. i! k7 T3 ~% ? `' M
- #define DMA_PRINTK( x... )" z6 Z6 P) y9 o. N& u& l
- #define DMA_FN_IN
' S$ R! q) ]& O0 q V9 c: J - #define DMA_FN_OUT
9 {* R( d1 h/ W& T% @% x - #endif6 J3 n O1 W8 x! V: r* T: y/ b& E
$ ]2 a/ {/ r0 \; e- #define MAX_DMA_TRANSFER_IN_BYTES (32768): y* L) [7 }9 L4 f, c! i% s
- #define STATIC_SHIFT 3
' @0 u6 [2 w. Y* E - #define TCINTEN_SHIFT 20% ~+ B. L% e, C( k& h
- #define ITCINTEN_SHIFT 21
) _( V6 p4 r! H& q - #define TCCHEN_SHIFT 22) u* G$ C' D# u2 f9 |
- #define ITCCHEN_SHIFT 23
x+ T! x4 {: B4 Q# P7 J - / d) X4 i5 g0 B3 f+ k A. B
- static volatile int irqraised1 = 0;) A# t$ ?2 s- l' W7 g
- static volatile int irqraised2 = 0;' b A A8 j6 m3 V- j" F) x
( ]$ n7 h! ` m; e+ _+ P I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 z+ m: `+ w( \. W0 g* P/ {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: d& F9 T3 K6 V. S% t5 y. [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 G1 x8 V2 l, s7 b/ [- d - ) B; @+ r( D- Q4 N: j2 |: }
- dma_addr_t dmaphyssrc1 = 0;7 p% e) _+ t' F1 y# ]: }7 z
- dma_addr_t dmaphyssrc2 = 0;
& |! q7 k8 z0 X3 ]2 f - dma_addr_t dmaphysdest1 = 0;
( j$ b; X0 a1 h7 A$ g - dma_addr_t dmaphysdest2 = 0;" y8 b- t( A% H# L- h
- 8 c/ C2 I+ M$ T6 }
- char *dmabufsrc1 = NULL;+ \1 i( }* p& x3 W& l' l ~: y, j! w
- char *dmabufsrc2 = NULL;6 W: p* V& }( L
- char *dmabufdest1 = NULL; b' I3 \! z8 K9 q9 Y E: S
- char *dmabufdest2 = NULL;# d5 K7 \# E+ u# j( j" G
3 B. f) p& ?0 c8 b9 z! o0 n% T# C- x- static int acnt = 512;0 Y5 T E- l# K' w! U% Z
- static int bcnt = 8;
( y/ g% j- A6 V6 M9 ]8 X - static int ccnt = 8;, B% w; [% b7 n/ ]. c7 B
) J) k3 s8 w4 D* w9 e9 d* B- module_param(acnt, int, S_IRUGO);" @% R8 v9 [- v, ]
- module_param(bcnt, int, S_IRUGO);
* J. U$ O5 I8 U! A A- X$ | - module_param(ccnt, int, S_IRUGO);
复制代码 5 B$ P( z+ ^* n& Y/ @
# k8 B: I! p7 p1 U9 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ n6 R6 R- N3 p' }; r& }2 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& V+ o: u5 |2 V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 K5 V1 m8 y/ h$ w- j% x* x5 ^) Q# z
. |7 u) w# q( Z5 Y/ z1 N, I: z
7 R, i: j0 N" g% ]2 Y |
|