|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; P& D. v0 X- |$ C- [code]EDMA sample test application N7 B+ v+ A. [3 a, K
- /*
- c$ {4 M5 J( b - * edma_test.c5 L' l7 W3 Z& D7 x6 X
- *
. _) j C* w! x, ?- L( N. X - * brief EDMA3 Test Application
9 i. d9 z. o9 h - *
+ P2 L/ \; j- f [ - * This file contains EDMA3 Test code.
# }' o- v8 `; y - *
@5 d$ A: m/ P" S* f, _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 M u, s3 C$ h l: ~7 k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" z4 \, S( N# G) B! n! A2 _
- * TO CHANGE.
% ^' m5 l6 U J# y B# ?4 T$ Q - *
% D, G7 V& k& q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 u4 V0 M/ H0 T
- *
6 j7 \- f; e& V1 [8 P - * This program is free software; you can redistribute it and/or
( {$ ~0 b8 p, a: `$ ~2 ~1 j4 ~3 y - * modify it under the terms of the GNU General Public License as
0 K$ n$ W" I/ D, `. B/ d# j - * published by the Free Software Foundation version 2./ c/ B, b* w2 |6 I& p& f& z4 a7 p
- *
) e* U7 A/ \; g$ s% T9 h* Z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, b7 P' A3 c" S4 Y
- * kind, whether express or implied; without even the implied warranty
1 {- q# G n# j: `5 y( D6 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: M8 ]5 A9 }9 O9 t/ b - * GNU General Public License for more details.: D+ l9 J0 Q! w, M |2 L& _
- */
/ y) x1 X3 A. f2 }) e' p
9 C: d6 c; J0 W1 ?% H) q- #include <linux/module.h>
- E' |4 V8 C6 d - #include <linux/init.h>
2 [3 L1 ~9 g d4 w- o/ ` - #include <linux/errno.h>
8 z7 o* w4 x' w9 m E' \( R4 F - #include <linux/types.h> U8 u4 }; W; j+ z! X, P
- #include <linux/interrupt.h>" B8 P* K B1 V' _; e) i
- #include <asm/io.h>) q6 f0 d+ Z. h8 K
- #include <linux/moduleparam.h>
; U/ s6 J! L" k* R9 _; @8 [ - #include <linux/sysctl.h>
0 i" p# V. @# K0 J9 Z. `2 ] - #include <linux/mm.h>( Y' N0 X0 k) F0 y( ~' Q
- #include <linux/dma-mapping.h>+ U5 y5 K, H3 s* o0 k, s% [
" R) b0 R2 ]2 J0 S e" `- #include <mach/memory.h>' ?5 j9 g( q3 l8 ?5 q
- #include <mach/hardware.h>1 |7 @: D U i6 b G7 C
- #include <mach/irqs.h>3 w( b+ p5 m) R6 K1 x
- #include <asm/hardware/edma.h>
: {+ V! e' [) f& j# \+ W - ! Q; V+ U. l& k5 W. j
- #undef EDMA3_DEBUG
5 g( H2 m8 v+ J0 ] - /*#define EDMA3_DEBUG*/
3 f/ M; N: i( {7 L& W- { - ! N5 _3 C! M+ z% d* p
- #ifdef EDMA3_DEBUG
% \' T6 T# t$ X5 y5 I3 K2 e3 C. n5 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), _9 W+ B: N: Z! r4 R5 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ d7 L j/ b; h% }3 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 v! j" q4 e; Z1 d" y0 @; N4 i' B& E
- #else
( Q! n( z3 b4 F# u+ R9 u - #define DMA_PRINTK( x... )$ {9 c! V# e% N9 E
- #define DMA_FN_IN* f' i. u1 D" z/ S' y( b
- #define DMA_FN_OUT# D2 P: y/ p9 @$ _
- #endif2 r, B7 H7 g) V! ?0 P
- * f, K$ ?1 _# B8 B6 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 w2 H3 |, |1 X/ ~6 r. i - #define STATIC_SHIFT 3$ F w0 P' i/ Y% U1 Q! B( d0 e
- #define TCINTEN_SHIFT 20
7 ^6 @. c( u! w' k1 M - #define ITCINTEN_SHIFT 21, m- f; N0 G% q
- #define TCCHEN_SHIFT 224 }5 o5 n7 y% z0 p. k
- #define ITCCHEN_SHIFT 23
/ j% a5 u8 `3 ^0 I - ! l p6 y. l# [2 V( D- D
- static volatile int irqraised1 = 0;
1 O' L0 X2 E4 S' C; ~: N - static volatile int irqraised2 = 0;
* P; Q" W9 c2 u- j6 R4 y& t
8 Q3 D4 p' e4 m o4 x, C: l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ?5 W! h1 N6 l: S; f9 J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 [( M2 Y. f* _0 `7 `9 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! d3 y! P& K; |2 L; H5 g
- ; M) A. Y( c3 J0 Z
- dma_addr_t dmaphyssrc1 = 0;, J/ P( k. {, k
- dma_addr_t dmaphyssrc2 = 0;
4 c5 z6 T3 J" T& z9 z - dma_addr_t dmaphysdest1 = 0;6 @( Y0 z$ I6 F$ B
- dma_addr_t dmaphysdest2 = 0;( ]$ J% `( [! T- R% [$ n
, e2 ?. x5 e$ T! c$ T- char *dmabufsrc1 = NULL;8 w% p5 M J, B2 G' {3 I( }
- char *dmabufsrc2 = NULL;6 `+ Q9 V) f. c0 ]/ O
- char *dmabufdest1 = NULL;: z# d: o# K5 n" x8 f
- char *dmabufdest2 = NULL;, ?+ z6 u5 ^ j* ?
* K, O, D. Q6 {3 a: T- static int acnt = 512;
! d1 Z6 m$ z* L4 `/ X - static int bcnt = 8;
& [! V) z1 c4 Y( Q% t& h5 Q' e - static int ccnt = 8;
7 J, E( P5 J" i% @2 R* {. g; @# g - 7 N3 C) J7 s7 O6 m
- module_param(acnt, int, S_IRUGO);5 _, W y* ~4 f# L! d
- module_param(bcnt, int, S_IRUGO);. z( y9 i! K! G5 }" p7 p
- module_param(ccnt, int, S_IRUGO);
复制代码 $ K# @. V; q1 L% R M6 C# F
& j/ e. L& U, W) P, j2 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* H! c) ?' x6 {7 A1 Carm-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 l8 ^1 ?# x; q$ |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 A+ u# a7 X+ r9 Z: l S& m
* ^6 I+ a5 B |" q0 g
- `0 e/ b w' P% O7 P" d9 ?
|
|