|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / W; `6 b( a6 c5 N7 A; W4 e
- [code]EDMA sample test application4 l, e* X) h1 A8 O% Z" p
- /*, P* f7 r- d6 i
- * edma_test.c
/ G+ J7 a6 ^+ r( O* E% a+ H - *, Y# c- S' }7 ], M$ d W8 O" {0 E
- * brief EDMA3 Test Application" {3 P6 W' Z/ Q+ P# O7 r6 O
- *
& {& |' O& K1 S7 j - * This file contains EDMA3 Test code.
- \+ d$ G& S3 g* ~/ C# ]( [" J* S - *
, M( K( A7 G0 L* W( Z3 ~* t2 d9 S$ A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 C9 T+ t3 s+ ~/ K3 U! ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Z5 d" B! M9 `# l. b/ T$ m - * TO CHANGE.
6 S( a4 F2 Q+ D" H k$ x2 I8 x - *
6 C, q0 F; k. n3 W& D9 k S( ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: |6 ?- x- R! T8 B2 z! v - *+ P8 f8 P7 u' U' c9 g" I7 Q+ z6 Y
- * This program is free software; you can redistribute it and/or7 i4 A" g1 @; b/ b5 O X2 w
- * modify it under the terms of the GNU General Public License as; h* `% A) O) n! \" F% Z" ]1 M
- * published by the Free Software Foundation version 2.
- [- E5 X c1 e( l - *6 m3 Q( ^: f) G% a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& s. e% }) f: D- M" V- F
- * kind, whether express or implied; without even the implied warranty
; k) q" d5 N* c! {9 R' E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 D! {2 k) u* f% ]- a4 G: f# t. S
- * GNU General Public License for more details.
; ~6 E' U% N/ j. ^; k* v. z3 V - */0 l/ V& |. @7 g9 z, t
: r, n, |$ a) I* A. m! R- #include <linux/module.h># I! ~ \7 p [7 ?! B, N
- #include <linux/init.h>6 `1 C. o1 q. R
- #include <linux/errno.h>+ z+ o6 ]. Z7 v; m. I. g: O
- #include <linux/types.h>2 l2 F5 h! r- L8 h# _9 l; A* i
- #include <linux/interrupt.h>
$ b" n3 ^! E1 H. p8 v8 s7 M - #include <asm/io.h># O% V( a4 x/ q9 f
- #include <linux/moduleparam.h>6 N# Z6 `/ v% X- O; X8 d
- #include <linux/sysctl.h>+ D* e9 u5 ~1 f$ o: }! o% X2 d
- #include <linux/mm.h>+ m! [# z9 n- k4 N- `( O, X
- #include <linux/dma-mapping.h>) c- X3 p& i! O7 j% D
- # l1 [8 G7 y! n) d& o% g8 ]! a
- #include <mach/memory.h>
& n5 w. n% A6 Q; e$ P; Y" F+ U6 ^ - #include <mach/hardware.h>
! H+ F$ _% E r9 I8 o/ Z, t - #include <mach/irqs.h>
6 w7 i, U1 g8 M* {' j4 q l - #include <asm/hardware/edma.h>
" n; d+ l9 y5 c* Q- X9 ^( R
5 e5 i, m% |7 B) z6 D3 A4 j/ W- #undef EDMA3_DEBUG
$ e8 ]! H$ l# J3 s. ~# p. n j - /*#define EDMA3_DEBUG*/; ?4 T" l6 d2 V% C: j& l% C
. I+ ~$ K7 X; q! e$ E- #ifdef EDMA3_DEBUG
% w' [0 M, P3 L3 }( b0 ?: Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 i/ ~$ O) G3 P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' R/ v" B( O1 S# O, p% T5 _" {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 s, Y& F% G: }; X
- #else
( V& h3 }4 P! E- }! B2 C4 n9 ^ - #define DMA_PRINTK( x... )/ A" U# p7 h+ v8 ]" M" x0 ^
- #define DMA_FN_IN
' w1 E: {! V4 F0 }- k$ x - #define DMA_FN_OUT V9 E% @- Y# p1 G( r. g& Q
- #endif* w1 w. V5 k. ?0 [# d
- ! o% w7 y3 g: v" c" K! b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 Z) A1 W4 i* U- b i9 y7 h# }
- #define STATIC_SHIFT 3
( l4 i7 A( |) C! N- `& O7 k - #define TCINTEN_SHIFT 20
" w. g- B7 l# B2 _ Y8 Z3 f - #define ITCINTEN_SHIFT 21
& X b9 ]1 y( B - #define TCCHEN_SHIFT 22
! `# S' U/ Z: A( N( M2 B - #define ITCCHEN_SHIFT 23- n* T0 Y3 E/ ~
- ' ~2 F% P% E; ^' {
- static volatile int irqraised1 = 0;
) g7 T, E( j7 d" Y) p$ x8 {8 x - static volatile int irqraised2 = 0;
* x% |: k0 A1 ]5 p - 2 q; |0 a6 X- v) f/ y3 m5 ]+ j1 ?( E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( N6 G* s1 R% J0 I9 C7 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! t0 o: D, A5 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 r, l, J. V/ P
4 g2 R1 x9 f( [- dma_addr_t dmaphyssrc1 = 0;$ ?* n4 M: L: Z5 G4 d
- dma_addr_t dmaphyssrc2 = 0;
+ N+ e/ s/ r& ?2 O* }& F E - dma_addr_t dmaphysdest1 = 0;
& Y+ Y5 W/ O& Z5 ] Q# Y! c - dma_addr_t dmaphysdest2 = 0;1 ^% h6 T; |" U3 M$ v T% M. f D
2 F% |+ @# I/ Q* L- char *dmabufsrc1 = NULL;$ J5 H7 W$ ^* J8 m, H
- char *dmabufsrc2 = NULL;
; N2 ]- T# G+ w/ K$ E: p - char *dmabufdest1 = NULL;
; d- c9 _% P! m$ Y8 r4 A7 O: H - char *dmabufdest2 = NULL;! @- Z: b" @- P. m0 z% _! ?
- * q( u" d/ ~+ v1 i1 N
- static int acnt = 512;8 _9 e7 _/ a' B/ l
- static int bcnt = 8;
X. s- r& H6 x. i8 _ - static int ccnt = 8;
o: E1 J4 {; H7 u7 g+ { - : Z( C5 l- a/ i% R5 w3 S
- module_param(acnt, int, S_IRUGO);+ l ~0 n% s# p4 j7 e
- module_param(bcnt, int, S_IRUGO);
3 t* n Y" m3 _6 N - module_param(ccnt, int, S_IRUGO);
复制代码 8 T; Q% } ? C
4 s0 Z' ?2 S. X/ x; u9 g% i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* p- f* t1 s/ b1 R' q N- t$ x- e) _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; z6 ?8 z6 G) {& c7 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 E+ V6 U5 V/ e) w" q' W9 v
T3 H, }: [. u5 g
- {0 H" Y+ g2 K/ L& R# h( L
|
|