|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 [! ~# N" Y) U/ j
- [code]EDMA sample test application# X, m; E( i0 V. b4 a2 i
- /*1 ~; |: U' e1 G
- * edma_test.c* {7 N+ X1 k, j S; p, S6 X! T- w6 @
- *# n" A. E% p& p* [# T: o
- * brief EDMA3 Test Application
" B: o4 M! r: U - * B- {# y6 j! t2 E$ x: C5 O$ k
- * This file contains EDMA3 Test code.
7 y0 M. g0 f6 x - *( `7 x0 t1 x2 r: Z7 R2 B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; p' R8 @9 {' Y# L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; T% ~0 h( }$ H
- * TO CHANGE., e# |+ q! Z2 F# }$ L: v
- *
; W! R5 E0 d6 F+ h9 p! |' D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 b1 T8 j* G: X$ R - *
& x5 @3 M. U. j - * This program is free software; you can redistribute it and/or3 e% l9 P5 m/ _5 ]5 E6 @. y- @
- * modify it under the terms of the GNU General Public License as( h7 {2 o8 i: ^
- * published by the Free Software Foundation version 2.
, l3 C1 E% ~' }9 q9 Y0 D' ] - *
0 `3 M+ t; k! T: Z* W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ Z# `6 H- p n4 ]; I$ u2 v8 w - * kind, whether express or implied; without even the implied warranty3 y- f( S9 L0 A) ~, N" U- T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 F4 M( ]1 u4 e/ K, O
- * GNU General Public License for more details.
9 @+ ?6 {- y$ H! @% y; |5 o: y - */ F" L! p6 X g) c4 p
- 6 T: n0 M. A7 e7 o: E0 U
- #include <linux/module.h>5 f6 x$ p( t0 h% ~
- #include <linux/init.h>
3 f$ Y1 e7 I9 c, A8 @$ J - #include <linux/errno.h>( F h, U1 W7 i( }
- #include <linux/types.h>
+ {& L+ B4 C' h$ d- R - #include <linux/interrupt.h>/ p( e2 ]2 d! K+ g3 T2 ?
- #include <asm/io.h>
& a# Q9 e2 P+ G+ F$ _9 r - #include <linux/moduleparam.h>
$ o, q* X! K: P: t( W& x - #include <linux/sysctl.h>
v, x* y2 P0 Y, U; I3 G" H+ Y3 O - #include <linux/mm.h>
X0 F6 f: L; S - #include <linux/dma-mapping.h>, u5 \- f& k5 R6 z
- 1 j. ?, M! E: [: O" b) ~; O
- #include <mach/memory.h>
2 Q$ H6 c5 D* ^9 b, r$ ? - #include <mach/hardware.h>; H- ]' I! _. F" f3 V5 G5 L, G
- #include <mach/irqs.h>: m ~, N7 p0 s- W
- #include <asm/hardware/edma.h>% }9 Q7 K! b8 x7 P. D
- $ F: ]2 Z' i" C' `6 y5 d) b
- #undef EDMA3_DEBUG
; i0 `; H. t4 m' p- H# l! \- M - /*#define EDMA3_DEBUG*/
3 j; l q. Q/ R n7 o* O - " `7 ]. r3 J+ _7 A+ ?* @! [
- #ifdef EDMA3_DEBUG
7 h4 L& b: H5 [1 O; b9 q) N6 D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# s+ [2 U7 T+ w- A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [/ f0 t& [% C1 f' O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): R/ r; C" v0 M2 K6 i6 _' t! u; Q% i
- #else
$ ]% x9 }. P2 `" D3 R - #define DMA_PRINTK( x... )% H* B* U+ e8 S: L
- #define DMA_FN_IN
$ Q- d% m- s9 y2 @, W5 ~$ | - #define DMA_FN_OUT8 A. d: A; P( m' F7 U8 \8 I
- #endif/ Z+ c& w% B6 x4 m
- 1 E$ D0 ?9 w* [( D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 N! i! {" E9 C- \- a
- #define STATIC_SHIFT 3, W3 C5 n, G2 O1 v4 ~: W) D/ i
- #define TCINTEN_SHIFT 20
4 m, o2 m+ n7 \ - #define ITCINTEN_SHIFT 217 W- s) x' y) ]7 U- l8 t
- #define TCCHEN_SHIFT 22
0 N5 [( X1 U$ R/ J/ i! S - #define ITCCHEN_SHIFT 23" l+ T& q8 @6 l& ^
- " o/ z0 g7 ~* I( g7 r( G! L
- static volatile int irqraised1 = 0;" }$ E( k' m- x) C0 I- [
- static volatile int irqraised2 = 0;
# x: J$ h, R" k, \/ ` - 5 G- i# ~- f# O3 ?# z: e* @, m3 N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; r. d" F* I. e5 L" H2 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ K5 L1 E, g/ T - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |8 Z& N' X) L' B
( g. C! e# X, G+ v9 a6 i- dma_addr_t dmaphyssrc1 = 0;
+ @% y7 p3 Y! y9 x8 I; K/ M7 ] - dma_addr_t dmaphyssrc2 = 0;( ]2 g% J& x* @, N/ N1 C# m
- dma_addr_t dmaphysdest1 = 0;6 i1 }4 ~! d$ T
- dma_addr_t dmaphysdest2 = 0;3 T8 e8 Z! K+ C9 z) y6 Z7 I
- - E- j2 |3 a4 [9 F& G9 h: n
- char *dmabufsrc1 = NULL;
* ? v7 u7 T" j3 S' ]2 m - char *dmabufsrc2 = NULL;
+ ^/ J) K+ Y: S; z! X - char *dmabufdest1 = NULL;
4 H' E- x: p5 b/ F3 [# Z0 Z - char *dmabufdest2 = NULL;
5 K8 {; i( t+ q9 W* G - 7 r& o0 K% p4 E* W
- static int acnt = 512;1 K* x' I/ a. O* n7 Z V$ L
- static int bcnt = 8;2 j% n$ w/ e& S
- static int ccnt = 8;
; A* `' X6 F* a/ D8 r" D8 l - : Y8 I5 m$ h, ?
- module_param(acnt, int, S_IRUGO);4 O: X: a6 t9 w0 D, o
- module_param(bcnt, int, S_IRUGO); V" q6 P F4 f( w
- module_param(ccnt, int, S_IRUGO);
复制代码
: P" I7 s7 \. I7 |; Q4 c- z" E0 K& }5 c8 t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: ~8 x- f. p9 ~9 q1 U' K+ warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( v. O# F& u$ z& ^: L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& S% B* X/ M+ v) x% C
0 j3 A* D+ _. o
( X- A+ V; v: X4 r7 C0 r
|
|