|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - s2 z' N5 F6 L7 ~& C& i, Q
- [code]EDMA sample test application' _1 B& Q) Z0 \3 ^' R3 p, V
- /*
0 C0 X6 Z. i2 q5 A1 c+ ^ - * edma_test.c
6 U6 u9 E: E. I# L& \8 D - *
" `7 L/ I1 x' K. O' |7 X - * brief EDMA3 Test Application
; A4 I, o! e- h* z5 Q - *
: B1 P+ N* w9 k8 Q, { - * This file contains EDMA3 Test code.
# Q' {* a' U: e) C" v& F+ K) T& a - *5 E' S+ y9 j6 ~8 {. G/ }8 F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ L7 P8 \9 p5 G( t4 a6 Q* b/ Z5 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% x& L7 E) u: t# i2 \! M - * TO CHANGE.& Q# H9 y1 p& X/ @: h
- *
. P9 ~, X5 F& F4 x+ r6 q6 w1 G: ]! L7 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& z+ ~6 ]% j0 i' x5 Q' t" O" }
- *
1 V, i6 v% {. T7 p7 E - * This program is free software; you can redistribute it and/or- X! F) j; A7 ?3 o! T4 S* ^8 ~
- * modify it under the terms of the GNU General Public License as& P- M3 Y) d0 g) G5 K
- * published by the Free Software Foundation version 2.3 p8 Y1 P! \' h/ k, w
- *
3 y: C, a& c/ }6 o! c# F% v# P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- Z, V) K+ S* v - * kind, whether express or implied; without even the implied warranty
' V1 W# ?# a7 Q1 j7 D7 [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 u- l" Z0 _$ L+ m5 [& Y
- * GNU General Public License for more details.
. {' h0 }5 m7 _0 N - */3 _; w I& v% K1 D% y: G% T
- s: @5 L# o' o( m& w8 j
- #include <linux/module.h>
% } M5 w8 m! `$ K - #include <linux/init.h>/ d# D/ r) F/ Y: p" h
- #include <linux/errno.h>8 S" t5 Y4 q3 r8 ^5 Q' ^# |* {4 |
- #include <linux/types.h>
P& D' p! ~7 f7 o - #include <linux/interrupt.h>1 ]+ r# h! w) a5 ]
- #include <asm/io.h>* i2 M7 i2 F8 W3 Y5 {5 F
- #include <linux/moduleparam.h>2 D- n: E# a* ?
- #include <linux/sysctl.h>
0 P9 C* w& S# \, ^+ x1 ]- W - #include <linux/mm.h>1 o- M: [) Q' r0 I$ H4 U
- #include <linux/dma-mapping.h>, _ [ h7 c9 r- R, Y
' U& q+ a9 z7 P) b. M, B3 W- #include <mach/memory.h>! U2 y6 F$ b( z: U+ M
- #include <mach/hardware.h>0 S( h( ]: N. g9 ~
- #include <mach/irqs.h>! h. T7 S5 q$ H% a) E1 w
- #include <asm/hardware/edma.h>! f* L9 o$ p8 n# G5 n
. [4 I& d2 g( k/ H! {3 [& r5 L+ ^- #undef EDMA3_DEBUG
% O0 X/ p4 J1 ?9 K! X0 Z9 ^ - /*#define EDMA3_DEBUG*/2 F E. [8 `" G7 L
! H& J3 N8 J; ]3 _4 T5 w# K- #ifdef EDMA3_DEBUG0 G. A: v# S) V+ I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 W5 i$ P5 G6 H. `' W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ B8 c8 Z4 K; b0 Y# J* U) X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ j: R1 `2 v1 [ - #else! S- q% ~ B/ n$ y6 @8 U
- #define DMA_PRINTK( x... )6 h% s' i( G1 w3 Y+ ^' Q
- #define DMA_FN_IN
^$ P4 H. \1 x+ r - #define DMA_FN_OUT) @, L: c) U9 F2 f* w# a
- #endif
- @/ R, w7 ]) C/ t/ I+ w" p9 m* Y
/ e9 ?. v+ U! O0 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 L# `) s* \. y* {
- #define STATIC_SHIFT 36 t7 R& _0 {$ e& _. f# C6 y' l
- #define TCINTEN_SHIFT 20 _2 X. [( {( p' q$ C- a$ p! B- c
- #define ITCINTEN_SHIFT 216 h; ?% t$ j5 z) k1 G% `% @+ |
- #define TCCHEN_SHIFT 22
u J1 b# N" O - #define ITCCHEN_SHIFT 23
8 ^. Y' e$ ?+ v( ? Z4 T - ! E ?+ s3 H/ ? r/ {) a
- static volatile int irqraised1 = 0;3 ]( ~' C4 J7 ^5 R$ R
- static volatile int irqraised2 = 0;
+ P5 |0 W7 g+ c: t4 B- ] - U% X+ r* X+ p/ G- H( ?- N- c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. x$ y Y) Q" D6 i) x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 `" J+ M9 L @% N7 O) n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 N/ a$ c4 N/ C7 i - . I; C" H8 @/ i& ]6 _; a
- dma_addr_t dmaphyssrc1 = 0;
2 ?- R; g$ r$ C+ @. n: R - dma_addr_t dmaphyssrc2 = 0; v ]! ]# s, u) q
- dma_addr_t dmaphysdest1 = 0;0 Z$ b7 `# P3 l/ s
- dma_addr_t dmaphysdest2 = 0;+ F3 u% R4 m# B% l( K4 q% B
- 0 }4 e& W! h& B+ J( ]) L* l
- char *dmabufsrc1 = NULL;7 y4 p" P/ M; i/ ~ E) C0 j
- char *dmabufsrc2 = NULL;' [& t- l$ {0 }0 K0 G
- char *dmabufdest1 = NULL;
! b1 t8 C5 r, c1 a4 M3 I - char *dmabufdest2 = NULL;& L$ w2 B+ H ]5 I
( _, f2 k# a) B5 T0 D: _- static int acnt = 512;) D0 Y5 d B3 G7 [ g! O6 z
- static int bcnt = 8;2 S- z/ d) g- T8 @) m
- static int ccnt = 8;
0 p! n! Q8 I. g$ v! J
* u. ?# Z5 T5 u4 w- module_param(acnt, int, S_IRUGO);7 {) b! ? t/ v ~
- module_param(bcnt, int, S_IRUGO);
) U% E: F# v0 k- {9 m, { - module_param(ccnt, int, S_IRUGO);
复制代码
3 R: P* L9 V7 Z# U; w d3 q
4 O( N3 J8 d' ^/ Z+ V2 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 {) M" Y- U2 R F: }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- ]8 m3 U) b; w' P- @% }" r8 b- ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: c0 A" E4 u e1 z( Q* ?) _
+ ]7 n* r W: R# x" U1 e
. C! h% M! g2 z! V4 t |
|