|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 u) N% S3 |2 C# ^' }
- [code]EDMA sample test application) Z5 A" ~- e" m- m
- /*
# x [7 ?* I9 d u - * edma_test.c. B6 [ D8 d8 i8 @8 \" d0 j; M" k/ `
- *# ^' Z' C' a: |" o6 J/ u
- * brief EDMA3 Test Application
* S9 u8 t1 q* o6 y& ]: e; h - *6 ~* Y- D' ^, \! p- Q
- * This file contains EDMA3 Test code.7 O8 l6 P6 A0 G, O) L1 Y6 v
- *
, s- c: N/ O3 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 I( b8 d7 T5 D& R. b# s$ ]: f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ }0 u/ s! E+ T2 N4 h
- * TO CHANGE.8 _. S8 a; W8 \. V7 I5 O
- *
+ T! K: S8 c" A( N, l! b( N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 r2 C6 q1 s% \' D# `5 Y' X0 y( U
- *1 e0 m/ m1 X/ h8 r) j: A" D
- * This program is free software; you can redistribute it and/or
f4 W+ Y I" |" N - * modify it under the terms of the GNU General Public License as* L& W' C1 f7 k' _
- * published by the Free Software Foundation version 2.' c. E6 Y4 N9 N" @
- *6 F% K9 ~1 _' X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- W8 [" X, X; j+ ]
- * kind, whether express or implied; without even the implied warranty: L% X' M" K4 `5 |0 V* f9 X' a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 D, J- n3 x! p; b$ w0 _
- * GNU General Public License for more details.5 R$ }, t; y8 O# i L
- */! b0 n+ m% [# r4 i- F B
0 B9 _; ^% ]: L- #include <linux/module.h>
& R) ?. Z+ {/ y2 a - #include <linux/init.h>( p0 a1 q. B3 z9 H: h4 Q
- #include <linux/errno.h>
. H/ h. w( ?5 \8 q' I - #include <linux/types.h>
% P* B/ c' f4 E3 f" m% _7 ]/ s - #include <linux/interrupt.h>
- L3 K# A" D! I0 P7 p! D/ b - #include <asm/io.h>
- e5 S8 V/ J5 R# H/ B# k' X - #include <linux/moduleparam.h>
! [, {- ]# f! y4 Y7 o - #include <linux/sysctl.h>
6 T7 \3 ~ | } - #include <linux/mm.h>. i* P+ C( ]. a% B
- #include <linux/dma-mapping.h>
* q( K1 R3 w* H: H1 K$ P& M
0 S# G$ |& k A- #include <mach/memory.h>
( N9 b1 O2 W0 ^+ c. m - #include <mach/hardware.h>
. s8 R: V% _1 O7 t9 O6 x3 ~ - #include <mach/irqs.h>
1 a+ s1 k! t" K; a& @ - #include <asm/hardware/edma.h>
. H" o8 M; t# d' g6 Y - * o. D6 Y6 \0 j' F0 p8 s+ Q* n
- #undef EDMA3_DEBUG
: O# s9 i: d6 w0 w - /*#define EDMA3_DEBUG*/
5 T9 J/ _$ r5 U, ^. d - 4 R5 T. f% J' Y( I3 |5 w
- #ifdef EDMA3_DEBUG
. C9 e$ X& u0 \! ?) A \( A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( k! F7 o1 O/ v) i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 `7 o6 L9 w7 x: \5 _1 j% {8 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& R3 ^) H1 I, ?
- #else2 s0 h. a' S5 l5 g* Y1 X
- #define DMA_PRINTK( x... )
/ |7 m; ?' u# q. Z/ H5 @- R - #define DMA_FN_IN
( d1 L; q( ]5 l$ ` - #define DMA_FN_OUT* T; a: W! N5 ~
- #endif# w" V( @7 X/ M$ ]
- 0 s/ O5 O+ O) A3 a P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, _! l6 r% ]6 K7 H. g& Y - #define STATIC_SHIFT 35 \ X4 y: F( e& x
- #define TCINTEN_SHIFT 20
; g5 Q- q, E! k' t9 S% Q1 K - #define ITCINTEN_SHIFT 21- G; I" a6 k2 o, b
- #define TCCHEN_SHIFT 22
, f9 i! a6 D$ r! D - #define ITCCHEN_SHIFT 23/ `/ y" ~5 P# p! ~( u% X3 U: L/ T
& m! y5 E* `" G* e# K9 \- static volatile int irqraised1 = 0;7 Y! d" V4 y6 c8 ~, h8 x1 U9 h0 a! r
- static volatile int irqraised2 = 0;
3 D. q) T3 J1 m6 y: ?. q3 O1 v - 6 A" D3 `0 W' v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ^5 [9 \1 W) t# k7 A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; P2 p2 K, i9 G7 o3 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \8 D$ w8 ?4 j' \
5 V9 }9 y! o' p/ }0 R ~( K- dma_addr_t dmaphyssrc1 = 0;. p S, @: j6 O) T/ _
- dma_addr_t dmaphyssrc2 = 0;
: ?! l" Y. k. H: R! r9 A+ ^ - dma_addr_t dmaphysdest1 = 0;
) C& A' x, `3 \- _ - dma_addr_t dmaphysdest2 = 0;% m& R3 L9 B% K2 N6 m
- 6 a$ `. M0 f4 x, d6 `
- char *dmabufsrc1 = NULL;2 z( y3 _ n& n+ g+ a1 ~
- char *dmabufsrc2 = NULL;5 L1 ?, I/ [4 [1 @
- char *dmabufdest1 = NULL;
0 w) I1 G1 h4 m& c4 R1 c - char *dmabufdest2 = NULL;
0 i+ k- o; t a! V
" T6 P" G* t$ s" [$ t. W, A- static int acnt = 512;
, f( L: H% j+ X- K - static int bcnt = 8;
; u A+ s& s; g - static int ccnt = 8;
' \+ g `0 x$ e0 l2 U; [7 _# E, Y
1 U6 [* @, g& g& r* W- module_param(acnt, int, S_IRUGO);
# h+ S; V1 V9 @* w$ s- B/ F - module_param(bcnt, int, S_IRUGO);( g `6 L0 Y+ m2 X
- module_param(ccnt, int, S_IRUGO);
复制代码
2 Z3 r4 g' N: u& K2 N# O
( L7 `+ S* U# }$ Y6 `1 n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 A' M- h! d0 D6 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% ?/ F+ C- z: B# G& }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& i8 P- G& v) Y* t' n
" h# z4 R0 W+ K8 G! o9 \0 i) |- v5 Y! H
|
|