|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! _% l4 {8 V' d* |
- [code]EDMA sample test application( Y0 V$ q0 n9 P( L0 @6 V+ K
- /*
& {% h$ q0 [) ?9 Q - * edma_test.c9 I7 J7 Y, p/ y7 T/ E5 `9 y
- *
) E( b) N& ? d& w9 N - * brief EDMA3 Test Application
3 L3 U( i" L3 Q1 A2 @# l1 Q2 u. ^9 h - *
3 e1 V2 ^ C8 \3 o2 t: f* @ - * This file contains EDMA3 Test code.
7 h9 e% H H" t* P3 I6 U" V - *6 w7 W" \* u) w7 K) \" n. ~' I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' H* J) ]4 h) H8 \3 ?, J0 x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# X( k. e: D' Y3 X# r; B
- * TO CHANGE.) E- z# O' s1 ^( n3 \% e" E& @
- *9 |+ e( O9 X D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& O, ^4 s# O1 q - *
3 e. t2 s' ]6 [7 s) s& s - * This program is free software; you can redistribute it and/or3 M1 D8 J" w/ W% g) C6 H: |! ~
- * modify it under the terms of the GNU General Public License as
J: C& N" D4 J& n - * published by the Free Software Foundation version 2.$ }0 `/ _1 ?: c o& A
- *2 C1 k& Z ?7 A4 \9 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ [, _ ?: M* R& U3 j, J9 i3 M' \ - * kind, whether express or implied; without even the implied warranty& Y. m* S. Q! y& G3 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ q: {& U2 L+ B7 g" w - * GNU General Public License for more details.) U7 j3 @9 G1 h
- */
5 F- R3 o% l3 [. y7 V
# s2 R$ F0 C" B/ R) |9 j% f4 A. B- #include <linux/module.h>7 S5 W. u& R& k) f d8 x9 \% Q$ U7 | i
- #include <linux/init.h>
2 E1 Q+ f7 ^# x - #include <linux/errno.h>
; Y3 i4 ]9 R% b- n - #include <linux/types.h>
6 p( O3 C1 P/ I - #include <linux/interrupt.h>
( b# S' ?0 u t' h, @' n - #include <asm/io.h>/ h9 H3 ^1 e) p) S' F8 }
- #include <linux/moduleparam.h>! ~3 { r! P8 o g+ v
- #include <linux/sysctl.h>. R* g$ j2 R+ D3 ?: o7 P' ?2 U* N d
- #include <linux/mm.h>
& n/ Q" E) [& w8 c5 `" [2 }) `8 r - #include <linux/dma-mapping.h>- @' S6 O: A- ?2 M, a% I- W
' s V6 D$ u4 w( |# a0 I1 E- T! m6 V- #include <mach/memory.h>3 V1 @4 {3 h9 p$ r5 c! d4 h" I0 r3 E
- #include <mach/hardware.h>
' o) i" A4 ?* T7 p8 K - #include <mach/irqs.h>7 z+ u4 i9 M4 U$ W
- #include <asm/hardware/edma.h>5 ?1 V8 @& ~% C; P: G7 w7 a4 k/ Q% j0 m
( Q: a8 a) ?0 d- #undef EDMA3_DEBUG
; a; M% H9 K9 C, V - /*#define EDMA3_DEBUG*/7 @- d/ A: i3 a: c+ G+ x1 w1 u- Z
& o; _0 Z3 ~6 p5 _- #ifdef EDMA3_DEBUG* l7 ]+ y- J4 H$ A' F* G/ j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
T3 g4 h* n+ K0 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. e* f( |/ ^- s+ E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
j7 P5 R+ R; E - #else" H- a/ ?7 A" b: V% x& A
- #define DMA_PRINTK( x... )
8 D- l) w# x8 o; ?1 e* V5 i - #define DMA_FN_IN% b- O3 p8 Y6 D) W, Z, @3 Y7 Q
- #define DMA_FN_OUT1 @$ Q I4 e% b2 P7 ~$ ~: b
- #endif# W+ e* q- f: S
- 0 l( I; X. T. c3 ?2 ?# }; f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% i$ ]$ u4 B/ G: N
- #define STATIC_SHIFT 3* u# b C6 w S# Z$ M: A
- #define TCINTEN_SHIFT 20$ I9 D7 S) [+ m$ |
- #define ITCINTEN_SHIFT 21- x) t# e2 m4 M. m- `; N
- #define TCCHEN_SHIFT 22% c+ U9 u1 J. i
- #define ITCCHEN_SHIFT 231 D' a- Q5 d) _+ N7 \# w: {
/ a# I3 G4 Q6 K' [- static volatile int irqraised1 = 0;1 e7 U6 C4 X6 n* V
- static volatile int irqraised2 = 0;8 C& }' K0 k9 _4 y
2 [8 C5 ~1 N. m5 W I, F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f8 y! l E5 V, {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A6 o ~( n. ^- _' p/ `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 c& L5 C" m) q7 u( R5 E
- 0 P2 F! T2 j) d( \" [' ~5 Q9 z1 @" G' L
- dma_addr_t dmaphyssrc1 = 0;
7 K8 h% C/ @3 n0 J# k& k. ` - dma_addr_t dmaphyssrc2 = 0;+ N/ U9 L' T6 j8 i @
- dma_addr_t dmaphysdest1 = 0;
6 ~# N* i) _8 L' @2 K - dma_addr_t dmaphysdest2 = 0;7 ~% i4 N! v5 _! b/ f
7 m2 s. h/ @- w# L( K7 y9 q; f- char *dmabufsrc1 = NULL;" U% Y! h- u1 ^* R0 Q! p
- char *dmabufsrc2 = NULL;
, |# S! h/ _9 J% ? - char *dmabufdest1 = NULL;+ G' n3 x' T8 g* j1 n4 s7 j9 ~
- char *dmabufdest2 = NULL;
: U' M* `( W% j+ e5 ? h" H. X; ~7 r
6 }( V1 u( H5 W" P% Z" N- static int acnt = 512;
8 ]3 H' d O8 J- x& z e - static int bcnt = 8;
3 y$ X. O2 s# M; @$ K - static int ccnt = 8;0 h3 f! [9 O, N1 j# d, P6 x# M
- 2 k2 Q Q7 M; S( B
- module_param(acnt, int, S_IRUGO);
' ?6 z* R8 m3 O* m, T2 { - module_param(bcnt, int, S_IRUGO);; F9 k' [+ g. x4 C0 ]! ?& k3 n/ |; x
- module_param(ccnt, int, S_IRUGO);
复制代码 7 J. g! e3 B8 `# _6 L$ k7 L, @6 S
) x; |! {5 o! c3 r/ ^# q: z) ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" d9 e: P ? H l0 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 E3 r' p: s/ w- `/ D+ ^* G( `, Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) ^, D: f: J; w) u" k
$ c0 {9 c- U( `2 N9 G
( c: i" S ~. y7 e |
|