|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # i/ o4 h! B+ b' t/ P
- [code]EDMA sample test application
" ~ X0 U1 J/ Z" F& E& n# ^& | - /*" d/ e' @5 ^6 P+ v. k K! g; i- k9 D' R
- * edma_test.c$ |& D4 ^+ B& X# O4 X
- *
+ \* N. w! H, ` - * brief EDMA3 Test Application
! y6 o# c2 F) F- ] - *
' e( V; X, c5 ^! U4 s0 P- h7 a- o5 z - * This file contains EDMA3 Test code., j8 i, Q( p! O% J9 h
- *
. J1 b$ F' b. H! ~6 y+ T) a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* ~( u! ^; B: i; ~- R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 a: d2 i' }, Y, U2 ?2 z. `, y2 J - * TO CHANGE.% m3 `# G% i- e" A* L& S5 L; t
- *
2 s! Z! G3 Y% \, G3 h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 ?5 A7 R4 l" H: d; O6 Q6 F
- *, Z) i# C+ o4 V& f$ d2 z
- * This program is free software; you can redistribute it and/or
% |* {6 w( Z7 {% F1 s3 L - * modify it under the terms of the GNU General Public License as
( y; ]- Y& A* Y I* G G, I - * published by the Free Software Foundation version 2.
. N0 O8 v2 w6 ?" I2 A; [! f' w - *
3 l/ r5 j4 ?- k6 B) i) a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ n& ~6 q( W. ~4 \, J& M& K
- * kind, whether express or implied; without even the implied warranty
- t% R) V* X4 r: o$ r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( M: T( ~3 B* d! X; N$ {1 Z* z - * GNU General Public License for more details. L5 o/ C% X% n4 `
- */4 Q- o6 Z+ A( R3 \* x6 Z5 e
- 1 ~6 {6 B9 E; i m% @- n
- #include <linux/module.h># {* w8 W) c$ @3 ?% v( ?- X
- #include <linux/init.h>
$ B2 U( N9 ^3 } - #include <linux/errno.h>
2 S1 B8 C( s& j - #include <linux/types.h>2 z0 w% u$ H! y" Y- n& T. j, j
- #include <linux/interrupt.h>6 N& W) e# j% Z) `- x0 v
- #include <asm/io.h>8 v; `' a# ?/ f4 F: [3 z c! B/ Q9 r& C
- #include <linux/moduleparam.h>
8 p1 o# }) R8 ~6 V- I; D3 i. K$ W - #include <linux/sysctl.h>
/ y3 ]! O: v; H+ U$ L - #include <linux/mm.h>
* w$ y! n1 H" V% b- P - #include <linux/dma-mapping.h>
% ?7 g) }, H# W1 ~$ _" t
8 ^) N, l8 G, O2 _; L; t- @, W- #include <mach/memory.h>
, { W2 l. o3 o% x* [' } - #include <mach/hardware.h>: g/ [4 F' G" X" H8 s+ v! o
- #include <mach/irqs.h>
1 A4 ?4 S2 S3 R$ y6 o, f" s - #include <asm/hardware/edma.h>
* R7 c. R3 }- S, E/ ^8 c1 A
7 l. Q$ { y8 S% G$ [- #undef EDMA3_DEBUG# L2 M! a: q: j0 y; x
- /*#define EDMA3_DEBUG*/7 L9 r2 U% M7 H
+ C2 s+ C3 c. ~9 g% a- #ifdef EDMA3_DEBUG3 Z) h6 f9 `8 h: C1 I V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* |% D9 x) J. C+ I1 `4 Q. }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h8 @/ ]7 }* b( b$ O# F1 @! e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) j9 Y5 Z; g, ]3 ~* Q0 }3 @
- #else: Q/ M+ P" {8 P5 R
- #define DMA_PRINTK( x... ), b* _4 H7 @# x
- #define DMA_FN_IN# T6 Y( O9 K' Z
- #define DMA_FN_OUT. {. v$ s3 p5 ~! w/ f
- #endif7 d7 p# @5 W" `
- $ I+ J. ?1 _1 w$ n3 o5 z9 Z+ Y1 J; _! ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ]! |8 V# n' w. X3 Q5 Y$ Y- X
- #define STATIC_SHIFT 3* A- z) c+ |1 H# Y/ c2 {) j( i
- #define TCINTEN_SHIFT 20
' }/ e _; @- l. |6 p. j - #define ITCINTEN_SHIFT 21% T7 w J( V0 ^ E% N. J
- #define TCCHEN_SHIFT 22* U! g3 ^( V; J( e
- #define ITCCHEN_SHIFT 23
& K' u+ |# `1 W! p6 ~& E: i, x
: A5 S. c2 _1 Y+ z# b2 I3 ]- static volatile int irqraised1 = 0;7 b! g4 X" T8 J% N
- static volatile int irqraised2 = 0;
; z! m4 |& e/ P: b
' H; \* L0 C7 ]# \/ b, U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ }5 o& _4 H$ }. J1 }0 ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' o- y, K( f) @: y/ f) e3 c" T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) D( N6 Q9 [& W4 M
7 v2 Q2 V: T: U1 Q4 M1 v- dma_addr_t dmaphyssrc1 = 0;; T; ]# `% I0 L; _/ b5 o1 X
- dma_addr_t dmaphyssrc2 = 0;
1 m* T) {( {2 l - dma_addr_t dmaphysdest1 = 0;/ _, q& _2 {% ]* k; o7 S9 f, |
- dma_addr_t dmaphysdest2 = 0;% m7 r# K$ v! w7 B
- ; [$ v5 s0 Y, `5 Q# B
- char *dmabufsrc1 = NULL;# v7 {8 Y2 M9 \; G- S2 l9 _- ~
- char *dmabufsrc2 = NULL;
2 m4 a \! l8 f5 E! a8 v - char *dmabufdest1 = NULL;
- j3 ]9 b, E. V. m4 T) @6 i9 f: j; e - char *dmabufdest2 = NULL;2 m2 a A3 d; C" _
6 i* b! b# |+ }. }3 A! ?- static int acnt = 512;
* C, {# T0 F) O - static int bcnt = 8;
( Z- J) W' S, z - static int ccnt = 8;
b, I4 H2 M# E4 J4 a3 |: U* F3 G* l; \
w$ `$ H) m& j6 E9 f; C6 x- module_param(acnt, int, S_IRUGO);
9 L, k! d, s+ e$ @, m - module_param(bcnt, int, S_IRUGO);# y7 P6 K, i# y6 t' R" P" L [
- module_param(ccnt, int, S_IRUGO);
复制代码
4 M1 r+ x7 @2 N6 B; z
% [2 }9 f$ ?6 ]9 n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. I* M: L- z T" karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! {$ N5 w6 d6 X- x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ g- s- z/ ^- N3 h
; n9 k5 L: \4 M R7 F) M6 }) D8 E! s; u
|
|