|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ z; E, R1 U. `7 t0 ]
- [code]EDMA sample test application
4 q( |( \' d% ?* _$ E4 E& V5 h - /*8 M: x5 f! [6 t8 L
- * edma_test.c
- f/ \/ E4 S+ O3 E5 J) k - *& s8 _ u( K% m& t
- * brief EDMA3 Test Application6 [' }, W7 l- M4 O* M
- */ T' w V) z9 Q" l6 A2 z9 q
- * This file contains EDMA3 Test code.
# E+ v' Y2 h8 k% Z: e' b; M' U - *
- v& P3 F2 m6 ~) u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% X( g& }8 T/ a) r5 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 b; ?# Y; e4 v2 Q
- * TO CHANGE.
/ ~5 A% l' b5 j [ @: H; Z" N8 K5 d2 m - *+ s4 N5 T2 F4 L- _+ C3 O2 X# r7 s! c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 G& C5 g' b0 ]" U3 T2 U - *
3 n) N: u8 Q# }6 R1 ?. f$ l7 J) B - * This program is free software; you can redistribute it and/or
; }5 R! q5 c( |# p X. g& D: w - * modify it under the terms of the GNU General Public License as/ a0 J# J1 e, X* x% K
- * published by the Free Software Foundation version 2.' o0 G0 T4 v* f( a: h5 b" t
- *
9 x! S8 z/ d& W3 w$ i! m2 R: H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 j9 M" G* u( v' u A3 l8 b' l - * kind, whether express or implied; without even the implied warranty
( ~0 q `! R# C# }+ M9 A0 }; |' h% O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( m, E6 ^9 `6 K
- * GNU General Public License for more details., _2 _. Z* ?0 { C- d4 H* v D0 W: F) N
- */3 [1 _2 }8 H$ d, g6 T
' G: F5 G8 E2 ~* y( ~- #include <linux/module.h>0 Y6 C6 p- E0 N( A
- #include <linux/init.h>
- ~* T5 u7 W5 h+ M' o" s$ p, Z2 ` - #include <linux/errno.h>& H0 N4 q+ O+ S8 y0 u
- #include <linux/types.h>
" x8 Y. d2 P) [% b7 F# O - #include <linux/interrupt.h>
! s7 i' j" [+ ]; Q" T1 g) O - #include <asm/io.h>
3 c) z r: a: o/ n - #include <linux/moduleparam.h>& y( m, t; e! }6 J- T
- #include <linux/sysctl.h>: P; ], q' S" ?8 j( k
- #include <linux/mm.h>
% N9 P- V6 m* t; b9 p: I1 i* ^ - #include <linux/dma-mapping.h>
3 B" C# J* o. ?+ r
5 x' H. R; C( r: j" A- #include <mach/memory.h>
- c3 G7 G+ E$ \0 U* U - #include <mach/hardware.h>
2 U) G8 a) t0 O! J5 n - #include <mach/irqs.h>8 @9 C4 L$ f5 P3 R: F
- #include <asm/hardware/edma.h>8 ]& k/ s0 u* ^. _0 F! Q
- 4 Q+ ?: F$ [1 t1 w$ |
- #undef EDMA3_DEBUG
! J) m. I W8 g/ D8 i+ {6 u0 e- U7 } D - /*#define EDMA3_DEBUG*/* Z0 y, Q9 {1 j* h Z, F9 f
- % |6 k8 I8 r2 k# p4 B/ [9 a8 W
- #ifdef EDMA3_DEBUG
- q1 j. \+ C+ X6 u0 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): P+ h* q- l$ Q j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 m5 c3 }1 c+ |0 T5 M/ `' n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ^6 \% D4 z4 V% o3 @1 R* U
- #else
0 D; n7 I- i' V4 j$ A( d - #define DMA_PRINTK( x... ); O5 r' e% i6 X! P4 E
- #define DMA_FN_IN
0 e7 h0 o' }# S- W - #define DMA_FN_OUT
" ~% P/ X |2 l1 X8 h, | - #endif, l$ h8 w0 n5 U! Z$ x+ ?
- . d1 x# u, b* _3 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); q: o: {% p0 O" a
- #define STATIC_SHIFT 3! _6 l) |( t1 |1 V; K
- #define TCINTEN_SHIFT 205 g G& M! Q( h9 h, |
- #define ITCINTEN_SHIFT 21
& p$ a, B7 i* F/ J: t1 E* ^ - #define TCCHEN_SHIFT 22
% F3 P" t, j3 V8 p4 Q - #define ITCCHEN_SHIFT 238 o# c; M) ^, X' u( q
7 k: `" Y1 A0 |3 _% W" V- static volatile int irqraised1 = 0;
! x# r$ ~7 F5 ~: P - static volatile int irqraised2 = 0;
% e4 }: B6 i+ x1 a3 X9 T! E% T
% d5 K3 W2 y9 g! M$ k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: l. m4 K( r4 _7 C a2 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ Z1 g& S' a- t/ C( H5 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `3 O9 k' j: {) B2 F% r
- / F% o: v- {0 l! N, L
- dma_addr_t dmaphyssrc1 = 0;
o. l5 }8 D5 s0 x, j% ^: N - dma_addr_t dmaphyssrc2 = 0;
: b+ N2 Q5 i# a5 I" K) A4 C - dma_addr_t dmaphysdest1 = 0;2 ]6 D* H2 J% z
- dma_addr_t dmaphysdest2 = 0;
8 n# g$ x$ a$ u! g- B5 a4 N; f - 6 [, d; W$ m8 J4 i+ |7 N$ f
- char *dmabufsrc1 = NULL;
+ L7 ^/ }# c1 A; q - char *dmabufsrc2 = NULL;; A2 s2 `6 e N# z
- char *dmabufdest1 = NULL;
9 ?; D* ~" w0 _* K/ t/ O { - char *dmabufdest2 = NULL;3 o: u5 q* [* K7 J5 f3 U$ y7 q; D; A$ G
( k% }# M1 G0 `- static int acnt = 512;
) ?+ w# c+ n k7 b) N - static int bcnt = 8;( j! Y1 v' g# R
- static int ccnt = 8;6 Y: h( y5 | Q/ V
" q/ H2 ~- N8 E! r7 O s: m/ n- module_param(acnt, int, S_IRUGO); g! D% ~" c. c0 q& T# y" D
- module_param(bcnt, int, S_IRUGO);. H' e$ o/ V6 c* v8 y
- module_param(ccnt, int, S_IRUGO);
复制代码 9 X8 k* P; `: R+ d$ p7 ~4 {1 _
; v+ B( Z3 A' t& K' I! P& ]0 ^; B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 n$ v1 T, G% G. ^. P- H* s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( d4 B/ T2 @: S/ I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% ]2 [. E" B. n* x2 A: {0 H1 l
( H/ P. I$ |% f& S" H
0 I$ M% ?2 \6 V' `" t1 \2 y1 P |
|