|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' A, k! \/ L( G/ M- [code]EDMA sample test application
5 S! D* d6 I( Y( L - /*
$ z. l$ ]8 M7 }4 x2 H) n3 { - * edma_test.c
2 ]) U2 E1 `; f. l9 N0 ~2 T7 B7 d - *2 q6 \/ g( l" [+ _2 g5 D* U) @& Y. L
- * brief EDMA3 Test Application
' ~5 g4 _+ z5 q - *: {8 _* i9 ]8 C% C
- * This file contains EDMA3 Test code.
5 C T; T1 y' |* ^ - * }2 J9 W8 h: [' A, S- l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 b# h) X2 j2 G7 g, q) j* A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" C/ }' ? x4 e: w, q - * TO CHANGE.
$ y* w: r" C) F6 h/ G5 F- [' |) ? - *
% W! e$ w0 [8 }; L- l4 q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: L# [1 }0 d7 |' O# e* k6 c( w - *
8 U. z) o4 O6 k& w/ F - * This program is free software; you can redistribute it and/or& {/ T; d& S) [) z2 e* V
- * modify it under the terms of the GNU General Public License as/ ], k! s% I5 c
- * published by the Free Software Foundation version 2.
5 ?9 Z" P) \0 \, O) s9 e" W2 { D3 v - */ y, C6 U3 T6 U. d6 @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 F3 d6 d% r3 K E) {+ z - * kind, whether express or implied; without even the implied warranty% O# ^5 P; O. V, d0 x: p! t o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ~& |5 `) E" j& B - * GNU General Public License for more details.
6 n8 b9 u9 Y' A. A. W - */3 B, a4 {, g) p5 ]" O" b) C% Z
- 2 W0 p( k7 b- ?; y5 L6 A# p+ Z7 Z
- #include <linux/module.h>% ?! l: P# e5 e$ u% A0 J0 K
- #include <linux/init.h>4 s# H! S& ^, b2 Z. Y' Q/ V
- #include <linux/errno.h>0 b' \4 l3 H8 S' U
- #include <linux/types.h>
9 J1 n q- J- K7 J& i6 V - #include <linux/interrupt.h>
( z2 \5 j, L- u" z5 d - #include <asm/io.h>, p: f+ K+ ~3 }
- #include <linux/moduleparam.h>
; O$ x I4 u- ?6 S. ?" e - #include <linux/sysctl.h>$ b% m: L; M* {. z, `
- #include <linux/mm.h>
$ J) v" v* F1 j- `% @9 b6 t - #include <linux/dma-mapping.h>
( e$ U$ o: X7 f
& ^4 w: v: ]5 M4 [- #include <mach/memory.h>
~# V+ q; N4 @/ p8 |6 j- G7 z - #include <mach/hardware.h>
2 D% V) p6 v! A& U( Z$ R1 y - #include <mach/irqs.h>
6 n$ M+ b1 d4 D# ?; B3 n; f+ G1 D( W - #include <asm/hardware/edma.h>
4 B$ p9 {+ s! h4 O5 z2 V, E. A
- J* Z5 n8 [; H- #undef EDMA3_DEBUG
# N' l7 t9 X0 ?- a& z' v/ C - /*#define EDMA3_DEBUG*/- `( m& \: n8 x) }! r' R8 C
6 W" @2 }3 f5 q9 S$ E1 v- #ifdef EDMA3_DEBUG3 a9 ]0 x$ M0 J. o u" g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) W$ E( i4 H, C" U& t3 w7 D( f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 [$ @) `- X% v4 D' ]5 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
I& \; ?9 P# G. k$ N - #else9 f. ?; v9 k: _6 v5 m- }1 ~
- #define DMA_PRINTK( x... )* r9 r4 i% k8 {, g
- #define DMA_FN_IN
+ s1 i" m2 b" @1 Y% o - #define DMA_FN_OUT
5 z5 R m: P, T: a - #endif/ |8 `' Q7 S- a. ~/ Z+ @1 B
( Q, |8 r8 B) v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 A( l' n: W, h+ O
- #define STATIC_SHIFT 3- b1 v" u b3 e- E9 d
- #define TCINTEN_SHIFT 20
: U7 g& L0 p: Y2 Q - #define ITCINTEN_SHIFT 21
2 [1 D9 _9 c' u2 N$ P* G9 h3 o - #define TCCHEN_SHIFT 22
& n; Q8 e# |3 |( }" p& { - #define ITCCHEN_SHIFT 23
; }( E/ |' j3 o( h" |9 q - 5 y( c, I$ f: Y$ P% b* w
- static volatile int irqraised1 = 0;' v$ y/ w4 E9 b9 `
- static volatile int irqraised2 = 0;
8 F5 P6 K# U* D7 F. L - : F: B0 N2 O" @5 K- F7 j# J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ W" T' n. p% b$ K3 h( d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# B. y3 M" W4 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 c( S3 K% m: b$ ]
- }3 G+ y7 j: L* @! W6 A- dma_addr_t dmaphyssrc1 = 0;
/ x! w/ T9 w+ ]0 | - dma_addr_t dmaphyssrc2 = 0;
( L4 x+ P! H7 { - dma_addr_t dmaphysdest1 = 0;
! S' H- r' }) b - dma_addr_t dmaphysdest2 = 0;; _! o' N2 ^" ?
* m. |1 q! G F/ N6 o- char *dmabufsrc1 = NULL;
. o; G/ Y* |6 \7 `: F/ ^ - char *dmabufsrc2 = NULL;' M- g0 u4 t& g( P1 J; o5 @
- char *dmabufdest1 = NULL;
h4 P% f. x. {8 O& L - char *dmabufdest2 = NULL;! p7 f' h: c# A8 f6 L$ l. n9 @9 Y& x
3 p! m+ C( U3 t! @# q- static int acnt = 512;& Q3 K. Q: j( Y
- static int bcnt = 8;
4 Y" i" ?' \0 D( ~ - static int ccnt = 8;% U1 G# p+ A, ?" X6 V: a
! y; H- j5 @9 X: u3 x( \2 p2 j- module_param(acnt, int, S_IRUGO);6 P, @/ E/ s: _* M2 j
- module_param(bcnt, int, S_IRUGO);
7 V- t Y; `& N V. e - module_param(ccnt, int, S_IRUGO);
复制代码
' E: Y2 r. b% a; M( {' B$ L4 D/ } V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& P/ j* C8 E) m$ U2 P5 k% warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 W4 u6 y" J4 S; i9 |+ E- R6 \7 M( O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 {. ?) M1 U% g- q) i2 M
% b5 n' j! y; x( h* k2 ]" U+ J3 J# H
|
|