|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' }1 r, |, ~: ^6 \# q
- [code]EDMA sample test application# u& l' O, D0 ]
- /*
: ^9 V; K7 S6 ~8 Y" _ - * edma_test.c2 C: @& W$ `8 h
- *5 g9 g* G( Z. S4 S) S2 ?0 t4 l0 S
- * brief EDMA3 Test Application
. p" Z# V$ p, }, b# @% Y6 T; A - *
. V1 ]4 E$ H2 N# V' @" { - * This file contains EDMA3 Test code. _' W1 ^9 R) k$ h: K9 A% S3 p
- ** E! J( h) K. p' |$ p$ b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# k% i. _- `& H$ w3 }) Z7 o5 u# Y; E
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 ~$ J1 C. W. n3 x* x - * TO CHANGE." L% B; X" Q! W2 s$ f" s0 T: F( }
- *
( W a5 q. K4 v* w& c1 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) ]) W, K: }: i( R, E' T! \
- *
( P( U9 {. ?& o* o; Y - * This program is free software; you can redistribute it and/or
* v$ D' t0 H( h4 e. v" f: f - * modify it under the terms of the GNU General Public License as
+ \2 {6 `, e! ?; s - * published by the Free Software Foundation version 2.2 |* w' h$ d" v5 B
- *
+ j: x) z8 o' v5 W( q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% r7 [% h. C, N8 N - * kind, whether express or implied; without even the implied warranty
. T0 o, H2 I6 ?( F( D6 ]8 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 _& U$ i8 u1 m" o# M. P" g/ i - * GNU General Public License for more details.. x2 ?) x* b; a0 T
- */
/ Y- v; E, }! ?! P6 ~ - . E9 k/ ^! o" H
- #include <linux/module.h>2 W4 O7 d. x( w# Q/ {, E/ J
- #include <linux/init.h>% T1 G3 P# W/ c7 L9 \9 I: T3 g
- #include <linux/errno.h>: y$ @- w- b- F1 {3 h' ^ i
- #include <linux/types.h>
2 C# C, T6 U x2 Z2 L, _ - #include <linux/interrupt.h>
- H1 s& Y& V+ V6 m: ]4 Z) \+ ? - #include <asm/io.h># d, z: ]9 O: e- l+ E0 m' K
- #include <linux/moduleparam.h>
. O. M L$ T2 `) M - #include <linux/sysctl.h>
; m- X" ]8 |# y* M |# w6 k - #include <linux/mm.h>2 W9 r) o0 V( t/ a; P# P
- #include <linux/dma-mapping.h>$ G/ Z/ m& u, g: \1 C) P
- r# a0 m% A0 n7 N& Q
- #include <mach/memory.h>
8 z2 ]2 P% }0 v+ v+ h) M - #include <mach/hardware.h>& T- d7 J% ]; p* O
- #include <mach/irqs.h>
0 M; o- [9 G& o( L& v - #include <asm/hardware/edma.h>- N1 ~* b& E+ s$ I4 U& ?) V
. R; ]9 J* ?- q' _' c- #undef EDMA3_DEBUG
m ]/ @9 D; f5 o+ Z' r6 P - /*#define EDMA3_DEBUG*/$ M9 f& J% Y7 e, h
- " `7 [: z' x- ~. h4 ]( c
- #ifdef EDMA3_DEBUG& U( E5 B- @0 F3 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ F2 H" ~# C# s3 I7 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j- \9 p: Q( Z/ ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 H9 v# U, r, r7 o$ o5 ~2 Y4 y0 z
- #else
* R% s& ?( q' P/ g+ b/ O; D - #define DMA_PRINTK( x... )
. t) |/ H. r5 c, ~, b/ ]. Q - #define DMA_FN_IN" s, e9 p+ t d0 R2 [, V4 B
- #define DMA_FN_OUT
/ ^7 l, y- S4 v H3 x - #endif8 q1 m; W" u; a) `9 W) G7 h8 H& e. _
5 E' |* K5 {+ t6 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 F U W$ K& v5 d% T
- #define STATIC_SHIFT 3
1 U$ H2 ]: A2 {5 O' M - #define TCINTEN_SHIFT 20( p7 Z* ~ @ C: |
- #define ITCINTEN_SHIFT 21
& H+ R, }4 i+ j5 @/ q - #define TCCHEN_SHIFT 22( j* F( J5 Q9 ~
- #define ITCCHEN_SHIFT 23
) I W T1 k/ X4 `* f$ ^ - # _: I: m- @& M. X0 x
- static volatile int irqraised1 = 0;
n& \7 v0 b) W# ^$ W4 l - static volatile int irqraised2 = 0;
6 h6 ]# e# W. l( X+ E& E
0 E" d! O; ]' {! v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, h9 s3 Y; A+ k- s3 T8 R6 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v N1 P1 q0 J/ j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 c: r7 h* X( w; M" f$ a7 _, _5 c
% z* h& r; {9 J- Z7 w- dma_addr_t dmaphyssrc1 = 0;
8 y& ?; j- ~ f, Z7 l1 Y8 \3 E - dma_addr_t dmaphyssrc2 = 0;
" E8 C: `7 E% I1 V" b - dma_addr_t dmaphysdest1 = 0;
( s* z7 h- Z2 K1 ` - dma_addr_t dmaphysdest2 = 0;
- @9 z# Q! U6 ?! t; P) q - $ @) G/ I( }/ _( g
- char *dmabufsrc1 = NULL;
1 t/ V0 M5 @( g% M. ?- r - char *dmabufsrc2 = NULL;1 w6 D3 _; z. m- |4 y
- char *dmabufdest1 = NULL;: y/ B+ e3 p7 [& j% t: Y
- char *dmabufdest2 = NULL;; U9 M" E& `; j6 M1 H% `
- D9 ~& E, r b' h/ m6 q- static int acnt = 512;9 U# a8 \8 d8 j( g I% s
- static int bcnt = 8;3 {- s% _. {4 F, s' L/ w/ s
- static int ccnt = 8;( ~0 J0 Y% B4 s4 h
/ m: \& D% d/ E) X) r1 u+ t- module_param(acnt, int, S_IRUGO);5 w( w1 P. P. t) }4 Y- S
- module_param(bcnt, int, S_IRUGO);. y* H7 h4 r+ p5 ?5 s J
- module_param(ccnt, int, S_IRUGO);
复制代码
5 B5 O2 N6 ]) [5 M I$ V: C- i3 y* l% g
3 ^' }+ a4 P7 K0 K/ u2 b. o' p* a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% o; p! w& Q9 z' K& c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K, @+ R" d: g7 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! n+ N8 I g+ _! m' x4 y
% u# z/ h# o' ^
3 V3 t3 U; o0 ~ |
|