|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ~0 Y/ T4 L4 S! J- [code]EDMA sample test application: B% m9 o) \1 m/ s6 S5 P
- /*7 d/ R& [7 L3 \
- * edma_test.c
" H2 b# F7 H8 q/ ?$ M0 H' X" E - *! ]1 F" k! n, M0 j$ K
- * brief EDMA3 Test Application
% u% M6 M: ~1 A0 E' t6 t6 e) ` - *
! G) I/ |* Q$ e# ]* ^ ]. Y6 u) e - * This file contains EDMA3 Test code.! e3 h9 m0 F) S0 G
- *
9 e* w4 |; u( b6 R& j0 g5 A b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 p3 r1 t" c# Z) F: Z( Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& Q3 W$ F" e, C6 ?0 _1 L- u8 @ - * TO CHANGE. x* l0 y) L8 j; C5 Z l2 b$ w
- *
: q. J8 u. R6 M; Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. `$ x# O- Z& [+ W& D3 ^ - *
1 F$ `3 \ s2 a! i - * This program is free software; you can redistribute it and/or
z2 r% j: ]. D* p8 Y; B; h% S - * modify it under the terms of the GNU General Public License as2 c# V- s& X9 A6 d
- * published by the Free Software Foundation version 2.
" W. J/ n$ W! Q3 _ - *
2 y6 _( _$ u! N6 _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
@/ q# Q: E7 S7 j - * kind, whether express or implied; without even the implied warranty
( n9 _7 b# {; o* v: h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& i4 x( z# s# p1 H
- * GNU General Public License for more details.
0 f8 a- s$ @1 F/ I - */( U, K7 Y& I. s$ `
- 0 B- K3 w+ k$ T; \
- #include <linux/module.h>3 ^ f2 @3 }, z- I+ f0 D4 ?$ x, X
- #include <linux/init.h>6 P' `5 ~" _( t7 t% R1 r
- #include <linux/errno.h>
1 g& B3 }, L! H4 E" A6 H1 ~ - #include <linux/types.h>; ~2 u- v% v( M7 _
- #include <linux/interrupt.h>5 W- l$ \9 ]- E$ m* B
- #include <asm/io.h>0 N) Z; N8 ~& C6 s' V9 h
- #include <linux/moduleparam.h>
. o+ L; x2 y$ Y/ i; v% C, ~4 \3 D& W - #include <linux/sysctl.h>
$ d2 b! C% n" i! S' h3 L0 p9 G - #include <linux/mm.h>9 }% O! h4 J4 P3 G: H
- #include <linux/dma-mapping.h>
% Y4 H! G6 A6 F: G2 g ~
7 v" R' V! j+ I- #include <mach/memory.h>
; {- T8 W: H" H: L7 [4 E" t5 q - #include <mach/hardware.h>
/ U( Q6 ~. b1 \6 X. _ - #include <mach/irqs.h># d( T% D4 T% s4 L
- #include <asm/hardware/edma.h>
- c" t$ G; W9 f& @" A3 _8 E: n: E - , {0 t( B+ e( i5 p2 Y" Q! }5 I
- #undef EDMA3_DEBUG
4 [9 p( p& s& X - /*#define EDMA3_DEBUG*/* V9 T5 ~+ {1 y; G! Y, z2 ]+ e
( u2 X, t; w) ?- #ifdef EDMA3_DEBUG
5 N2 O8 u& |+ ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ~ z+ Y/ k O6 g) Q. I V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* D7 z# b4 V9 c% Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) _ @1 g" U1 ?- g - #else1 d, d9 i7 `# v5 C; I' f1 m
- #define DMA_PRINTK( x... )' f+ W% y( Q' S) R9 d/ J i& K1 G
- #define DMA_FN_IN; n! H' H. W% h" r) e; r( o
- #define DMA_FN_OUT3 V4 P1 J' G( R! C9 r, g
- #endif) \6 K) w$ Y" w6 _
- $ M7 S' D& O2 _" r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( r" o+ w% P( o- t0 t6 e
- #define STATIC_SHIFT 3 E' y! r, m: w, w! @, h# R4 n
- #define TCINTEN_SHIFT 20( V+ T4 W" J. z) G; ?
- #define ITCINTEN_SHIFT 21# Q0 V7 U2 l m
- #define TCCHEN_SHIFT 22) v4 L5 \, @, b( ~% W& ^' m/ f. |& E- K
- #define ITCCHEN_SHIFT 23
0 j, u' l. @# H/ l' h# x - & t1 i- h( L6 a7 `& h. |5 M
- static volatile int irqraised1 = 0;# d2 s' n3 v s: ^
- static volatile int irqraised2 = 0;0 q9 t' s5 e# A7 ~ _: ^
- + U# m' Y+ h: e& D L% f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 M/ X+ W& Z9 K* I l8 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! [7 I& }+ r- E* N% F0 R: |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); f1 f8 ^; x7 U0 [" U& p3 R
4 G% f0 ]. z e" U7 N. H* E: @- dma_addr_t dmaphyssrc1 = 0;& s2 U6 q8 u: [. }7 Q( T
- dma_addr_t dmaphyssrc2 = 0; N* J! t! o7 U5 w$ s
- dma_addr_t dmaphysdest1 = 0;
; e* u1 L( v' J/ p; M9 g+ a - dma_addr_t dmaphysdest2 = 0;
, Z! \4 E) T' ? - 9 G+ g7 w# W u3 F7 ]
- char *dmabufsrc1 = NULL;
2 Q- h+ k9 B% c# ]7 T) w- V4 f - char *dmabufsrc2 = NULL;
3 A# }: q3 o" d0 S& a z7 G - char *dmabufdest1 = NULL;6 X7 f( ^6 f: A) o' J: N7 A( {# Q
- char *dmabufdest2 = NULL;
2 z$ R6 V4 _, L9 F/ z; ~
/ G* ?! j! h! `' M- static int acnt = 512;
6 N+ y1 [. N/ \: R8 m* M; {$ F, I - static int bcnt = 8;- l7 v8 B+ R+ G6 C4 ]9 M2 x
- static int ccnt = 8;
0 }# r1 s; J# O7 e7 \' I b8 Q: l - ( ^3 l1 H. F# w! [& E
- module_param(acnt, int, S_IRUGO);, ^# [5 g! U: B6 A( I1 R6 ]2 [, B
- module_param(bcnt, int, S_IRUGO);
( V3 F8 s- Q# z4 v - module_param(ccnt, int, S_IRUGO);
复制代码 6 c- s+ N" J9 B2 p/ ^/ _
7 v2 s+ T8 R) }5 d3 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
b f t9 X Q" H5 P, l( oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 K% ]5 w: q; ]/ g5 [; {8 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# z6 M, i4 ?* ? o1 z
1 G7 o* [" e. Z. l/ B- _. e( H- I6 |
) b1 U# Q1 O5 R" U |
|