|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! b) F0 U; f3 q' [" ?7 j- J- [code]EDMA sample test application
* f+ D2 k( C$ u6 U/ W - /*
; V- w4 d8 r7 b1 d3 e - * edma_test.c( J* ?/ L, Z: ]% }
- *
- o1 s5 e6 j' E4 G, a - * brief EDMA3 Test Application
1 k, F8 A W: Z6 C5 C" k) } - *- ~% s6 `9 t1 {6 G/ X& A
- * This file contains EDMA3 Test code.
% w* y$ i" O9 A - *
' v( M' H6 a5 x& F9 G. ?9 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
V4 a4 r. ^3 s. z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 ]+ `* R, Z- O; P' y5 g - * TO CHANGE.0 J2 P$ M F: _0 r0 b
- *
9 F v2 z% X: N' N+ C w5 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 f6 x' h5 c- B5 {& `' M3 d1 r9 ?- K - *8 I3 {5 T6 q- {3 k3 p
- * This program is free software; you can redistribute it and/or
( l: ~- S1 i6 T: Y) m - * modify it under the terms of the GNU General Public License as* d1 @9 _) B; N/ X( B
- * published by the Free Software Foundation version 2.
1 n$ a' I3 g+ |- _8 ~8 p1 \/ V: T - *3 f" W9 ~4 B$ J9 X% @$ c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ F- N- s; w- ?! R$ k - * kind, whether express or implied; without even the implied warranty& p! U* y' a. K2 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 H, r7 T9 M2 y- H; z) a3 m
- * GNU General Public License for more details.
' n3 b$ L& i4 H( e: [$ p" p - */
" t7 G" ?& z+ y" f+ T
* y4 C& `" W% r- t+ V5 w, y1 k7 X V- #include <linux/module.h>
2 q9 Z, P2 ^& C, N9 e! O$ W4 h - #include <linux/init.h> x4 v5 i! j8 `1 W6 P- Z
- #include <linux/errno.h>
7 V5 k t% H4 G" R( e' @ - #include <linux/types.h>
) C8 s3 L. o! X0 f' Q& \4 @ - #include <linux/interrupt.h>
( l* |! o& K ]. f) T+ R. B - #include <asm/io.h>. K5 r6 Z, g' u/ s2 [
- #include <linux/moduleparam.h>
. b! N) E l* K - #include <linux/sysctl.h>
+ G6 }4 t! |5 q' w* p+ B! J; H - #include <linux/mm.h>6 A& k c2 p" Y
- #include <linux/dma-mapping.h>
9 w/ W9 c5 _: o- |# T# R- B7 u1 w
9 W) b- H0 e A- x2 K# M" I! h' o- #include <mach/memory.h>
% T- x) _& S4 w3 J2 a - #include <mach/hardware.h>& Q( C. z9 a5 i T- G# t. F% F
- #include <mach/irqs.h>
$ ^4 H; M$ C; X6 c! q( H - #include <asm/hardware/edma.h>( D4 f+ H% p4 x+ }9 Y
. a. q# C" ]8 a$ d- #undef EDMA3_DEBUG( ^( _% B: D Y9 K( `. H* B
- /*#define EDMA3_DEBUG*/
' w. @, y0 {* |
8 I) x- r9 E. F, @. _- #ifdef EDMA3_DEBUG! D7 R/ Y! \1 y# r9 D: J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ V3 n# o3 M' v: ?1 k$ Q) l. W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' G4 j+ N l5 O, X3 d) n% l" T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ l( H, f5 |. m- a5 X% @: A
- #else
; q& K6 X6 S( t - #define DMA_PRINTK( x... )
$ d5 N( @' h* T$ P6 Q - #define DMA_FN_IN& G' x7 @. R3 `7 N s
- #define DMA_FN_OUT N1 F, ]) M2 u
- #endif
$ k+ L- R/ b- d# l$ I3 @ m' w4 ~ - % J7 n7 [% z, K/ P% S8 \: K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, @3 h" d" C g( G/ Y. g/ z& x, D - #define STATIC_SHIFT 3
2 f2 D/ ?0 J% T8 k8 v' [' ^( D( E) N - #define TCINTEN_SHIFT 20" p; z+ X( N; o
- #define ITCINTEN_SHIFT 21
5 d! }) Z- e7 s' O$ C J9 r - #define TCCHEN_SHIFT 225 K- T; J5 I2 s
- #define ITCCHEN_SHIFT 238 t$ v* q% q) F& t
- 8 v- T! a( L; d
- static volatile int irqraised1 = 0;4 g0 z5 [7 L+ g0 W; E, |, z" {' c# J
- static volatile int irqraised2 = 0;
( X3 l! h' ]0 M; b7 E# f% m - ) H% T& j0 S( N+ q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Y3 o+ ?7 z% b1 P6 z+ ]* v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 }7 ^- y; ^. l! `7 ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% i; _1 o2 W) R- T
9 \5 [8 v/ Z% v9 B- dma_addr_t dmaphyssrc1 = 0;
5 B H7 o: n4 w - dma_addr_t dmaphyssrc2 = 0;. M( r8 M) s. \
- dma_addr_t dmaphysdest1 = 0;
. ]6 |# @8 l' }, l - dma_addr_t dmaphysdest2 = 0;
! { `$ V, m+ ?3 N, }$ G% d! d - 0 V$ w) l" r s& s; ^
- char *dmabufsrc1 = NULL;
6 } X& ^" d2 x; T - char *dmabufsrc2 = NULL; ]5 G8 h: O; J$ F0 C8 z) K
- char *dmabufdest1 = NULL;8 `3 q @4 O/ D( e6 [
- char *dmabufdest2 = NULL;
$ A6 a' ]4 V, _1 k6 \& k, @/ Q - , R9 \- a, @" E) [$ [6 b
- static int acnt = 512;
9 @4 ^+ |6 D+ z4 V- U - static int bcnt = 8;
+ H. o) Y2 {/ @# \$ u2 a - static int ccnt = 8;
2 e7 T. I; l. D4 h! T q
' O5 u2 U6 I1 t" M- module_param(acnt, int, S_IRUGO);
) l/ d9 k X1 h3 N: n - module_param(bcnt, int, S_IRUGO);9 d6 o$ f( E, M' Q2 A) h& C
- module_param(ccnt, int, S_IRUGO);
复制代码
- E6 `, H7 x7 y$ S9 w" j
8 X) F! \; h3 ]$ P2 _# C# A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% P5 s4 c1 [. F4 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 [. {! D2 G E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 j4 J( j ]8 i. |" U4 k; ^; }& Z) A
+ u3 `; l: G8 O( r2 i
|
|