|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : W4 ~+ _( ^3 {/ C; Y( L6 T
- [code]EDMA sample test application
7 d# K0 k8 f% k: _& h - /*
2 U- F: d: E0 |: W* I# V$ L - * edma_test.c
3 n b) B! P. z - *
0 O U4 P3 ~# ?9 x8 y( @4 T - * brief EDMA3 Test Application
( E7 N. V' j* ~% P% X+ ~ - *9 ^. z0 H/ [8 P
- * This file contains EDMA3 Test code.+ i9 O7 u1 |) e# S. j
- *
: O0 u+ E# E" a# e C+ g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 I( g; L# q! j- s/ L+ n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 X k9 C7 D! x4 s* y* o4 V
- * TO CHANGE.# V d/ G' v2 R/ C( \! p0 g5 a! C$ @
- *
1 d: R: F* Z5 B5 X; {! A; I3 g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# D+ g! ^5 _6 K: v# W2 F
- *" e# e) r& |, s
- * This program is free software; you can redistribute it and/or
6 ^- m* A/ a. R0 I - * modify it under the terms of the GNU General Public License as8 @' h- R( C3 V; B
- * published by the Free Software Foundation version 2.$ L6 j1 V% z( ~: r# w& V. `; K
- *: A! I; G3 K# ]. ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 K0 u: Q1 n {% Z# V# n e
- * kind, whether express or implied; without even the implied warranty
5 z) A+ |# U' Y; z7 w; w4 v9 n) ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' k0 R, W: P; O9 U. r0 F
- * GNU General Public License for more details.
; h$ B# L, t# I( _* e( B7 W! d - */$ }' j4 q8 h$ o3 r: K/ x* v
- 9 A, }; `3 ~6 q2 p% U* K U. k$ A+ E
- #include <linux/module.h>3 e& k9 l& u4 j5 o/ G/ s: {
- #include <linux/init.h>6 `5 U' J1 Y) h! {6 W% s
- #include <linux/errno.h>
) Q! G' m7 k( V- D - #include <linux/types.h>5 t- X0 z) h& O+ F' K) a
- #include <linux/interrupt.h>! y1 e! O& s# x' `* l( g1 J; Y2 f
- #include <asm/io.h>
4 k, R5 k7 c/ k% ~. j. ~0 M% M - #include <linux/moduleparam.h>, a! l1 ^" q) m
- #include <linux/sysctl.h># _4 @# M4 y) h" y' r. O
- #include <linux/mm.h>2 Y, P& G* O/ O, Z7 d$ f! m, e
- #include <linux/dma-mapping.h>, L X$ ]5 {. y
- I$ N- v$ l! L& x, ~
- #include <mach/memory.h>
; v6 C; F6 b5 A4 i4 I4 d - #include <mach/hardware.h>7 U- s) _8 l9 L$ s* ?1 h2 w
- #include <mach/irqs.h>
; z- c# M" N7 d- I$ U4 M0 q* E3 e - #include <asm/hardware/edma.h>
! l# o: g; L9 b% Z: O( C
5 x0 y! [/ G1 W1 S: W) V- #undef EDMA3_DEBUG
4 b9 j/ q4 o- ^; O% f( C2 g - /*#define EDMA3_DEBUG*/$ V5 e! T& T; Q$ F/ g* Z
- + b b) o+ g! D6 _
- #ifdef EDMA3_DEBUG
# Y: e; t( V# x- i t$ B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" M" P3 O7 O6 u: M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% k" R& v [, i, J/ k; X# x0 a5 |- p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- E6 X, A/ } c1 L( L# r - #else
. { s- f& d- n: L) \& @4 i# {/ s - #define DMA_PRINTK( x... )$ |* b& ]! p2 q0 u
- #define DMA_FN_IN& q# _/ Y5 L3 W- I- d
- #define DMA_FN_OUT
J2 i, u* N; ?3 T7 U$ y4 S - #endif
# f4 E% G" N& ]( W
% u2 S( g. c, v" m3 g: V1 u4 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& O- j3 W1 L$ X- I8 }* e% d - #define STATIC_SHIFT 30 ?* Z) d2 A: J: C8 z
- #define TCINTEN_SHIFT 20
* \% A2 z" j, m0 a' S( X - #define ITCINTEN_SHIFT 21+ L& R( n) d2 a) B' R% g* B
- #define TCCHEN_SHIFT 229 U1 J0 R; K0 E8 r& W
- #define ITCCHEN_SHIFT 23
+ w+ R1 K( B3 X5 E* T6 Y* \5 {6 C
5 [$ C( l1 P5 v) R7 @- static volatile int irqraised1 = 0;
0 ^3 Q1 F# A1 r* w: z - static volatile int irqraised2 = 0;
& @0 i y% @+ x: T6 M6 a/ d/ v. W- R - $ c1 `, N1 n4 P0 P# W( P+ D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z2 g( J7 M% a# n* q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% @! }& b" f1 p+ E T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( h/ z; y% T. e$ I" _ - ) a0 U& h9 r) @0 q: V6 ^ i
- dma_addr_t dmaphyssrc1 = 0;
. L, z: u* ^/ g0 D% p0 J - dma_addr_t dmaphyssrc2 = 0;
- r6 O2 a' O: b( P2 Q - dma_addr_t dmaphysdest1 = 0;
9 v) X; f! A8 C1 a - dma_addr_t dmaphysdest2 = 0;
' o k9 q# [/ V5 f, a - " ?6 p7 a; {' S6 ~( b, Y5 P
- char *dmabufsrc1 = NULL;7 u: i5 }! f% T* ]' h2 d5 r
- char *dmabufsrc2 = NULL;
/ W( e3 @' H* g3 F( q - char *dmabufdest1 = NULL;
3 k" v, E& }4 g8 ?% l. P, j - char *dmabufdest2 = NULL;- R1 Z8 c: S+ ]) m
- ) j5 Y$ b$ m$ C/ s) ^
- static int acnt = 512;
+ A' p! F, w2 Z* {( H: m( u - static int bcnt = 8;9 i! Q$ }5 G0 h7 k
- static int ccnt = 8; @! c% K6 e( i7 r; d
- " h% J1 g: O. a3 f- T3 I* V8 s
- module_param(acnt, int, S_IRUGO);
& a8 m* i( h# ? - module_param(bcnt, int, S_IRUGO);
+ p" `! r8 A- B7 } - module_param(ccnt, int, S_IRUGO);
复制代码
: J4 U$ ~4 k; i9 T) u0 N
: l' j4 f) g4 Q9 ^" T- C4 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 C5 ]4 M7 w3 ~! ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 P8 z6 K% A/ V5 j. l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" A+ Y) e8 M8 }$ D7 ?
7 j9 m6 F) {7 u U: Q8 c
$ h( N1 a$ z4 R4 f# r |
|