|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- Y& {; |/ x9 V+ _- [code]EDMA sample test application
- }# `( c8 c6 S' i - /*, z' p9 k9 e# [" D
- * edma_test.c
: o. |7 ~/ a! [: c - *
* ~$ ? t( L: v" P0 U - * brief EDMA3 Test Application
" I" _; v% f7 w3 X# G& s - *7 C7 ?) g: K0 A6 n4 k$ o
- * This file contains EDMA3 Test code.
' h2 T! a" P* s - *
' {6 H% d4 Z5 t5 Z* Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 K$ M: }; S. I, | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, K4 R7 N S& }2 D; R; y3 B& u, x. c
- * TO CHANGE.% \; D& ?" A+ F; L, C( K) y
- *
3 `: \) }! z8 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 @ m$ p+ q6 {+ k& u( ~6 p5 ?+ M
- *
1 `, S' Q: K1 A/ Z - * This program is free software; you can redistribute it and/or
" Q3 u+ Z! o6 M4 B5 E% w; k - * modify it under the terms of the GNU General Public License as
; y ~: M) h1 Q1 F8 P - * published by the Free Software Foundation version 2.$ O/ ]: {, h2 @* Y
- *
; S) h4 A$ ^8 [0 Q1 {! B6 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ }- @+ a+ J. ^$ r- \* _( g
- * kind, whether express or implied; without even the implied warranty9 E% q9 C" m/ n0 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& P G0 x" U [9 Y
- * GNU General Public License for more details.) M+ w0 e: ]. W K7 q
- */
2 y' O p# l9 i' J: C
' @ E' f9 _- f+ t- #include <linux/module.h># S& k, Q0 N n& R9 U
- #include <linux/init.h>
! f y6 D6 H4 q0 d7 U, ?! B- i - #include <linux/errno.h>
- @# d3 n+ ?% p: P. O - #include <linux/types.h>. I+ b# j) F; z8 M0 }8 n) [
- #include <linux/interrupt.h>$ m' ^% Q6 b3 ^* H7 x
- #include <asm/io.h>
6 h2 Y I3 Z {3 e! m* u - #include <linux/moduleparam.h>
, d- A9 A. P" _9 K) a( Z0 [ - #include <linux/sysctl.h>8 g. x" E3 l- h% c/ i1 D0 F& F
- #include <linux/mm.h>
- }/ X# Q2 ?9 R* q! T - #include <linux/dma-mapping.h>0 }& `7 A9 i! M) K$ S- w- ]
7 w, X: i( W' a1 l, b& l- #include <mach/memory.h>; h# K i6 c# j
- #include <mach/hardware.h>
( \# f6 Q9 a3 r9 P! N - #include <mach/irqs.h>
. l9 s7 A% l0 N+ P L5 ~ - #include <asm/hardware/edma.h>* B" f( p2 j! ?' z- y. t+ G
- " c2 Q! C! c; `& U6 f# ~6 v3 G
- #undef EDMA3_DEBUG3 J( `6 `8 V% p7 B5 N- b4 h
- /*#define EDMA3_DEBUG*/, d: [" ~ C }5 ?" W! D1 {2 N, T
4 @; U9 N4 z7 m# `* F% D- #ifdef EDMA3_DEBUG
: S9 w/ Z" x- I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 r5 @0 E7 F. V: @. Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# E8 T4 P! h' G9 G: o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ @2 \# p) T# k( J C
- #else2 _6 t! C. u$ h
- #define DMA_PRINTK( x... )
; L' d) l' b O) A- N1 q - #define DMA_FN_IN. H R& g$ T4 T: x: v
- #define DMA_FN_OUT
# F. ?4 ~/ t9 l0 F& w$ y - #endif
" K. d4 F4 z8 j9 F3 f
9 M7 Z4 v" j) E2 N# c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 B7 H7 s. m- I$ q1 C$ q' w - #define STATIC_SHIFT 35 C, x; D. U1 W) Y! O- Q9 |
- #define TCINTEN_SHIFT 20: n j) o1 T: q* B* h9 u
- #define ITCINTEN_SHIFT 216 C6 l2 A- n5 c, ^# m
- #define TCCHEN_SHIFT 22
, `5 k1 E8 N6 g9 V; \ - #define ITCCHEN_SHIFT 23! z% J9 n d$ B) A; w
- % u; k: d9 C/ l
- static volatile int irqraised1 = 0;( t5 I5 b u2 G4 j
- static volatile int irqraised2 = 0;" b$ |6 r1 H9 D+ I. i
- / R3 Q! f0 E, Z+ E4 o4 A* A% ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T7 V0 t' Y' G* i' a* L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t! @5 u& T: ~) X: R& U: o! @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~( v) E9 [7 d8 c7 [
- , c* z0 h, n+ @) Q: S* I& [1 I
- dma_addr_t dmaphyssrc1 = 0;/ D: N$ g6 }& e7 C
- dma_addr_t dmaphyssrc2 = 0;! |: N! u# c2 g! ]
- dma_addr_t dmaphysdest1 = 0;8 L3 c/ l) ~' Q, j
- dma_addr_t dmaphysdest2 = 0;- E& Y8 R; H* \/ O0 H4 v% U
- 3 [" I, v' ]- T) U8 E8 k
- char *dmabufsrc1 = NULL;% U6 G2 O1 Q% U4 F* e
- char *dmabufsrc2 = NULL;( [3 t- q7 }5 W0 K2 l% i: V% k
- char *dmabufdest1 = NULL;
. y# l- Z5 ]% ]# ]- A! B - char *dmabufdest2 = NULL;/ V. Y( ^; c# R
0 c* ?$ v0 S3 w9 z$ H2 x9 N( g7 p- static int acnt = 512;8 M/ h/ q: H: a; Z
- static int bcnt = 8;
7 v( v0 X* p/ y; ?6 X - static int ccnt = 8;
$ t1 E: e8 P D9 T/ K - : T- s0 r+ `) E& N% m$ i5 {7 D
- module_param(acnt, int, S_IRUGO);2 a0 ^9 e" g0 U9 ~- p! e
- module_param(bcnt, int, S_IRUGO);( o& v9 @8 J( y3 E
- module_param(ccnt, int, S_IRUGO);
复制代码
( x( U5 U2 ^4 v( x0 O- i! |0 u5 G
' k2 F: i6 k. a+ T. G% c+ y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. ]9 ^- }5 H( e. C9 `1 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 l, Y8 V4 }, V8 p# j/ a" e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 U8 W5 h' _& ^! u- g# H
. _8 U7 Y7 x/ B- S5 |# a) Z0 ~6 E2 t6 ^. Y+ @& K
|
|