|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 c! t6 M, z0 y9 S" k) ?2 g( j5 i% [- [code]EDMA sample test application( e: I9 z2 i3 D( B
- /*
2 Z6 G7 r3 R+ T5 k R - * edma_test.c
+ W, |8 q( \, X3 t8 R, x - *
1 j* g! s* k, a e) N) _/ L/ i - * brief EDMA3 Test Application
7 C; U/ g; s2 } - *
. ?6 f$ [1 t. i5 S9 _4 B4 t - * This file contains EDMA3 Test code.
* l. _: T8 S0 S: J: n2 A2 J b r - *0 }& X b% s0 K( ?# D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ ^+ D4 e" ?. g2 H/ x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 R' ] ]7 h0 H! I" x - * TO CHANGE.
" f$ m, N8 M5 j0 u - *
( w4 ^. w" d M+ j! f) w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ G0 n6 ] z( u' _0 U - *- R2 _/ q/ L3 e' i- o( r
- * This program is free software; you can redistribute it and/or
4 e; C2 t4 s# `7 m. I* |# a - * modify it under the terms of the GNU General Public License as
% i9 y. y& f& C6 a2 B - * published by the Free Software Foundation version 2.
: ~0 h/ f' ^3 D: w( m0 g" O - *
. \ L/ j1 r# Y- _' {2 X" @6 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 U6 l1 S1 v# _% r& m - * kind, whether express or implied; without even the implied warranty
, z; ?! t3 A1 S/ A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* b- P& V8 J# w
- * GNU General Public License for more details.
/ i4 P3 _. U5 t7 @9 H2 w% N( |! ~# _6 h - */
1 J6 B! G5 t9 a- N, \4 P
1 C5 z. c1 E+ l: K' y- #include <linux/module.h>
7 m+ W/ }" m& u5 g4 N - #include <linux/init.h>
! f* r3 g; z6 E - #include <linux/errno.h>
% j/ v* P" F2 { T/ ~ - #include <linux/types.h>8 _% d4 i- u3 L( G2 B @4 }
- #include <linux/interrupt.h>
# ]7 {2 O% K4 k! P% X+ j* K+ E - #include <asm/io.h> J/ L6 o( J9 T n+ G
- #include <linux/moduleparam.h>( y$ B2 w1 e0 g6 _' e. A/ c- C: ~
- #include <linux/sysctl.h>. ~ v, A4 r1 Y1 y/ Q3 E
- #include <linux/mm.h>% E, X' u( X, S. H( [
- #include <linux/dma-mapping.h>1 k T* M# Y" @* ]( k( @
" t/ T( N- Y8 m7 H7 L. q- #include <mach/memory.h>
* ]' M* ^ I% N/ j3 f4 Q, h0 ^ - #include <mach/hardware.h>/ n; c8 Z, ] `) E6 ]2 |2 t
- #include <mach/irqs.h>
8 `# i0 ~7 V7 j, C' S K - #include <asm/hardware/edma.h>. q+ P/ D+ R! t% E$ M
6 C+ i$ j& X) k- #undef EDMA3_DEBUG) X# q! H5 O8 H. G6 I
- /*#define EDMA3_DEBUG*/: V- L; y) G6 D8 K% Y$ W/ e7 o! t$ ~
! p6 E/ r0 |" D! I, `9 h6 X( S" l& R- #ifdef EDMA3_DEBUG
) y6 _6 i6 `: B) \1 u; `! }$ u U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 o* q/ }+ f! D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( m* k) ^4 ^, T5 P: A) l4 t& P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* @1 w2 |% `9 b2 Y6 P - #else9 i# b/ \$ G5 R/ g2 L
- #define DMA_PRINTK( x... )2 Z8 g. p% N9 C, K( ^! k& b
- #define DMA_FN_IN
6 K1 t4 E1 z' V( Z - #define DMA_FN_OUT
/ T; b" ?4 O" u) ^: K u/ [2 m1 Y - #endif+ h0 v g* q2 a0 k
- ) }- ~* }% X3 s r0 q" g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. @- j0 C( |$ }% U - #define STATIC_SHIFT 3. I! D+ V; x! S( j( U# m5 \
- #define TCINTEN_SHIFT 20
F: {2 z1 \0 ]0 P( S# s$ w - #define ITCINTEN_SHIFT 21: `/ X! r9 `/ `
- #define TCCHEN_SHIFT 22
Y4 r; z. p5 J3 { - #define ITCCHEN_SHIFT 23; L/ O! \5 ~* v+ b* r0 [# I
- L4 |" w @4 i( K# o- static volatile int irqraised1 = 0;
4 s( x, A& x1 j; T - static volatile int irqraised2 = 0;
$ W6 t9 L1 T" J0 e - 7 R D! }' n- b; n0 k1 }2 R1 H5 c5 Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' S, q, |" Q. D7 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l" x9 g' Y8 ~, Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
[& |2 y3 C8 y4 X+ f - ! T2 U( C7 @; y) N7 G8 h
- dma_addr_t dmaphyssrc1 = 0;
$ j. P: f2 Q0 M6 J - dma_addr_t dmaphyssrc2 = 0;
7 P9 m/ p8 h: V, r! J/ `* o - dma_addr_t dmaphysdest1 = 0;
$ M [/ G7 ?! q. @2 g+ q# y - dma_addr_t dmaphysdest2 = 0;8 `0 X5 ]6 I) @! u! O0 W$ Y
- ) S, ^% n3 P6 D# z% m
- char *dmabufsrc1 = NULL;
. f9 M- m% F) a1 O& s5 `; x - char *dmabufsrc2 = NULL; b/ r2 Y# `# K& m: p5 \
- char *dmabufdest1 = NULL;3 G+ r* r4 G2 n e) n
- char *dmabufdest2 = NULL;5 a2 _) Y; C d
- # o: }4 M& L6 a( ~! X
- static int acnt = 512;
* P7 }, \2 o8 u. _+ [8 \" \8 q - static int bcnt = 8;
3 Z; E+ U' K+ P - static int ccnt = 8;3 B$ ^& X2 P y1 ^* F: l# b, p
- ) h0 f6 h$ D7 B# L5 w- D$ t( U
- module_param(acnt, int, S_IRUGO);& _/ c; Y& g3 R- [5 a: L9 W/ U6 J
- module_param(bcnt, int, S_IRUGO);. J, O( \8 c; d8 d
- module_param(ccnt, int, S_IRUGO);
复制代码
$ @: `4 B+ J. o1 l' w* O- e, U. D8 I, Z3 s: a' j1 L7 s) O+ h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 y% H7 q% [7 W+ @4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ V- y# a2 I% p9 g+ J% x7 ?- u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- G- q7 B$ b$ L, t) C
* j' ~0 a( v) \% l$ T9 j9 k3 t, g' ^
|
|