|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: z( `: V! B" Y3 N5 o+ t/ ]- [code]EDMA sample test application
1 s4 F/ K( W3 |5 D3 Z' l - /*
9 j* Q1 Q+ R. B$ u7 n5 Q' I! m6 k - * edma_test.c
# J S# v9 V! B6 Z- {$ G' @ - *" }0 ~8 p+ P( g& w j5 k0 t
- * brief EDMA3 Test Application" }% ~ c+ X1 N& H* Q2 @7 m
- *
0 J) r. _/ c/ B5 Z - * This file contains EDMA3 Test code.
: }4 E$ ^" [3 ~& h$ K1 O O - *7 O0 {7 l4 N E6 `8 ] @3 K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ f) U% Q% m# w% J, f% l; m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ D# n+ I1 b H - * TO CHANGE.2 O* [( D/ ?* B; J& s
- *
! d- @$ b6 R* Y$ f" S1 X, G; a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ \% Z! p6 P F! v7 \3 A
- *
3 X; W0 {; [' z( c' _* m - * This program is free software; you can redistribute it and/or# w7 a% h7 T9 i5 ~; N8 I& q
- * modify it under the terms of the GNU General Public License as
; B& ]/ j' [9 H* j - * published by the Free Software Foundation version 2.# |' M: c0 j; f6 K' G! ?
- *1 {, ]7 Q8 v! h5 T' } ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 @- e/ O3 w x% V* M* B
- * kind, whether express or implied; without even the implied warranty; W$ L E) ^9 o9 v6 d$ s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' R' |( t3 D9 ~* J
- * GNU General Public License for more details.
$ j- r6 S" v4 i+ {% X0 a; i - */+ R' t# a9 P7 V5 Q) D5 K. \
( O* K# C9 t# H- #include <linux/module.h>7 R: {5 W- u: u4 q" P( z9 g
- #include <linux/init.h>
7 L& D% C& C: b3 N7 w0 e& R% L7 d - #include <linux/errno.h>
( v$ w/ H) Z" I t! @ - #include <linux/types.h>
/ l7 o* [, _) {' N - #include <linux/interrupt.h>
$ a: |1 g3 l: p2 L- O( m6 F - #include <asm/io.h>. [9 [* C' Z/ y1 @/ S# E
- #include <linux/moduleparam.h>
6 b8 y; o. e# t( L/ a1 X - #include <linux/sysctl.h>
, h P; k& n( T - #include <linux/mm.h>6 P, A8 x3 F! l' d. v& ~) q
- #include <linux/dma-mapping.h>
$ h, @$ i0 x2 R* J$ ]; Z' O* O
9 H- B, M0 n; ^! M6 ~- ~" V, \1 _1 U- #include <mach/memory.h>: O7 ?4 A6 M0 w+ s5 e O+ x- M
- #include <mach/hardware.h>
5 g3 e3 \' q$ ~; `9 F0 k7 j7 H - #include <mach/irqs.h>
8 }0 c, U6 q( ~. @% h - #include <asm/hardware/edma.h>
' g$ q! C" t; Z3 M$ c7 I; D
1 y* u4 P m2 I8 I2 A- #undef EDMA3_DEBUG
+ l% T' R2 W6 C- B7 |5 m - /*#define EDMA3_DEBUG*/' }* ~& u* Q" o# ]
1 M, f6 Z/ x$ d% I- #ifdef EDMA3_DEBUG
! V; L( x$ @+ z+ N, A/ V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% W8 M1 I( @' E+ ~% m) B2 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ g6 q" Q9 h; _# W7 N; P8 l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! j; U. X; w( J1 W1 q( p8 }
- #else- {& [% W' B* e. e0 |
- #define DMA_PRINTK( x... )
, c/ l+ A$ K2 C1 P; x8 t - #define DMA_FN_IN
: t9 ~6 H. L5 ^8 f$ y* b/ S - #define DMA_FN_OUT0 F8 c# r4 q, [( t/ E" I6 Y' _+ F! }
- #endif4 y4 l# y4 Y' b2 k2 B$ ~2 j
- . n' f) z% V% E+ O3 ^! N/ F- Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), E# {4 N8 ]- ~/ e" z- ?0 p
- #define STATIC_SHIFT 3
) C6 @7 s, \8 P - #define TCINTEN_SHIFT 20& p( Y! K+ F! l0 ]7 R5 F! {6 c
- #define ITCINTEN_SHIFT 213 Q, ?$ s9 J4 R. p$ D( k. p9 T+ m) F
- #define TCCHEN_SHIFT 223 v4 u4 y2 P/ M( b" p/ m
- #define ITCCHEN_SHIFT 23
5 i: p* v. q8 z: h* ]# ]7 e& S
. E6 m9 S9 c9 S9 m% S! @- d& ~: u- static volatile int irqraised1 = 0;
9 N: v O X4 c# M - static volatile int irqraised2 = 0;
- ^# J5 f; t( t1 r
# m& Z: x) v3 k K; S* y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 B* R) o, h! `. {1 {$ v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, {! d* z) F5 W6 g4 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 B5 A, Z/ W0 u" f9 }$ X
- : d0 l& [7 l( ]2 X& k: n/ `
- dma_addr_t dmaphyssrc1 = 0; U p W& ~6 u$ E; N
- dma_addr_t dmaphyssrc2 = 0;% _6 }% _% V f
- dma_addr_t dmaphysdest1 = 0;
; l7 M, e" f* F! b7 e; z - dma_addr_t dmaphysdest2 = 0;
- g D, L& R( {# W- B
2 ]- O, u3 f1 g, {- char *dmabufsrc1 = NULL;
/ e! O* ~3 f( f" m5 s1 u0 G - char *dmabufsrc2 = NULL;
2 E: x, ^. H4 M% F6 a% b- G" s - char *dmabufdest1 = NULL;
9 M& J( I C5 B0 k5 x - char *dmabufdest2 = NULL;- k' ?1 S2 j# X) x
- $ l) w+ U6 Y% q
- static int acnt = 512;
* r: g: P6 S3 e0 x9 z" C - static int bcnt = 8;$ ^9 z* ^* r1 v2 J8 I
- static int ccnt = 8;
$ q0 e& b" } I) m
) r9 X! J8 O+ e% C& J- module_param(acnt, int, S_IRUGO);
7 |! w+ T B# x6 j# q - module_param(bcnt, int, S_IRUGO);
( h, ^) U2 g- V, ~% v' P/ { - module_param(ccnt, int, S_IRUGO);
复制代码
( d Z0 P5 {8 O# h: ^$ v4 q3 ]
; g) w9 w6 L1 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ O+ L: e' H- larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# D7 S. B+ B S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ A7 N; g, a [. I, h
# N9 h3 X1 [* j3 ^/ l$ L
7 Z0 C& H( x% _ w: L6 V+ ? |
|