|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ ^- `* t! f# ^; D: Q" V- [code]EDMA sample test application% e- S D! C" J& E
- /*
( Y9 i# [+ t' ]6 q3 o - * edma_test.c/ ^* D9 r: Q- v. B; J% v
- *) i/ I" Q4 u7 {1 h0 U
- * brief EDMA3 Test Application; Q$ x. v: F' N$ U" |5 O4 j% l! x
- *
$ D+ A/ ~8 P! k0 o - * This file contains EDMA3 Test code.
2 a' B- `: a8 _) M/ Z' J - *8 G2 T1 O& @: N5 j' R5 `7 b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 Z7 D% e" U- X8 Y, O' k2 C n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 S* \' H6 D, _8 [
- * TO CHANGE.& ~7 {- m. V+ z/ b$ V7 h; z
- *$ t, g& V; z& h$ H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 e/ M. p/ h. G! {8 X$ K: Z - *
* h5 I2 A0 Y) z% A - * This program is free software; you can redistribute it and/or
, E/ Z7 x3 N P5 V$ t/ `& h3 H1 z - * modify it under the terms of the GNU General Public License as
6 z6 H* ^1 k1 ^. s* M3 A - * published by the Free Software Foundation version 2.
! p5 r# ~7 ^) g% k! Q - *8 ~; L1 n& r+ h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ ~1 d& Y- o m+ w- b- y - * kind, whether express or implied; without even the implied warranty3 a1 l5 {5 @1 a' {2 p* j1 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( Y, v3 N& ^0 L9 R0 ~, m - * GNU General Public License for more details.
8 [# \1 |0 c: @# U0 X9 k0 c - */
* P( K8 S. s0 L - 1 h! M# {: a( L6 l! F
- #include <linux/module.h>
& x1 m3 m7 z6 ^/ b! i) X - #include <linux/init.h>8 l- h" o2 {, H; ^$ v% _$ W
- #include <linux/errno.h>8 [/ k7 l, @4 @$ W
- #include <linux/types.h>
! G$ J+ X4 |2 r, b - #include <linux/interrupt.h>( j9 s8 R4 `7 N2 |7 O+ |, n3 E
- #include <asm/io.h>" N L; H' p, Z& f4 O, V V% D
- #include <linux/moduleparam.h>, c+ q! q# `" x
- #include <linux/sysctl.h>
2 W1 q' A) ?- d0 X3 W+ D - #include <linux/mm.h>
* u4 n A0 R8 z" l5 L- V - #include <linux/dma-mapping.h>% d! O+ {$ l' P% K
# N' ~0 V! D) b- #include <mach/memory.h>
. S) v- N7 y) o - #include <mach/hardware.h>
* O4 @' B1 K1 B! C - #include <mach/irqs.h>
) ]* M% j& L6 p# e6 i# V, e- n - #include <asm/hardware/edma.h>% z# Y2 h0 ?/ ]1 V% g" ~
- . X$ H' M. L" C+ T6 g3 O5 g
- #undef EDMA3_DEBUG
" _# j2 I5 o* L; ?. J; M& e - /*#define EDMA3_DEBUG*/' R u( Q* G2 ]; M5 J. |( x1 G
- & B5 }+ @2 V" T) j: c
- #ifdef EDMA3_DEBUG
5 p% Q4 ] I' i9 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 x+ C. b0 U z$ s4 ~) i2 Q# h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' j. ^1 {6 D+ B ?& | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 B5 F8 K4 w5 ~ - #else
. ~" P% g* V: D; y. S$ R - #define DMA_PRINTK( x... )! b/ t* d! @2 v, }. \ U
- #define DMA_FN_IN- d. ~: ]5 H# j% ]- ]
- #define DMA_FN_OUT6 e% A" W; ?$ G$ }
- #endif
4 x$ U B2 g' R) E7 _4 D4 l - , O3 I% n8 S; @5 b d0 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ g8 e- T( q6 B t) @9 k% C) y+ ]! k - #define STATIC_SHIFT 30 \$ D8 t$ _4 v. a
- #define TCINTEN_SHIFT 20
5 m2 O: q9 ~4 h6 N - #define ITCINTEN_SHIFT 21, @/ ]( K1 f b) D: A, {: h4 h
- #define TCCHEN_SHIFT 228 U9 l! b: R, X4 L6 e/ {
- #define ITCCHEN_SHIFT 23" a2 u1 g) X+ v5 q' t7 t
- J5 S# h1 J, a2 s; Z$ ]* `. L+ H
- static volatile int irqraised1 = 0;
, x3 o8 w) O% _! Z$ K - static volatile int irqraised2 = 0;/ { l+ n. h/ ]+ d/ d! X
- " Z) F$ l6 w# [; {' t0 g1 X/ M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& X# O+ M, t+ Z7 A6 ?4 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, F/ S( b* u5 P. q: |6 m8 }- ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, c/ t3 z6 S1 S1 Z* _8 ^+ k/ l7 X
- ! o1 \; U. ?$ f3 l) S( y) }1 d+ l
- dma_addr_t dmaphyssrc1 = 0;- p; k4 a' ?' S# Q& W
- dma_addr_t dmaphyssrc2 = 0;
" j7 F: X' Q6 z- }$ ~3 j4 A, F - dma_addr_t dmaphysdest1 = 0;$ x/ A* ]! h# T
- dma_addr_t dmaphysdest2 = 0;
, h& A a) Y% q4 T3 U" S. Q! ] - 5 ~: z/ I3 W: \
- char *dmabufsrc1 = NULL;$ m# t1 v/ l% j5 z& S! ^. _5 x
- char *dmabufsrc2 = NULL;
' G4 y7 \- l" X - char *dmabufdest1 = NULL;: D) Z+ Y1 s6 R! T
- char *dmabufdest2 = NULL;+ w9 U7 T: @ o* w5 ]. O1 G L
- - ]+ f6 D9 s- Z: g! h& `7 a2 T/ L
- static int acnt = 512;
5 E% o7 a. P r4 S - static int bcnt = 8;2 B) G8 q8 | b3 ]4 `5 ~8 x
- static int ccnt = 8;
6 e Q/ z! a% \, c/ A+ i - R7 B& w% p: Y! a, U; ~8 |) ] Z9 I
- module_param(acnt, int, S_IRUGO);
! e( U/ i' `1 z0 x! ^& }$ H! N - module_param(bcnt, int, S_IRUGO);
- A3 ?+ k; L6 x& ~7 L - module_param(ccnt, int, S_IRUGO);
复制代码
( Z# g. `' g% ?5 b' s
6 l7 h6 i; ^/ N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; }. i! ]! K* ?- ?! D* {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& V% ^: p+ h% Z. r- Y6 |% u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 T, L8 f# C" [" i1 h# D, H: v* `( I4 ^; g
* i& Z9 ^2 ^; {8 e$ \
|
|