|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % _' L6 a; d! T' J' U. [
- [code]EDMA sample test application
& J, @0 s5 C( } Q; l - /*! I, c% c8 l5 E3 @) Z
- * edma_test.c' q& F. A+ T% U
- *# \) r2 v; t' }7 a1 Z! W0 ?
- * brief EDMA3 Test Application
' n+ I7 H% W; N8 ]1 B4 ?3 H - *; Y/ @! L+ X$ j( T9 v t, T0 W
- * This file contains EDMA3 Test code.5 T, {# a5 N- q3 B1 _# K) M+ s( N
- *
4 [+ c3 u% N* P) B6 V( y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 s: }5 i& E3 c; S, J1 ]; x; M$ j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: w \$ w. Z% B! ~& N" c8 S# ^
- * TO CHANGE.
. M+ o# r+ W: X3 a2 U$ U - *: Y7 z# b+ t+ f; j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 a6 g/ U) P( h' I6 Z
- *. h5 W+ D8 d( n& O
- * This program is free software; you can redistribute it and/or
& @4 D- J1 n: F# h - * modify it under the terms of the GNU General Public License as7 s. v1 q/ z: u* Z' j' ]; _( g9 j
- * published by the Free Software Foundation version 2.' e) V+ e4 w. U1 l
- *
+ H, ^( N; j! l0 v- ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, t5 j4 ~& x7 Y) J2 l - * kind, whether express or implied; without even the implied warranty
, f; ^. z9 H) h& I$ I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 V4 N' I) x, n2 H; ?2 S& Y/ S5 G
- * GNU General Public License for more details.6 ]& e5 Y: n) I" i5 _
- */
) j7 i* s0 f. t3 P) d9 Q: b& ?$ z
X) \) Z$ G- e/ e: X$ a5 s- #include <linux/module.h>7 N1 U, \# J4 b `
- #include <linux/init.h>
, ~$ J6 s( ?" f: P! E0 Z - #include <linux/errno.h>
+ n1 V: H- R, H! ~+ V! f4 F$ s* Q - #include <linux/types.h>9 ~! v; y0 l( X# G5 p: o( _
- #include <linux/interrupt.h>& C# L" J* D. j5 R& e
- #include <asm/io.h>6 j! C3 X8 q' i/ Q0 d i' F
- #include <linux/moduleparam.h>
( \2 m( C( Q4 J- J3 m - #include <linux/sysctl.h>
) o2 X' q$ j* k - #include <linux/mm.h>
4 z: Y- E; {8 v9 R" s6 R c6 P% B - #include <linux/dma-mapping.h>
2 l2 ^: v" M2 A& f9 s
$ x; O2 x+ o. o! j' o8 Q. \- #include <mach/memory.h>
, M* I6 s9 p1 b5 n - #include <mach/hardware.h>( L1 J( L2 m' p( p
- #include <mach/irqs.h>
: |! y+ H- D# ?8 b0 t# y; @; @ - #include <asm/hardware/edma.h>
( ~ L+ G7 Z) W6 M1 b M G$ @- M3 I - n8 x! R+ D$ n) [2 h5 b7 ?
- #undef EDMA3_DEBUG
) T5 R0 n+ B9 v' q) v - /*#define EDMA3_DEBUG*/. a" f0 ]5 W2 R; T3 g' j$ g
- ; E2 m& n+ v+ J$ h- j% P, G1 }
- #ifdef EDMA3_DEBUG
3 `# ?# t2 x% R: W" g. d4 ]% W4 d+ Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 J* r: @9 f" g" Y ~3 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ?$ \1 m- r$ E, V! q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), \% _1 o$ {7 Y! H: L+ A4 Q+ I
- #else
: J0 y) f; R4 S+ e$ M' g: \; ]; C - #define DMA_PRINTK( x... )7 s3 E P; R! u' i" k$ `7 s' O+ ^
- #define DMA_FN_IN
* n" l. b) j8 t2 [ - #define DMA_FN_OUT
9 v, d' O. r. G J8 \) p( `& g+ m# i - #endif5 @# S! T: j8 L. j& |+ p9 t" h- ?
{: k+ I- Q; T6 i7 q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ X/ f b" p) i _% F9 F
- #define STATIC_SHIFT 3, a7 \. z4 C/ B( g0 w0 x5 |0 `
- #define TCINTEN_SHIFT 20" p% |0 t: [* @9 b! }4 y) H7 C& D
- #define ITCINTEN_SHIFT 21
0 a# Z4 @5 x5 J - #define TCCHEN_SHIFT 226 P% Z+ a$ a8 m. B+ i7 {
- #define ITCCHEN_SHIFT 23
/ c5 a- ^0 Z1 ? ?8 x3 K
* A/ d* l# w) C- static volatile int irqraised1 = 0;
6 L% K& X5 A) d5 m3 e6 r2 B3 L; ~ - static volatile int irqraised2 = 0;
7 s, f9 v$ s2 Y9 U0 C) K - 2 K7 d' M% ^( D; W0 u p a, C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% q6 d/ y! C9 m7 [( r$ D& I6 ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* w4 ]& C# |3 ~5 A' ]3 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; [# K* l5 m$ @# }% R
- / c1 O3 e+ b8 F/ a# h
- dma_addr_t dmaphyssrc1 = 0;
& B( Y5 O/ J- ^, t+ r9 h( {6 S2 z - dma_addr_t dmaphyssrc2 = 0;
! I. M, X0 g, E$ Y5 h' j - dma_addr_t dmaphysdest1 = 0;7 l `- O* ^9 X3 U) Z2 f
- dma_addr_t dmaphysdest2 = 0;
/ z+ y6 [! k0 y9 K: d* W
5 q# Q5 a5 R6 O- @0 q- char *dmabufsrc1 = NULL;
; _0 B0 w: ]: |2 V0 e* T! d - char *dmabufsrc2 = NULL;
$ M% p, V" J8 N, P; X - char *dmabufdest1 = NULL;
4 w' F5 t2 F- s- u% S4 _ - char *dmabufdest2 = NULL;
\ ]3 t; Q3 c! P$ D* q5 g" d
7 _. z2 N @7 Z, Z: n* ~- static int acnt = 512;
8 B# u9 B1 Z; e& F/ p# c# [3 l2 w - static int bcnt = 8;
6 Y: K. W/ C) {; k - static int ccnt = 8;4 o$ A! ~- b$ Y1 o; n
* E% O) b+ I' s8 P& \) `. l- module_param(acnt, int, S_IRUGO);" {& `6 P+ L5 J8 K0 N
- module_param(bcnt, int, S_IRUGO);
, z0 H, f+ m& {, d% R9 @ - module_param(ccnt, int, S_IRUGO);
复制代码 4 [. d9 j6 k! Y6 r( p& Z# s
3 k9 w+ G9 | P' }* k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ^, M [. T* ^+ v+ `( y/ Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ C# @, f7 U* K) ^7 f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 x* U1 M- Z8 d$ b! |
2 V3 X2 s6 R0 {
! e( W: e& q. _- k7 p% Q7 T, m
|
|