|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' H! n7 g& d2 `' Y# m* i# R
- [code]EDMA sample test application/ A* m1 E3 l2 j2 ?4 P
- /*0 @# S" C; ^3 r# d5 n
- * edma_test.c
% P( `- ]/ L9 ] - *# w. f2 M5 h7 C
- * brief EDMA3 Test Application
8 b* J m, ^* d/ A - *
2 p+ j/ M& `: {6 }; C# ^ - * This file contains EDMA3 Test code.
& F" R6 D. {0 \1 U7 w( G - *5 F' M: i! v% X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 K1 z2 P' c+ V. y( `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ q% h4 ~5 w# b7 x
- * TO CHANGE.0 \8 K/ k- X7 m& }
- *
% S9 R" z) k( m: {7 l0 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, J7 t6 A# M3 X7 i Q3 Z/ b - *0 V* p$ y( G2 e Y
- * This program is free software; you can redistribute it and/or/ I' P% O/ ~9 b W+ o3 l* y
- * modify it under the terms of the GNU General Public License as
: h% H+ j7 X' t2 L& T* W - * published by the Free Software Foundation version 2.; `( X$ h5 H" N5 q1 ~! x9 b
- *
7 W* @- Y: f6 d% R/ l+ J2 x* J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 D5 w- B0 m7 m3 I - * kind, whether express or implied; without even the implied warranty
& e' d4 o: d+ _2 G; d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. k: _6 f$ T9 l$ V& {+ N1 c4 t( ]
- * GNU General Public License for more details.% U% R- x. P1 c$ }0 _; `
- */
- a f. B- n" H! b
7 l+ M) [. g6 _, J4 p# u- #include <linux/module.h>( Y+ ]$ e' h5 e. ~9 h
- #include <linux/init.h>
; L; M* s# v1 N$ r! s# u - #include <linux/errno.h>
% K% i7 u$ r) O+ W5 L8 W$ _( N7 n - #include <linux/types.h>) j! ]( J0 X. a1 j j4 `
- #include <linux/interrupt.h>$ H4 y5 e3 A& u, `# ]5 F
- #include <asm/io.h>
1 c: W4 [4 ?9 b( p; k - #include <linux/moduleparam.h>
: i5 I: d8 U( F$ K2 g+ Q+ z6 k - #include <linux/sysctl.h>
7 H1 ~3 x) q+ Q7 S6 A - #include <linux/mm.h>
# E* J) S J8 s$ e - #include <linux/dma-mapping.h>- z4 W! a6 h' u6 a
3 V* L' t4 R* I% [/ C: n- #include <mach/memory.h>
# U. V. x% T0 ^, e. f - #include <mach/hardware.h>
6 r" E8 `% b2 p: \2 w* G* x6 J: D - #include <mach/irqs.h>
: }& a+ p* O: C - #include <asm/hardware/edma.h>
6 D; D0 Q3 Q+ `- N+ h2 a" r
( ~! e( d+ b- h4 J+ c- #undef EDMA3_DEBUG: R. C8 E4 h: D( L! |! Q& u
- /*#define EDMA3_DEBUG*/
8 C6 T4 M" u1 p - / s- K. ` f1 V3 d* c, m
- #ifdef EDMA3_DEBUG% m2 P, `/ a+ I' @0 C- }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' v. B( |# n5 B; [. @6 N% H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 R2 M; |% M+ m4 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, P, N% k6 j' _ - #else- h, W) d' @+ g
- #define DMA_PRINTK( x... )
$ a0 `( L# y5 P) q0 B - #define DMA_FN_IN, R5 C1 ^) X' `, ?
- #define DMA_FN_OUT7 G7 j, P; o/ u! |) t
- #endif
6 h+ e2 h& W4 m - ( X$ {" O8 |8 @: ]' F- m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" Y& a9 @* s9 N, Z4 ^ - #define STATIC_SHIFT 3
# u9 O% ~- M/ T: B1 s+ c9 [6 M - #define TCINTEN_SHIFT 20% I* X( z: Q9 T) H
- #define ITCINTEN_SHIFT 21
( h" `9 m* y0 a q - #define TCCHEN_SHIFT 22
* ^& X. x. Z& H2 q - #define ITCCHEN_SHIFT 23
8 P- f7 j- r! Y) D L
+ \2 p& q+ \% {0 h& F" {0 Q; B9 w- static volatile int irqraised1 = 0;* n& G% h9 O( @# S
- static volatile int irqraised2 = 0;9 p5 A- V5 [+ X3 w
- 6 { E% Z/ a+ x# Z; `8 T. ]: |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* f: V. X3 I9 X+ \6 p! L: t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Y4 d( x: E; z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* A( g/ q) h8 x( ~3 d) M5 P0 S
& N. Q# V* m" ?0 l3 x2 U- dma_addr_t dmaphyssrc1 = 0;
" l1 B; b) e' H* J6 @' i, O - dma_addr_t dmaphyssrc2 = 0;9 d6 `+ T4 B# D& y2 E/ J
- dma_addr_t dmaphysdest1 = 0;0 Q, i% p* p/ k- y1 }1 c: R6 j
- dma_addr_t dmaphysdest2 = 0;
4 |; Q+ d- `+ a( U+ E' p7 ?0 R - % _7 S: j- q% J5 K& a: R. |: i
- char *dmabufsrc1 = NULL;
# ]( H2 ?0 O$ D+ o: y+ W& l4 g - char *dmabufsrc2 = NULL;* R! v3 N2 r# w' A, c
- char *dmabufdest1 = NULL;
: J8 \/ h, z# N3 `2 j/ w# Y% ~; P - char *dmabufdest2 = NULL;
" o* e( R3 Y$ ^4 W$ V
4 l+ F+ K3 D8 r- static int acnt = 512;: L2 M6 Z$ z0 Q& f( g
- static int bcnt = 8;
4 r# F$ Y5 W( R, Y7 T% |( z4 Y - static int ccnt = 8; v4 d x# _* z- x* u1 ?
* A4 O9 {+ ]0 @& ~% P8 _- module_param(acnt, int, S_IRUGO);8 k0 A7 z9 e; n0 J+ `5 L' s( Q2 I, }
- module_param(bcnt, int, S_IRUGO);3 B+ [' z5 n$ d& ^
- module_param(ccnt, int, S_IRUGO);
复制代码 , s0 ~2 R. ?8 l, Z W& V
: @& `: m" i0 V3 J; L0 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) O+ ], t0 O2 E; H5 r, q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: {9 C& ~6 c6 L$ h3 b0 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 k) H _7 |$ o+ D2 i4 ?: [+ \7 @6 R6 `
% ?6 k8 P+ l% M! ]1 E
|
|