|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* s0 r1 k& g1 p r2 I6 d- [code]EDMA sample test application' O/ ~8 P4 I' A; k6 Y
- /*; s' T7 N# m- p+ j: k) M. l
- * edma_test.c, x4 R$ T- F' y. z( Q# G4 j
- *
9 w- P/ F4 M0 q" |% b6 a" D) B3 v - * brief EDMA3 Test Application- R4 I/ H3 X: w9 O
- *
, N1 n" \1 H7 A5 ^ - * This file contains EDMA3 Test code.
1 J1 ?6 w( J' _ - *
& I, l1 F. u, Z( a" y! R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE R9 G7 {7 V9 }( U' z* H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, s. E& ~. e! i - * TO CHANGE." V5 a; E6 v+ Z- h- `! Z; u
- *6 y% n% g3 C% r0 h2 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ^" f, F' G; o8 u4 n- p - *7 K9 n9 c, V9 D! |) _: W
- * This program is free software; you can redistribute it and/or
% ^6 @1 Z9 L4 y2 W/ X1 m4 D - * modify it under the terms of the GNU General Public License as
. L6 d- f- ]/ {! a - * published by the Free Software Foundation version 2.
6 ]: S' J+ N: D3 J) g$ K" v. J - *
8 A9 [8 X, @* Q6 L4 l7 r) ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 q2 p) f0 w1 G2 P8 q
- * kind, whether express or implied; without even the implied warranty4 M0 L4 [# k" u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ c4 m' k; q- R7 B - * GNU General Public License for more details. d. x$ s. P2 v2 n. v E
- */
0 l4 V$ n3 ~- q* z+ j( d; V - 0 v5 b4 s' R$ _( i) e. J G
- #include <linux/module.h>( z5 _- k, |. H' A( |
- #include <linux/init.h>
! R* D$ E- |/ A - #include <linux/errno.h>' h; j2 t% N k
- #include <linux/types.h>
7 r8 a* m3 H3 f f1 f' i6 o' V7 P6 c - #include <linux/interrupt.h>
. a7 w7 G) @: _. r1 k - #include <asm/io.h>
8 U. t6 {) i$ E9 n: z - #include <linux/moduleparam.h>' g4 q1 R; x0 C1 ^ p
- #include <linux/sysctl.h>
, b1 z0 q& h$ h6 ]# Q8 h/ l. Q - #include <linux/mm.h>
) T8 @# \. Q, m B - #include <linux/dma-mapping.h>& \. P. F0 U9 U( [& K j
$ O8 T1 d" x* f2 P# W, m9 ^ H- #include <mach/memory.h>
: Y) c0 E: Q# N& d2 w$ V0 g - #include <mach/hardware.h>9 V. j- `, i) o+ X: K6 t( Z
- #include <mach/irqs.h> J* i: B4 a# x" F/ b& U
- #include <asm/hardware/edma.h>, v6 l5 h ~$ W# q/ T
- - ~- E& i, r2 G& U6 m
- #undef EDMA3_DEBUG; p' z S$ a4 A% u2 d! _7 }/ S* \
- /*#define EDMA3_DEBUG*/! S. ~9 ?+ }% e2 h8 s/ e5 V
- 8 J6 q! j) z9 P2 S2 C% N ~, n, i& z
- #ifdef EDMA3_DEBUG
0 K) [+ [* s" y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% l& s$ T" q$ f& }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 H) H$ }& d) S `1 c3 N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' l. y9 P/ ~9 Y. n3 ~, k! M# L - #else/ l: u& z" k/ Y/ c6 Q5 N, a+ F
- #define DMA_PRINTK( x... )
$ M+ w8 X* o+ s- r* E# E$ E - #define DMA_FN_IN
' P( r B) j: m6 P5 o0 H$ c4 E - #define DMA_FN_OUT
! k- `# h# x# W1 A/ M - #endif
7 m* e& b- Z2 \ c - , O; t, S& p' ^ P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ j$ u; c) V4 ~) m& M - #define STATIC_SHIFT 33 l) r2 Q6 u* j g7 l
- #define TCINTEN_SHIFT 20( ^4 M1 A( O7 g4 @6 w3 e% I! `) X
- #define ITCINTEN_SHIFT 21
9 c3 O& }7 p) e |! y# g0 n9 @ - #define TCCHEN_SHIFT 22* g1 U5 } j$ Q
- #define ITCCHEN_SHIFT 23! i5 Y" b/ }5 D9 u) m' B6 F
- : |! e& x2 l) i2 B
- static volatile int irqraised1 = 0;
. P: f/ G7 r0 A" w4 f( p - static volatile int irqraised2 = 0;
) H. n# r- x* P3 I - ) s/ X; g* i" b" y+ k/ y4 w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ^9 r; F9 c/ D" J2 p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% E2 K: J; c2 t, n( ~" ?3 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m, D& W8 | n& H) R6 W
- 2 \, O: i0 ~4 h8 G" J# u$ p
- dma_addr_t dmaphyssrc1 = 0;
0 A9 h) [% {: L# t: m; N - dma_addr_t dmaphyssrc2 = 0;
1 ^: u1 G9 \) d* I8 U, z - dma_addr_t dmaphysdest1 = 0;
2 b4 \8 `9 Z3 n7 t! [ - dma_addr_t dmaphysdest2 = 0;
+ K# T0 ?+ K, L& K6 j; u6 L - 1 P9 R8 b1 K- e& U
- char *dmabufsrc1 = NULL;
2 X6 A7 u( g, e! v7 t; @ - char *dmabufsrc2 = NULL;
* n- f5 Z1 I5 } - char *dmabufdest1 = NULL;
. g/ p( r9 E/ [9 f* ^" p [ - char *dmabufdest2 = NULL;: R8 r# K6 C4 Q! `
- 7 B/ c8 F# j/ Y; c
- static int acnt = 512;5 B0 b, e' I& c# D
- static int bcnt = 8;9 T+ e; @) A/ s8 E3 Z. X; c
- static int ccnt = 8;
2 Y% B4 ?6 T. p; O5 f, r2 z
& |$ {' w6 @* D" j- module_param(acnt, int, S_IRUGO);
" |! ^; v* x/ f - module_param(bcnt, int, S_IRUGO);
8 r( |$ U. \3 `, n7 M - module_param(ccnt, int, S_IRUGO);
复制代码 & q* d+ T7 r% l1 [! B f3 c8 l
" B5 s6 @+ v& ~0 H/ |8 e+ | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 w& R6 r; V3 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, t; R4 L9 i1 H6 y2 ? T$ y! I# q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 H% z) U- ^4 H: V
# E: f) i5 E! @7 D+ d
: D: m9 d, ~. b0 D) P6 M5 c |
|