|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) I+ C6 ~) ^6 l+ m+ B0 u6 g+ |
- [code]EDMA sample test application
6 |4 c! ^# O0 D1 k0 ?# Z - /*
% x7 P5 x9 N; f. c( a, a - * edma_test.c. R R3 J' Z; e% [* }( y
- *5 o1 c. ]: T- M0 r8 m
- * brief EDMA3 Test Application" A& A0 |! W! G7 p3 Q! R) u4 w5 ^
- *) |* g' q. u, Q% k {! N9 l
- * This file contains EDMA3 Test code./ P$ n% S$ N& Z$ x/ ^: i" g
- *! U6 W% r. k' E6 p" w2 q, l. v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" I& C. E/ J( o6 g" u5 W4 W; f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
G1 y/ }0 K; B" U: S - * TO CHANGE.
: f0 K) [! N+ B/ `" ] - *
' c( Z; S- L A# Q( X' c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// M1 P1 |4 {0 f( x& q1 |3 V
- *
5 J, @# [/ A8 Y - * This program is free software; you can redistribute it and/or
: i( y( {' z9 M - * modify it under the terms of the GNU General Public License as3 y6 x9 m, c r3 T2 s- j
- * published by the Free Software Foundation version 2.
: `, V% D9 t( u0 F' z7 B5 _. r7 i - *
# R8 h* x& W3 X+ o( ^) N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& |! \( V$ |. a% Z) n/ _0 r; E - * kind, whether express or implied; without even the implied warranty
0 c- f5 C* C+ i. s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 m7 D+ U$ ~; O) R2 l1 z* K- F
- * GNU General Public License for more details.! v( ?. e2 \' w2 |9 x3 U0 J
- */2 j0 O: n6 R) h( }; T1 X: o
" f0 Q5 I4 G7 n1 T7 T5 c) R- #include <linux/module.h>/ N. e( {# B' w# |; ~: v
- #include <linux/init.h>, O6 {: g) }% r Z" S
- #include <linux/errno.h>) k+ n- N9 Z! ^, w: Y
- #include <linux/types.h>
( d# c2 i; V. y4 e1 P - #include <linux/interrupt.h>
6 H2 L( c7 z; a2 k9 g- R$ d - #include <asm/io.h>, @/ E- {1 ~9 u6 C4 |1 W. P& f
- #include <linux/moduleparam.h>8 J4 a; D' m. ~' [1 ]
- #include <linux/sysctl.h>
* c: a5 Z3 w" m- B3 n# S - #include <linux/mm.h># @- Z2 N9 b) |+ H1 g1 p% q; I: w
- #include <linux/dma-mapping.h>
# ]" l! C# C( l% N- C8 n# e1 E
; m7 j; c# N# [, ?' [6 ]8 J+ m7 _- #include <mach/memory.h>! d. s, O7 _% y, w/ g4 P! ~2 M; i, _
- #include <mach/hardware.h>
7 e2 A1 D4 X% V, ^1 h0 L4 E+ _ - #include <mach/irqs.h>
. @8 K4 X9 @/ ]" L! m& H3 H9 n+ c% ? - #include <asm/hardware/edma.h>
$ i. U( ]8 S* J4 f5 R - 9 k* Y$ B4 z3 @9 a9 ?: a- r
- #undef EDMA3_DEBUG
4 W4 i- v0 x- R. ] - /*#define EDMA3_DEBUG*/
4 X1 ^; q' M6 i9 }' c- i( i' a - , j( k* P3 m5 r6 N
- #ifdef EDMA3_DEBUG6 H3 ~# s' c2 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' c$ z8 L1 s& L- L$ ]) @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( L8 r1 w% j( R ~. N( Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" R. Z* m5 c4 N u- R
- #else
( N% r: }/ s( ~* D' S - #define DMA_PRINTK( x... )
& H0 `: M% v& S/ s% v/ R3 [) y - #define DMA_FN_IN E/ t* n' V' l6 @1 g T8 b* C) _
- #define DMA_FN_OUT$ x0 q% G& o2 m2 [
- #endif# Q. @/ A7 k6 B
- 7 z& M4 G& }: i1 n. J4 b L Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* D3 O' q7 y3 s* u, p$ O0 j( T
- #define STATIC_SHIFT 3
& t D5 \- ^4 L: N, l$ M& Z - #define TCINTEN_SHIFT 20
( S, L# w: i2 t1 Y1 a - #define ITCINTEN_SHIFT 21) c6 j$ R( ~4 ]3 v3 a
- #define TCCHEN_SHIFT 22
" v; K' P2 H' S% L, ?) D: {6 U; Q - #define ITCCHEN_SHIFT 23
9 }* r+ |: \9 A6 U6 w: M5 \ - % x G/ S. ~9 x) q9 l
- static volatile int irqraised1 = 0;
, p' k; N/ X" |& \ - static volatile int irqraised2 = 0;2 ~/ F- r2 Q* @' s' D$ }
- ) F$ |5 x4 Z* s) a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' l/ O# T" ^, y/ k, l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ N+ N. h/ b& F) Z0 ^0 A! Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 u5 o& b$ E) c* ]9 L. O - 4 u; U( r1 d1 K4 @" O( E
- dma_addr_t dmaphyssrc1 = 0;; N# h4 x w/ }% M( h
- dma_addr_t dmaphyssrc2 = 0;8 X0 O" R3 K$ J: P9 W# i
- dma_addr_t dmaphysdest1 = 0;: ?# Y: f$ q. w8 |9 D
- dma_addr_t dmaphysdest2 = 0;1 ~$ V4 X, Y3 M) Q, p2 ]) L
1 Y' i. C" D/ A1 F( D6 h- char *dmabufsrc1 = NULL;
- I4 [8 @3 T) C, \6 M - char *dmabufsrc2 = NULL;
* `# ^/ l% |* V% }" n - char *dmabufdest1 = NULL;
' e" ?* X' V! t1 `( W& ] - char *dmabufdest2 = NULL;3 y) F9 k3 I/ X2 t
; M3 L1 o x7 }% o. e- static int acnt = 512;
& S" a7 v; b/ `1 ?. ^" _" Z% D - static int bcnt = 8;
7 `- J+ ~4 U* F' i4 R6 O. O' \( S - static int ccnt = 8;
1 q4 K1 P0 N- `5 b$ t( l9 [
2 G5 o# P0 }8 j9 }- module_param(acnt, int, S_IRUGO);
% w1 u5 f' J0 _' r+ [% E9 R: E - module_param(bcnt, int, S_IRUGO);! C1 Z7 n) _8 B$ E
- module_param(ccnt, int, S_IRUGO);
复制代码
& ^+ H F. P0 B- b+ g5 m* ~% P- U9 ^& Y- d$ R4 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; S h( c: z$ ?2 q0 G3 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; M2 V' S) P; u: w0 u/ C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! i+ h' N7 | X+ \7 K( M: l9 l( O/ H6 a2 D
# T2 v0 O) i% F4 P
|
|