|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) u- \6 Q6 q7 Z/ [. |7 S- [code]EDMA sample test application7 J( k9 O8 Y8 {
- /*3 L* Y, ~5 a6 F1 Q- ^/ p
- * edma_test.c- W3 W% Q- }4 D i. [
- * d3 Q6 j$ X7 [$ n8 g8 o! \, C" r
- * brief EDMA3 Test Application. I/ @; O( M2 S" z8 k- Y: k
- *9 \& o8 @/ D/ j3 K1 N1 }
- * This file contains EDMA3 Test code.
& k' A+ P2 @; I/ \! T - *
% E9 u& l! ~- _+ v" w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. G( i' F; |+ M3 F+ \ z; G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 v" @) G1 |5 k7 r S' D. \: f
- * TO CHANGE.- q. r7 r6 E7 H
- */ ~& H& O2 s) R( w. g! V5 B. \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: U L3 N7 e6 R0 h' t' m
- *
) H' w3 O$ z ^9 { - * This program is free software; you can redistribute it and/or
) J s" C: s3 ]+ _1 T" X8 Z - * modify it under the terms of the GNU General Public License as
6 ~) _6 h( Z8 b# x1 Y - * published by the Free Software Foundation version 2.
8 d- _" ?- C/ w8 X7 g - *2 d1 S! D) e* s$ M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 l h; H* a) M8 v/ I
- * kind, whether express or implied; without even the implied warranty
/ Q! x/ B+ V* i$ Z. ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ Q! X }% Z/ W4 r4 b: n$ `
- * GNU General Public License for more details.4 P- Q8 a( c# B' s. a
- */8 l& O$ ]4 u6 H4 Q
- ( Z# L h. h; T) X% k
- #include <linux/module.h>
0 U* M8 }! ]$ p* U, k: h8 u, C - #include <linux/init.h>
1 F* _% B8 I$ z) k - #include <linux/errno.h>$ D5 [5 R3 r" o
- #include <linux/types.h>4 d, v: M6 \# q" W7 p$ z, D' k4 F3 w
- #include <linux/interrupt.h>' H3 w! I6 j) N* F- ^
- #include <asm/io.h>2 l( s% C; _& o; [5 Z# E
- #include <linux/moduleparam.h>3 j W" ]' _, C4 Z: o& A
- #include <linux/sysctl.h>! a/ s; ]/ s- k
- #include <linux/mm.h>% `8 J0 K# \0 @! i1 a
- #include <linux/dma-mapping.h># T' s, x, d6 L$ U0 R7 v
- , I/ V3 `9 J* P
- #include <mach/memory.h>& k Y; C4 E5 w
- #include <mach/hardware.h>; u4 g5 |* }% y
- #include <mach/irqs.h>
/ q/ i/ Q; v% F: Q) p - #include <asm/hardware/edma.h>
( N- I; t! M* @1 x0 _3 U0 i" O8 ~
; v& s0 d+ ^/ D' `% O4 m- #undef EDMA3_DEBUG' f/ B8 U5 R. C1 f( ]& v6 O
- /*#define EDMA3_DEBUG*// y: f% u5 m0 V; g5 M0 M
- ; B# e9 M2 y F' T( P0 p; ]4 w- {
- #ifdef EDMA3_DEBUG
6 C- P/ ]0 _ K3 w1 Q k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ~9 I) _9 ]+ C/ M, ?, M( _) \8 G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ]6 V6 C" E2 N/ Y/ b( S/ u% z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- M( H- l5 ^8 R3 S t1 U% P$ [; V
- #else1 S4 h9 D+ A) ~
- #define DMA_PRINTK( x... )& X* V1 s2 t( F3 u% K2 D; O* L
- #define DMA_FN_IN
: [( Z! ~# C5 x+ \& ^ - #define DMA_FN_OUT
( A1 |3 B/ J+ C6 H! e. I% n$ L - #endif+ J9 `9 e) P3 M6 @/ o
8 q" Z4 a& l8 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768). H2 K; t5 h; b( }! ~0 X7 Z( o
- #define STATIC_SHIFT 3$ _4 x9 X, C% t, T( o
- #define TCINTEN_SHIFT 205 w7 @( y4 E! `$ m( m" w
- #define ITCINTEN_SHIFT 21
" k6 C5 v v! b; m6 G) |/ X2 Q - #define TCCHEN_SHIFT 22
& x' I, u% Y) r3 s0 a: z - #define ITCCHEN_SHIFT 23
# @' I6 ]9 E( t4 v5 B - 5 N. Q+ b! E; e& D, e2 K
- static volatile int irqraised1 = 0;
& C0 \0 [ W8 o& K6 O* E& \' w" | - static volatile int irqraised2 = 0;" }2 I, q1 S+ g5 U6 G7 D- Q
- ( Q9 o9 |2 s5 ]/ p( _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) y8 ?- N6 D0 x4 E' v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ q( t+ S: o3 R* J* C: p9 Q6 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 C$ Z0 I& r/ _: o5 a1 z
- 3 b4 ^4 M- y1 F, a; o1 e; n
- dma_addr_t dmaphyssrc1 = 0;
9 a, ]0 C* g S# ^4 U* p) c - dma_addr_t dmaphyssrc2 = 0;
& {0 I* E- [* w$ i3 [ - dma_addr_t dmaphysdest1 = 0;
( |8 V" T8 T @3 U2 O9 D2 a9 f2 U: b& Y - dma_addr_t dmaphysdest2 = 0;
" c8 J' @! E$ M/ Q- i- j/ \$ q
4 g# b# ]' @+ K+ I; x$ d- char *dmabufsrc1 = NULL;
; r) n' X% {% P2 X6 C) G8 S+ C - char *dmabufsrc2 = NULL;
; z. C, c( E' s4 T! }$ N0 o- u - char *dmabufdest1 = NULL;
) I% `5 j5 U# @0 U2 }# @ - char *dmabufdest2 = NULL;
+ |4 Q& ]& R9 E5 D - 4 n% } p4 s( e. b
- static int acnt = 512;2 T7 l9 l# K0 v! n
- static int bcnt = 8;
1 U0 T' v" Q1 P& t1 X - static int ccnt = 8;7 c; ~" G! W3 u/ E: W o3 L0 {* x7 C
- : G9 }) ^# K7 o8 v- R6 o
- module_param(acnt, int, S_IRUGO);
8 @# ~! x6 W) q - module_param(bcnt, int, S_IRUGO);* l' H9 t0 G2 T$ _; P
- module_param(ccnt, int, S_IRUGO);
复制代码 6 E$ h. {0 e$ [% T( L. J: Z7 K& d- |
" N" d/ o0 r$ w# f4 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ~# g1 V' Q) I3 N6 y; V; g! K& K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 A# q: U; X4 I) _" }, s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ u; X) r$ l) p: l6 `
% ~( r# X0 ?' k& G4 h: O
- B S# a) h# Z c# k6 h |
|