|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Y* ^1 F* {' P* U4 D- A
- [code]EDMA sample test application
' @' s. i0 R+ z0 E - /*
1 E- l+ b- {& M \1 v - * edma_test.c
0 k2 x7 `* u" \0 E - *9 [/ j3 D; `* {* V
- * brief EDMA3 Test Application8 p/ w1 A5 d* g) l" S
- *
' o! F5 I+ v# ^" n7 O4 A. { - * This file contains EDMA3 Test code.* a4 ~4 S* _1 ~$ h
- *
+ p. B2 r& e/ z1 O- e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 k% D6 z' ?9 [$ a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: d" F- _ j O, T) N3 ?2 K - * TO CHANGE.6 K6 b+ z' L/ `8 V/ [: r
- *
2 w# Z1 z! V6 @ c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f' a5 A: j$ ~( V
- *3 i8 s7 Q- I6 \2 @, ~/ Y2 ]8 v. ~, Y
- * This program is free software; you can redistribute it and/or
+ I1 G) p R3 G; ?$ f - * modify it under the terms of the GNU General Public License as$ g& ], |- b7 n5 e+ f, g" _5 F
- * published by the Free Software Foundation version 2.+ [# b) O% s0 Q" ~
- *7 X' z6 P' M0 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 V5 C7 u6 o: G6 @
- * kind, whether express or implied; without even the implied warranty
h3 D& u- a4 k0 t* | f% ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 d$ N# F {. M* n, a
- * GNU General Public License for more details.
5 q! g( \. y0 j7 ^7 v# B) W) o9 g - */
. m7 ~) _- [8 J - ( G% q r2 }9 r9 X: W: W A' z1 V
- #include <linux/module.h>
" s0 X; v2 A& I - #include <linux/init.h>
2 b" W0 N) ^0 i4 _( r - #include <linux/errno.h>; n+ f; D2 T( l1 H- `8 S* p
- #include <linux/types.h>
" K8 h% U' N* k- }' L3 W5 M; K - #include <linux/interrupt.h>5 M S4 m2 z2 Z" D, }" o7 D3 ^9 W k
- #include <asm/io.h>
% y4 c8 |7 t1 s7 }' d1 n1 K+ P - #include <linux/moduleparam.h>
/ I2 Y4 ]1 F7 r6 a' v2 {$ K4 F, K - #include <linux/sysctl.h>3 X! D, x- j! E, P' B' q8 [8 n2 Z
- #include <linux/mm.h>9 T- G# a$ g8 ]6 Z1 t0 _
- #include <linux/dma-mapping.h>
1 }& D0 T3 B. j: F - # f. n* G" e/ X' q* h8 {
- #include <mach/memory.h>
3 |1 ?% Q5 S" W: b. Z1 n - #include <mach/hardware.h>
. O' P8 D* @& p g - #include <mach/irqs.h>
& s& q" Z: l# e - #include <asm/hardware/edma.h>
3 e8 O7 U9 V5 m9 E - . r- u- E$ Y9 N
- #undef EDMA3_DEBUG# m X" P2 [4 e M: T# a
- /*#define EDMA3_DEBUG*/
9 Y" p( w, w* v$ w8 U& f" ^# f - ! j, c3 i0 t% D
- #ifdef EDMA3_DEBUG
# |+ A4 r9 r9 O/ N) ]- G" n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 v6 f" Y8 H2 y* ?( Y/ s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! B; }+ n/ h$ Z) |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% u: r4 q) s4 q) T( D - #else
0 o' F) V; s( q% e# g - #define DMA_PRINTK( x... )
4 Z) M, `& L0 I( C: k* U - #define DMA_FN_IN
2 o7 v' Q( G/ F5 u; f - #define DMA_FN_OUT& C0 E! x- O6 i" e
- #endif
. M: p% @3 W! o
9 a" R7 I8 O& o, ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% x7 k1 L2 e/ Y - #define STATIC_SHIFT 3
& d. y, \7 Y) g - #define TCINTEN_SHIFT 20
0 z0 J4 I0 A, v: [ - #define ITCINTEN_SHIFT 21/ v$ t7 ?$ f- m j, s: N9 G
- #define TCCHEN_SHIFT 22, v+ t4 ~ G3 A; }7 |# ?# f7 F
- #define ITCCHEN_SHIFT 23
5 G' I6 g4 L. M. X! D+ R - t6 m( Y3 B" } o9 \- n
- static volatile int irqraised1 = 0;, o! q9 ~( `$ V4 U6 C/ F9 M
- static volatile int irqraised2 = 0;
" o, a" H% F4 X8 _ - 8 G+ S: G6 y' u/ \# B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h4 f/ S' j: M* p) G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ]: N. o# I; w. m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i. T% M8 x0 |, ~* s* {
1 M* w) _! {7 c- dma_addr_t dmaphyssrc1 = 0;
$ s v6 X+ L6 a& a9 r" F' M - dma_addr_t dmaphyssrc2 = 0;' j2 N S: O! S" s. W" n3 T+ S; I' m9 C
- dma_addr_t dmaphysdest1 = 0;4 Y& ~3 ~# K( f H! @
- dma_addr_t dmaphysdest2 = 0;9 ?" w7 A( h' W% A0 @
5 `9 k! ?2 D" @- char *dmabufsrc1 = NULL;- O$ G/ j, |4 v; z. X U q
- char *dmabufsrc2 = NULL;
( ^4 J2 [& ?7 C - char *dmabufdest1 = NULL;
# u6 C9 \9 b$ V m - char *dmabufdest2 = NULL;9 j( p' i3 P4 S: n( k* X& K" l( G
- l5 B( o* u8 y' D; k! w- static int acnt = 512;6 Y% ^0 ]% M; j+ e) ]5 e% _+ F+ H
- static int bcnt = 8;' M5 x) K* ?1 u3 W* U% }% F
- static int ccnt = 8;6 J5 G5 M& R$ g3 S; r9 l4 Y, {
- : G/ C/ ?3 u S
- module_param(acnt, int, S_IRUGO);2 {0 a9 @$ C7 s1 H0 d: u5 n: ]4 ~4 t. f
- module_param(bcnt, int, S_IRUGO);
8 u% g e7 J; B |% O L. @) N - module_param(ccnt, int, S_IRUGO);
复制代码
) |# a! d4 I" R
8 \. u1 {$ O5 K" |9 Z0 h: ^& V6 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 L: S- U! {! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' L5 X3 y, @! C1 u; A* Y v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ N, L9 ?5 Q1 o0 [+ m
! U, G% ?0 t1 U- c3 Q' L3 z/ k4 N, _, ]9 ^1 m& Y a
|
|