|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% u4 r N. p5 |* I4 S# E. u- [code]EDMA sample test application) y6 F: t0 u8 D
- /*
: Z, j I8 F0 b4 f" F2 @1 C! b1 P - * edma_test.c, t, `0 R, E# d4 g% ?
- *
2 l4 z+ V7 v* B" z$ f! b' o - * brief EDMA3 Test Application
+ X! ?+ h/ w/ i) J - ** z) Y4 W. u' |# z* f
- * This file contains EDMA3 Test code.- F m) u5 x. r
- *
. Q, u) [5 H- e7 b) d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' S; [/ B) j( } z2 b% F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 e& d/ ~9 D m% A# L t- _ z r - * TO CHANGE.0 \- M1 A! r7 ^- v9 t0 ^$ u7 G
- *9 }1 N) }1 ?9 j3 L! t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
w# }* d( u; @4 [8 `& c - ** i" o; d& l4 U: J1 W; t. Y
- * This program is free software; you can redistribute it and/or+ K- `* b4 l/ j$ x% |: c- n
- * modify it under the terms of the GNU General Public License as
4 `6 r: C' [8 L7 w7 M - * published by the Free Software Foundation version 2.2 I$ c6 ^) ]8 z: s6 |0 A
- *
( ^/ z9 t7 P1 X2 k1 W: O7 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# ^. B- M6 g, w
- * kind, whether express or implied; without even the implied warranty
" M4 A. u! c9 r7 I7 J+ k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ r7 B/ m- h; l
- * GNU General Public License for more details.& m% ?4 ^1 y* A1 P" `
- */! C- H* G+ f4 F: _4 C
- % h$ p4 |) O* E& J% [1 d
- #include <linux/module.h>. C! o: H2 L+ o( m
- #include <linux/init.h>" a7 A9 |; _5 p6 Y' [1 v- K3 B: O
- #include <linux/errno.h>
- E. m0 g7 R1 O+ g. ~9 }' o - #include <linux/types.h>
; @1 G1 b, T/ m* m. z! c) N( d - #include <linux/interrupt.h>8 A, j! a" W1 X* ^% p& |6 q/ D
- #include <asm/io.h>
' i2 E. R1 A& d |& y - #include <linux/moduleparam.h>; \7 L+ ?: ~7 Y. w
- #include <linux/sysctl.h>
5 G/ R1 F/ h. p7 e - #include <linux/mm.h>
L4 C& |' @0 c9 w0 z1 |1 h/ U" T - #include <linux/dma-mapping.h>2 W; x5 c, f& t5 h' e% k
# I# A, R3 k7 P7 k' {4 D- #include <mach/memory.h>' f8 @$ S! {2 l6 ^# i2 v* ?
- #include <mach/hardware.h>
( [* N j' b0 o8 ], x5 u$ Q3 g& W - #include <mach/irqs.h>8 J; S3 d3 @5 `- ^3 d
- #include <asm/hardware/edma.h>5 h( e8 L- a( k* _) q
- 5 n- q" h/ a& g& ]9 N7 h% l) d
- #undef EDMA3_DEBUG% O4 d0 Y1 t8 M/ Y" a2 x
- /*#define EDMA3_DEBUG*/: f4 t: B- e* @9 Y" f$ X D
" Q2 K1 w, L, u- #ifdef EDMA3_DEBUG6 u$ {! E X" i* R5 v. c5 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# L) m. n/ I5 _% V* [' C7 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 |: @: v# ]& @# P4 v6 a' K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), |5 Z% Z$ ~& C$ q) ^5 C0 C+ _" M
- #else
/ |3 P' k, W) K# S! \ - #define DMA_PRINTK( x... )
$ L) {* F: X0 ^2 c2 I - #define DMA_FN_IN
' @9 p$ }' P1 H/ P0 g' F- D+ i - #define DMA_FN_OUT
1 g* q8 o' [" I" E* I; ~1 ^ - #endif
7 E) v4 L' T& R& X) C - * W/ _- e! y8 W6 z+ @9 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) z+ Y4 t/ G0 A4 P7 u. i# _
- #define STATIC_SHIFT 3+ I5 c" P1 m4 P- X3 H+ z; T
- #define TCINTEN_SHIFT 20
2 N3 p. T( f. f* s - #define ITCINTEN_SHIFT 215 b: |) q" X% ?# N* \- \3 K* r6 G2 [
- #define TCCHEN_SHIFT 220 ]9 ~3 G( n" p6 N# r' i& A
- #define ITCCHEN_SHIFT 23
& x6 b* U1 y0 Q! ? - 4 c$ M |7 z; d+ v5 H* C2 w( w; z6 p
- static volatile int irqraised1 = 0;
0 \& P3 s4 f, S6 b1 P. M: _ - static volatile int irqraised2 = 0;* ?5 }8 E2 Q( Q0 k8 z5 g
- 9 d# i, ^ Z$ E4 D- z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; G/ r5 s8 {. O% e% |5 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& s7 Z3 K5 G0 s2 V! S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' L# u! b" ]; X: d
- w6 I6 [* d: ]; a, y( M1 V- dma_addr_t dmaphyssrc1 = 0;5 }7 N* i* |& i# V
- dma_addr_t dmaphyssrc2 = 0;1 `* U$ N# U9 u C! {. u3 ?
- dma_addr_t dmaphysdest1 = 0;
* `& o# h6 I5 l0 g6 f - dma_addr_t dmaphysdest2 = 0;
- I, k- Q2 V5 v0 J& X - $ M: M0 R2 ]8 ~0 j
- char *dmabufsrc1 = NULL;6 S: d. [1 D7 t# \* X+ S
- char *dmabufsrc2 = NULL;6 k$ U" \; l V: J0 U* D
- char *dmabufdest1 = NULL;, T4 s! v1 ~0 X7 z
- char *dmabufdest2 = NULL;" I, w0 l2 X0 z8 h5 u3 |7 n
( G6 B$ N% O. s* k3 {1 r7 F, j, e- static int acnt = 512;
7 T/ o; Q7 f- d, e0 Y- C - static int bcnt = 8;' C. [( |6 K* ?6 F, K* }/ C9 ^: k
- static int ccnt = 8;
+ l, W0 a: p& ^! [ - / K9 z6 G" M2 r! ~, R
- module_param(acnt, int, S_IRUGO);
0 i1 q9 V6 z. n( c& q+ r - module_param(bcnt, int, S_IRUGO);
1 \0 q. s: S* F! U2 ` - module_param(ccnt, int, S_IRUGO);
复制代码
; r5 ^, ^# F+ b" J% v, g# _0 q. r; q7 l* V! y; V; O, D, U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# Z1 O' ^2 d9 o# l9 ]9 q+ Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 m4 m c4 q7 | i9 B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 N$ B% s$ J6 Z' r
4 j% i- @" w9 y3 x9 a! @' P! S: W1 U# |9 i, {- b6 |7 S
|
|