|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: l) h3 L7 i A" ]- [code]EDMA sample test application6 R( h& y4 T4 {! W& }* W" O
- /*
* W; J1 L9 T# e" C - * edma_test.c) M4 j6 N, g7 K* E' [0 N. e2 O+ T
- *8 q9 i- K. c0 V. V( D4 m
- * brief EDMA3 Test Application/ D2 c E4 i; s. U1 z
- *
. V# P2 G: F+ n - * This file contains EDMA3 Test code.1 v$ [6 \7 p4 O. F
- *7 |1 M( S/ S9 n* r- J* K( X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE {8 t( G& R1 f4 d2 E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 y! D8 [. y+ h% r/ V0 H
- * TO CHANGE.
+ K7 C# e; t X2 D. y" k - *
5 |1 r; @ Y1 o+ b1 _7 M; s! }4 \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; U# l5 b: |9 X- B2 X - *2 T) q( {8 F% l1 a ]6 F( |
- * This program is free software; you can redistribute it and/or
: T& b/ y" s: D2 h8 z# I - * modify it under the terms of the GNU General Public License as
2 c$ `- m( o! l2 \; S3 P3 } - * published by the Free Software Foundation version 2.: }. R/ |/ \ h5 ?- Y `6 ]+ _: I
- *5 l# v! |# {4 v. z0 k0 S* g# `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 V% v, E$ J- ]0 p( Z: W - * kind, whether express or implied; without even the implied warranty$ \* G# J' E3 X, ^6 k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ }& P; v5 B- K- B$ f* R: E+ A
- * GNU General Public License for more details.
) Y% b) P6 K2 C - */
, p# | B$ e/ b
$ i' E; ^4 C9 i0 z2 }. J7 V. h3 B- #include <linux/module.h>% K s4 z1 n) q, a
- #include <linux/init.h>! N' J, y1 `5 `5 g+ }
- #include <linux/errno.h>
/ f* T9 w" U' X! U9 s- K - #include <linux/types.h>
8 L, g8 {* D. l$ \" H( F) J& ? - #include <linux/interrupt.h>
1 `5 f& q! |% w - #include <asm/io.h>) v' ]( M( v0 f- F3 A* g1 O" U6 |9 w
- #include <linux/moduleparam.h># s8 D ?4 D& O5 m$ D6 Z
- #include <linux/sysctl.h>
: M) {7 r! O( ?9 K - #include <linux/mm.h>. {$ p; H( g4 I+ i6 O" k
- #include <linux/dma-mapping.h>
& M. d8 z7 I% o% w5 v
- L1 f. [# A) ^5 v- #include <mach/memory.h>0 `& u8 S0 B' U7 a5 ^
- #include <mach/hardware.h>/ m) U! t* L2 O; ~/ t: v$ B
- #include <mach/irqs.h>! T" I! k( L8 E) M4 N
- #include <asm/hardware/edma.h>
# n8 [" [( }- z% Y Z - * ~- @" f+ b% Z) c
- #undef EDMA3_DEBUG4 u/ Y+ y5 T5 E$ H
- /*#define EDMA3_DEBUG*/
2 D w( ~8 P8 G# r
# I# W& ]; D: ]; f9 Y- #ifdef EDMA3_DEBUG
) O" u" s5 ]. i5 m* @9 x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 y0 b# H. o/ I; }% s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): z! _' U c5 l+ N) a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- f5 e$ N' F4 e. `
- #else
' b' ~# ]. P$ [( n8 u, _* Q - #define DMA_PRINTK( x... )5 o' x% X ^. {: s; L
- #define DMA_FN_IN
# D# t! R7 {8 E. `5 P - #define DMA_FN_OUT
" B1 l: T3 f+ D - #endif$ |( u V$ d: R
- - G" o0 w3 j" C e% Y7 N H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' n9 G# H- g1 E2 f/ b( a( s: z
- #define STATIC_SHIFT 3
! ^1 L! k" V6 A. H - #define TCINTEN_SHIFT 20. y0 q) D, S2 h+ ^, |
- #define ITCINTEN_SHIFT 21
, ?# W# l" w7 O - #define TCCHEN_SHIFT 22% m, R8 H9 T$ V8 P# l% t9 M
- #define ITCCHEN_SHIFT 236 @0 G g& G8 z; \% [ t
6 @( T: z6 j+ F' j( o6 r6 S" U- d- static volatile int irqraised1 = 0;* i2 s' o5 D" X5 }, i) g9 S% o# [
- static volatile int irqraised2 = 0;
4 l7 \" F0 B: \! o - ! w% j! f; Z$ g; i; N) J( [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 N) w3 _, J6 c& ^7 X9 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M* \+ y& Y$ f& t& ^/ M/ R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, R. V* y; Z# Q3 \
- - f9 Z( I6 |8 X
- dma_addr_t dmaphyssrc1 = 0;$ [, p, ^) ~% _' \: n
- dma_addr_t dmaphyssrc2 = 0;; q$ k# @ ~/ r$ y* U* _* T' m
- dma_addr_t dmaphysdest1 = 0;1 g c: e: O9 [( n/ t
- dma_addr_t dmaphysdest2 = 0;0 \+ B7 P1 _: p
- 1 g& L8 \ Z7 B1 z
- char *dmabufsrc1 = NULL;
) [4 E' [ R# e# X, a# M- l - char *dmabufsrc2 = NULL;
& b I3 Y& X6 i8 p( | - char *dmabufdest1 = NULL;. Z8 k1 H$ I% a1 M" ^& [" _
- char *dmabufdest2 = NULL;% y$ z2 t* X( U! L0 ]" N/ h) {
- $ X* j) Y8 \! y8 y1 g+ ^
- static int acnt = 512;$ c/ ~7 H2 x/ A; h* d# X
- static int bcnt = 8;$ x$ R/ U6 C3 {& e3 f
- static int ccnt = 8;
- J8 l5 w) w* I) E& s0 t - / E5 r* D0 }9 ]5 M( x( N8 g
- module_param(acnt, int, S_IRUGO);. R& @! b" c2 u- n0 N* ?6 l! b
- module_param(bcnt, int, S_IRUGO);
+ V D) [3 N, g4 u( z - module_param(ccnt, int, S_IRUGO);
复制代码
( [- z1 } x3 k# U" E, v. _9 ~8 f1 \& |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' `7 ~0 I0 W2 G* R$ x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 `% d5 m: k0 I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) L6 N- ` w, w Z
/ _5 g; f- j. a" z. G1 [; v# L$ h* a y& ^ L6 K* c8 Q
|
|