|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ S' z' h6 w. p9 e0 z6 W U- [code]EDMA sample test application! `4 q8 I# p$ S$ X. H. g% M
- /*
. M& [* @ u. G, \) I - * edma_test.c( G* |$ X9 X6 ^8 p
- *
* k5 `. I/ t) E - * brief EDMA3 Test Application$ G9 j) J3 N( ]2 u. q9 Y( F" ?
- *
4 g! @0 M+ `! ^1 U - * This file contains EDMA3 Test code.# w9 I- c$ j# |$ @" ]2 S
- *! u8 i; D* O8 M2 `9 U' B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! j3 s6 J9 G! O9 X% e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 d1 d/ ?. _1 N7 r# a! m, P/ ]+ \6 N3 _ - * TO CHANGE., v, C0 N' G3 V& ?0 R3 F/ I u
- *- x1 t9 |/ z" X) ]- ]4 | Y0 ?$ |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ]4 f5 Y7 i* B% I7 M
- *2 C2 Z0 e6 X8 F8 _+ f7 N4 `) m
- * This program is free software; you can redistribute it and/or$ L/ h' b7 \1 I! _+ w
- * modify it under the terms of the GNU General Public License as2 J( t! H+ l% V" C
- * published by the Free Software Foundation version 2.
$ L; |! N3 p: d* r - *
/ O: F% A! m( V+ I9 e/ @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 y+ i3 x5 g* Z4 V2 @5 Y - * kind, whether express or implied; without even the implied warranty9 k0 F# j3 ?' b$ J( S/ \$ g x9 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: u+ m* S6 Q; J
- * GNU General Public License for more details., x- l1 N& f4 Q3 A
- */
}8 a/ Z# {, u+ u" J
/ c$ m" P5 K$ `" k0 {' L5 L) S; D; [- #include <linux/module.h>
% B4 ]) {1 w v; q: o - #include <linux/init.h>
4 } e# h( C" K0 D* Q1 @ - #include <linux/errno.h>5 D9 q5 H8 I Z0 y E. I2 q; h V' q
- #include <linux/types.h>2 F0 i% G- K4 _- b9 n+ T
- #include <linux/interrupt.h>; R( |7 a% n) G, U! R" S+ x
- #include <asm/io.h>, d5 i% d; Q7 o( z7 b
- #include <linux/moduleparam.h>
" p Z8 M9 Q% x1 w; h7 y' _0 f" j - #include <linux/sysctl.h>
: u1 E; W0 j2 k' r - #include <linux/mm.h>( I: C; W+ l) w2 H
- #include <linux/dma-mapping.h>+ {& V) ^# ~: R' |7 r
6 L" g1 m& O/ H3 I5 H- #include <mach/memory.h>" V- y/ D% _: N2 q9 Z0 E
- #include <mach/hardware.h>
: g9 O- e( ]$ ]' c: \ - #include <mach/irqs.h>7 I) G- W. o% M3 b: t5 N
- #include <asm/hardware/edma.h>1 a2 F; w0 T' v2 R6 q
- - F5 M0 q% {, D# @) T
- #undef EDMA3_DEBUG
( v! j% S3 j6 X& q& j* v& ]7 D - /*#define EDMA3_DEBUG*// O7 J6 L# ]+ D- o |, [
- 5 m/ P: r6 x: S+ X
- #ifdef EDMA3_DEBUG
6 D0 V% s5 ]& R+ t- _; D* _( q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 U0 y C6 k& G6 Q" z! }! f2 @+ H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& b" a! P- x* k8 ]# L% W( o8 S+ m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# t/ e: u7 T0 k, A1 ` - #else- a' x' D9 l( \, y
- #define DMA_PRINTK( x... )0 q) d. ?# c7 V5 s- i
- #define DMA_FN_IN! C- ^/ ~9 a) i0 I6 I0 _
- #define DMA_FN_OUT6 ^5 e% k7 X( u& P$ R1 }
- #endif
* ]" B( [9 j! u9 H9 X - 2 a! `5 o- E$ c: }7 q; E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* e$ _; I: u5 @ s% s% F' V - #define STATIC_SHIFT 3
+ N2 y) Y" Y- V- T7 o4 s - #define TCINTEN_SHIFT 20
3 H) p$ m7 f8 b+ I" [ h - #define ITCINTEN_SHIFT 21- X( l$ f# P8 W( w/ Q X
- #define TCCHEN_SHIFT 22/ x" R$ F5 r% P& I
- #define ITCCHEN_SHIFT 23
9 l( F5 O7 Y9 A$ H* @* F; d- j4 i - ; d* J" |4 C/ b' G0 D, v* b
- static volatile int irqraised1 = 0;
" B. v& z2 h7 \* M1 H - static volatile int irqraised2 = 0;
2 b* k' d: `2 N: v3 `- \ - 9 L; K5 L- N6 n% n/ f0 s. Y0 C6 [% P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E6 Z1 Z9 Q) k* E& T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ A3 R! s) t2 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 y# Z/ [& k0 ^! v2 D
1 _# ]- k+ m& w9 g/ h. z$ c- dma_addr_t dmaphyssrc1 = 0;
0 R9 t0 K8 }, W! n# ^4 I4 | - dma_addr_t dmaphyssrc2 = 0;
& k, Q% ]& [ W$ Q6 {# t- h - dma_addr_t dmaphysdest1 = 0;
4 @# w" {4 x B- {& b! S - dma_addr_t dmaphysdest2 = 0;7 U; k, P: Y0 }6 @! z8 P
- & ?% a& Q# `9 \7 P% Z y8 c
- char *dmabufsrc1 = NULL;
3 Q& H+ G; j; \ - char *dmabufsrc2 = NULL;
! d" z3 i6 D& q; t! T- V - char *dmabufdest1 = NULL;
! S7 U6 U% u4 H/ c; D4 S0 i& n - char *dmabufdest2 = NULL;2 q; Y) @; m4 a3 F) Y' X8 \
- ]- u8 P8 l+ D7 Q! C. O( V0 w
- static int acnt = 512;
! W- l0 g- b1 Q& n - static int bcnt = 8;
0 t( J' F, r- t' ?9 j3 A - static int ccnt = 8;
3 {% s1 B5 p0 G4 D7 _
# y* G1 Z4 p8 S7 k# q: I- module_param(acnt, int, S_IRUGO);6 v, k3 h5 y- x1 W
- module_param(bcnt, int, S_IRUGO);" b+ H7 ^/ T. m# {# ^. o
- module_param(ccnt, int, S_IRUGO);
复制代码
/ E2 w0 J) f# X$ w
- x+ X& S7 N( O$ Q8 D$ T4 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# x+ ?7 F/ e3 r' \$ N xarm-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 R3 @) I( H1 }, H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ?% M4 W2 g6 l7 M
/ |, P: T0 i- p: N* ~6 J
# _& e+ j* M& k: v |
|