|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, g( G: t) o# a6 Q- [code]EDMA sample test application
7 |3 J1 X+ x$ ~+ q- Q% J# s - /*- Z/ P2 q3 q) I& }7 V
- * edma_test.c
' _# H+ |* Q8 E7 o% c* ^' n - *
( `3 T" h: L8 Z+ B - * brief EDMA3 Test Application/ `' S* q6 `- _5 t$ Y2 J7 t$ n
- *
& v# g/ [2 g$ E. ] - * This file contains EDMA3 Test code., [' L1 K0 n% l2 q0 ?
- *
' h9 A$ r, M* T0 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- V4 J3 k0 k- M% d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 `& E. R& l9 g* G" l' ]* _7 H X - * TO CHANGE.4 S( D* S6 T0 n, s! {! r+ T
- *6 u& j' K8 Y) m- G+ _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, Y8 u2 i. a% }& t p& A& S( x7 E% \ - *& Q/ w: z$ R/ m4 ^6 g/ J3 p; U' t9 M6 q
- * This program is free software; you can redistribute it and/or) s+ g! a1 T/ n
- * modify it under the terms of the GNU General Public License as
6 J& D7 k2 }* H" q( K1 D: S - * published by the Free Software Foundation version 2.
i. ]% b4 U* X8 \% P - *
8 X0 _% \3 y* W( _7 y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ P7 `, H2 P3 K7 ]- y- B1 E
- * kind, whether express or implied; without even the implied warranty
: U) P$ C1 h1 g' x$ |; D z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; J3 y1 V; o3 {* g - * GNU General Public License for more details.* H8 I* e9 y3 J, ^7 ?( C
- */* i: U1 N6 [) ^) A9 T+ t2 g
$ t5 }9 X! l8 C+ f$ k, u+ T- #include <linux/module.h>
6 a" g, L- M3 k - #include <linux/init.h>
( f1 G, N3 C' `6 k ~& V4 M - #include <linux/errno.h>
" B" `0 F0 D# G - #include <linux/types.h>
# [) s* R1 Q3 H/ q, [ - #include <linux/interrupt.h>
) f9 @2 n. J, e: i. p! X - #include <asm/io.h>
0 J# v6 i2 |8 Q6 I - #include <linux/moduleparam.h>
, `: M! w1 g$ w9 D7 A - #include <linux/sysctl.h>, c( ]4 E2 S1 E: W' Y
- #include <linux/mm.h>
* e1 z7 n: [3 d+ ` - #include <linux/dma-mapping.h>* x8 Z4 X# S7 a! T
- 3 d: K, ]+ }! ?1 R; S9 h& m
- #include <mach/memory.h>
6 t% K' ^7 `) z* I: u7 L0 W - #include <mach/hardware.h>: a4 g9 R Q* V2 U( B6 `/ h: q
- #include <mach/irqs.h>
/ ?" D$ D1 z" g3 `& J - #include <asm/hardware/edma.h>- x" ]* S( {4 q9 Y1 H. c
3 g* e3 S! t) n9 T4 A5 V# ]2 w6 H- #undef EDMA3_DEBUG+ S& a6 I. n% h* L
- /*#define EDMA3_DEBUG*/
0 C; J5 q* r" P U. p/ B& i
5 {- D/ o; G" T0 ?( b- #ifdef EDMA3_DEBUG
$ {& U* ]; n, s& [9 X0 }: I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). s- Y4 R% l: H2 j4 I% r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! V- X( ^, v+ c' g. V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 N+ c0 b1 r: ] - #else9 J9 i) o- b% ^( X2 ]
- #define DMA_PRINTK( x... )" W2 z( [& Z1 q& F; l
- #define DMA_FN_IN
/ x( b, `/ r& X( K4 y - #define DMA_FN_OUT
* D; f# ?5 E" G& j7 B! p3 h$ M( W - #endif
4 M8 Y' x6 J9 h P - - w+ D$ n6 E' a9 t5 [$ u M0 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 J4 I; [7 \) Y
- #define STATIC_SHIFT 3
5 A/ Y7 E2 e( x8 |. ` - #define TCINTEN_SHIFT 20
( m; x( B" F4 g; A1 b - #define ITCINTEN_SHIFT 21! d. \ L6 a& Y4 i l Y2 C
- #define TCCHEN_SHIFT 22
1 W; q" \6 {0 E r - #define ITCCHEN_SHIFT 23
9 p" Q6 I) E+ ^( @ s2 I' s
d! j+ ?; t2 H8 G# Q. a4 b( i1 @- static volatile int irqraised1 = 0;9 y2 {; I: U4 U
- static volatile int irqraised2 = 0;
6 X8 C' h" e; A% U! {0 F - " ~- u9 J: F3 Q3 F9 V) u2 q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^. v) r6 n! h7 I& x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( L( x U0 t) @1 p) `! w- w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 c6 o- g& D. s* O
- 7 X: `1 J# J: H) g, Q
- dma_addr_t dmaphyssrc1 = 0;
) v5 d2 A* V# j/ e+ w+ N% y% H - dma_addr_t dmaphyssrc2 = 0;7 }1 X* S/ c6 N# v
- dma_addr_t dmaphysdest1 = 0;2 _2 r: \, _$ y2 n: F m2 I. ]
- dma_addr_t dmaphysdest2 = 0;
$ u2 G. w* q- o6 x
0 ^' E" u, J( k+ _- char *dmabufsrc1 = NULL; p \7 S6 ?" `; r+ ^4 @* u
- char *dmabufsrc2 = NULL;
& X9 n1 h9 H8 ] - char *dmabufdest1 = NULL;
& q* ^/ `3 }, f$ r9 y2 e+ d* @ - char *dmabufdest2 = NULL;
8 t* H& ?& V; g7 s8 B) _# B8 Q
$ o; ]( X- o2 {" D3 h A- T# ~ Q- static int acnt = 512;
/ s/ ^7 J; D! `5 k. J7 t& z, O - static int bcnt = 8;0 U. s2 Z" J* X. C. X
- static int ccnt = 8;5 i6 W9 M0 N2 f; |& _: |9 Y
n+ _+ E6 [* }* ]- module_param(acnt, int, S_IRUGO);) ~1 \; W, N: H z
- module_param(bcnt, int, S_IRUGO);2 \& h4 S- T/ Z# _+ m) ~
- module_param(ccnt, int, S_IRUGO);
复制代码
' Q- R2 T Z" h% h* c, l& V4 U) D) j: G- i c S5 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 l# ~5 N1 d+ ]# tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 {$ c& r. c6 a; ^9 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. R4 X+ w; `' h+ K o& y2 M1 ~! \" G1 S4 ^5 [+ Y9 N: o
! o, S, d7 R8 i. L) e: ~; I
|
|