|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 ^7 F! f- ], W+ l: ?
- [code]EDMA sample test application/ e' G/ I0 F3 j( e
- /** y0 s1 l* r- @3 j6 O& B
- * edma_test.c
0 m( t- @! R2 O! Q H( A - *
, h3 z. s: U6 u" I - * brief EDMA3 Test Application8 m5 A, B: R, y/ r! `
- *1 E- I. p& I0 G4 ^: U2 y
- * This file contains EDMA3 Test code.2 A1 j/ Q+ ` Q, ^5 H9 \
- *& \& ^) z. g; Z! _3 A5 ^' F7 G
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- [5 P( c- k$ L' g* k; k% D& V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* N- M0 t& Z6 r$ }9 E5 ~% \. ~ - * TO CHANGE.
]- k( n' n6 }; }3 _% M9 e. C; Y - *! p8 G. P& ~6 [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 H+ M% s% { ^0 K( Y, M" y/ ?. \9 d
- *
. C+ W: K; D2 b4 f7 E, M - * This program is free software; you can redistribute it and/or( i: K# h7 Y+ |" G% a
- * modify it under the terms of the GNU General Public License as! s1 a2 P& b! ?( o
- * published by the Free Software Foundation version 2.7 i" P+ B% v% [9 ~5 G3 c
- *5 y3 ]3 ?6 g1 E5 \, T: `3 m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ s7 {1 u8 ?) }. X/ S \3 e; W
- * kind, whether express or implied; without even the implied warranty, j7 X+ g. Y/ h+ \) Q1 U$ m1 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 @0 S$ I/ e9 K5 ]# `" ^ - * GNU General Public License for more details.
/ H V/ {, m$ ^8 ^" ~& b - */
- L4 p: h1 S7 ? p# _0 r( C) }
3 |" K( p9 g' E" L" t2 m# |# x- #include <linux/module.h>% v1 s5 I% ?; h) d" t, {
- #include <linux/init.h>+ E/ f# f3 R+ t* Z1 V! |" e
- #include <linux/errno.h>
& g; E/ }4 D" m9 Y8 m - #include <linux/types.h>
; d# E+ o* v0 E2 n4 V - #include <linux/interrupt.h>+ q& N A2 J2 q- Q- N1 G8 w- |
- #include <asm/io.h>) s, W! L. e7 d- m; Q4 u& [" d. Q
- #include <linux/moduleparam.h>2 q$ e1 d; I. p, q1 J7 z4 j, I9 d- M
- #include <linux/sysctl.h>5 I! h) q6 Q g; Q* R$ d
- #include <linux/mm.h>
! i. l1 y2 ~$ O4 r4 M - #include <linux/dma-mapping.h>
0 H& i, B, H8 q+ H' m7 i5 U6 o
0 Q/ E3 X9 `' o _, ~; p- #include <mach/memory.h># Q5 ?. f* `& Q& d' a
- #include <mach/hardware.h>) u5 n% W0 B6 y4 O) ~, t
- #include <mach/irqs.h>: S& b) E+ ?1 I5 ^( w
- #include <asm/hardware/edma.h>3 @1 U3 _4 K! ?
- 2 I( n+ z% `8 ^: d1 w1 e/ U7 d
- #undef EDMA3_DEBUG: h, [( E+ P; m5 u& v$ L! ^2 H
- /*#define EDMA3_DEBUG*/
. L$ Z8 i Z$ P4 H9 d! j' z
! {* @. b% T& ?- #ifdef EDMA3_DEBUG" j) G" J$ e9 a0 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, x# P; c* s" I; {% @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! W( H8 l0 U6 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! I% f% ~* t/ H - #else& @9 ~& Z# d+ @: z7 O& m. J
- #define DMA_PRINTK( x... )
4 H0 U& Z* N) P5 P* [$ m) B* K - #define DMA_FN_IN& Z9 d, L4 o8 }7 k$ \5 h4 I/ C
- #define DMA_FN_OUT
) N0 E3 y3 ~- E$ ~% M - #endif
2 U/ L4 x9 P# ~5 S - ! i% r* u0 r l$ P* g% j5 N3 _8 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 d; r5 e8 N/ \2 j6 j
- #define STATIC_SHIFT 3
& K$ c+ g. I$ o - #define TCINTEN_SHIFT 20+ @1 G0 v1 Z/ I" J
- #define ITCINTEN_SHIFT 218 ]% u+ {7 N/ w! Y
- #define TCCHEN_SHIFT 22
5 F7 X2 p9 O8 t7 y9 K/ e4 R - #define ITCCHEN_SHIFT 23
* J) \ L9 ~9 d, l" R) {! [5 {& w
- O9 Y+ ~- K+ r* S- f- static volatile int irqraised1 = 0;
O$ k- d0 b3 `/ f - static volatile int irqraised2 = 0;
, e+ k$ j, n% e9 e/ i2 k T1 M
' q6 M- `1 S% e: z) o8 W( d/ s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |9 E/ c* E6 z$ D3 q: f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 U$ \# a! w/ X* }2 T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
T0 |- X4 F7 h: X! L - 4 @! M8 ?( U7 _
- dma_addr_t dmaphyssrc1 = 0;
) W* y6 P1 _$ ^" Y+ A - dma_addr_t dmaphyssrc2 = 0;) F6 q0 w& g! f: L9 L3 g6 ?
- dma_addr_t dmaphysdest1 = 0;: l' @# ?& U2 S% d* S- w4 E
- dma_addr_t dmaphysdest2 = 0;
, s7 K( ]# D# |/ l+ U
; B3 n6 [8 A" | b1 T) z- char *dmabufsrc1 = NULL;9 Z& |1 }3 V4 X! j. u7 I/ o+ F
- char *dmabufsrc2 = NULL;
3 S! Z4 N4 y; T9 D4 l0 ]0 J - char *dmabufdest1 = NULL;
6 j$ G: `3 v2 y; w4 J" {% U1 S( s4 [+ Y) e - char *dmabufdest2 = NULL;
8 o# S+ M8 ~8 i0 [$ n
5 ?# b0 ]2 j- A) T( r- static int acnt = 512;3 ^ f( |( n$ z$ s
- static int bcnt = 8;
) \5 z7 B7 X1 Q6 c" s - static int ccnt = 8;4 I" @; l% V/ n. g
$ l2 {6 O) X1 u- module_param(acnt, int, S_IRUGO);& w+ M8 l3 ~9 P
- module_param(bcnt, int, S_IRUGO);
) N) S* t, s: a) e' O$ S - module_param(ccnt, int, S_IRUGO);
复制代码 8 r2 K& G1 P3 A4 v6 N4 Q
' m% R2 E0 D" f- d, }$ b6 x5 @* ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ }6 K+ c! Y/ k: S" L9 [2 marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. Q' N" C! @9 ]7 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) b; M9 f0 }4 S: v+ s5 z9 `3 a3 D/ F2 u9 {' w5 ]) l/ o1 Y: d
) v! D0 z9 p4 }8 @3 h9 ]: n! b. ]3 v
|
|