|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! T, l' w1 N0 y. h- [code]EDMA sample test application) P- h6 z- M6 f( A G3 g% _( @* z
- /*
7 l% }: E0 L% k4 o - * edma_test.c+ M: C5 q# I% d2 R1 D. a
- *$ P+ D3 {- L# z- b0 ~: i
- * brief EDMA3 Test Application
1 s4 V% [% K0 y - * @/ H7 s3 y' O6 r! l
- * This file contains EDMA3 Test code.
' m2 I! T2 w5 d9 q. o g - *6 o; i& M3 R6 F4 M1 z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# p& r+ i- c/ j+ p% v; J6 J1 Q& ~5 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 T6 F& W$ w p8 t+ W; b
- * TO CHANGE.0 I; w2 r2 t+ q% ] m/ ]7 X9 G0 M
- *. ?: V, O6 E1 C v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v0 u7 T1 C9 G. T! I
- ** n5 n8 T- E$ X$ _; ]0 o2 T/ B* c
- * This program is free software; you can redistribute it and/or
u( u( { s, b4 P- {# F+ o4 T- c# x3 | - * modify it under the terms of the GNU General Public License as
X, u9 p* z7 A) ^# B- Z" E - * published by the Free Software Foundation version 2.( _+ a8 _9 n4 F5 L: O( H; O3 ?
- *
\$ ]: r3 P& k5 J1 b4 T; g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 d( b) d. I. P& x. Q - * kind, whether express or implied; without even the implied warranty
9 A3 w+ N7 I X& j8 [" H$ o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! m/ q* K0 I2 M( L5 |
- * GNU General Public License for more details.
2 ?9 { M/ G# K: H0 R - */* T: V& v/ @$ M
$ c( E- `& U1 R" S- #include <linux/module.h>
' f: m O8 {' p. V! \7 [3 h - #include <linux/init.h>
- y) @/ U0 _- N" S- r9 J2 l - #include <linux/errno.h>9 |3 V2 C/ ]1 y
- #include <linux/types.h>
' v! D( f- R6 i4 t; O - #include <linux/interrupt.h> @0 S8 o8 e7 e* \. ^) V3 w
- #include <asm/io.h>; f3 Z- @: i( g
- #include <linux/moduleparam.h>, E# O8 S! y0 V% c
- #include <linux/sysctl.h>
: ^% Y1 p1 _) G+ \/ Z+ { - #include <linux/mm.h>
. Q" A9 a* G4 \! |; w - #include <linux/dma-mapping.h>
8 I! ^3 B/ w! [8 l ]* a
; g4 k8 l' E3 D4 F' u+ U1 Y- #include <mach/memory.h>8 Q$ h/ r0 \& I- _
- #include <mach/hardware.h>
3 E* ]1 |+ B3 ` - #include <mach/irqs.h>; h8 n/ h, A6 ~' @
- #include <asm/hardware/edma.h>
' B8 S& v" I* ^. h* Y! O: A - ) g( a; F8 b8 a* `& q
- #undef EDMA3_DEBUG
( t# `1 j) ]! S4 U - /*#define EDMA3_DEBUG*/
, k! o& f, ?/ d, p) r" u7 a, m- m - 8 C f" _! J d* ?" _ V U
- #ifdef EDMA3_DEBUG
( C9 b/ k" z( i2 s7 J$ Y5 Q/ p% E' E+ G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) o {4 N b8 q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. D b- H; ?& t) Q' X& M - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ ^" Y+ u0 [( }4 G6 i* V }: F - #else+ J( W3 J" i# v0 L
- #define DMA_PRINTK( x... )
+ A- x$ p3 _8 q& n8 O: z - #define DMA_FN_IN. B. x1 v1 ?5 E/ i! b/ I |
- #define DMA_FN_OUT' y; r" d1 V6 U9 z1 y
- #endif
# j( `5 t8 s, C$ a; T! m6 P" I/ T - $ k% j- }6 e' \- \8 v, N: `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: s/ K2 }' I6 s- f2 q$ L2 a; p' P - #define STATIC_SHIFT 37 X* u# s9 o; `
- #define TCINTEN_SHIFT 20+ y3 M' a/ k0 A1 w& w u. x" ^7 M7 y
- #define ITCINTEN_SHIFT 214 ^. U! R) K) b
- #define TCCHEN_SHIFT 22
9 d* F- H3 F, J% t, k0 | - #define ITCCHEN_SHIFT 23
8 w: }) M0 l7 y7 a7 D5 O8 I - : }; H8 c. s. a1 g
- static volatile int irqraised1 = 0;
$ y, l% Q1 A' {" I+ m" @2 e! W1 e6 v - static volatile int irqraised2 = 0;: s! Y- {' ]8 Z7 u+ Q* I
- - I& E) `! K2 ~! f; d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! `$ }, l" _) j8 h5 k) ^3 W* h* O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 x5 I& r$ T _$ H$ M# S( ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 f5 N# ^0 {0 E! u1 k: L5 s
4 d0 ] ?9 Q4 d- dma_addr_t dmaphyssrc1 = 0;
S3 |6 ?& R( @3 H, _& u2 J) T - dma_addr_t dmaphyssrc2 = 0; z5 K- |) ^& C D. p1 e* x6 J5 c1 {
- dma_addr_t dmaphysdest1 = 0;
: }/ m3 z) \! u# g - dma_addr_t dmaphysdest2 = 0;
1 v- q2 H [) ~+ g - / G. n; r {5 |) r3 p. ]. _7 ]
- char *dmabufsrc1 = NULL;* \. ~* W" R. v h+ h
- char *dmabufsrc2 = NULL;
+ l+ c1 p' ^: d5 }$ Z - char *dmabufdest1 = NULL;
% W$ K" V" A7 @ - char *dmabufdest2 = NULL;" j7 G7 g6 E R$ G: N) Y( S
- 6 B6 n$ i# _. e- x" O6 |" Z
- static int acnt = 512;; x9 N; ^7 L6 F8 Y
- static int bcnt = 8;' V4 X$ c1 r5 o7 d( z
- static int ccnt = 8;
; W# O8 t- ~4 E: Q6 ] - 5 Q; C$ ?3 \$ |2 \& b3 ^( ?* u
- module_param(acnt, int, S_IRUGO);2 l' ]5 Q- K% a7 y
- module_param(bcnt, int, S_IRUGO);' r: h1 Z. N, g
- module_param(ccnt, int, S_IRUGO);
复制代码
; U: j9 S5 A) Y3 `6 W4 `9 E9 Z5 p0 b4 C% Z0 l3 b( d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 H1 {* T$ a( o8 d9 ^- _% G
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ e8 ~. ^. @+ q- g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' o {; a8 R/ `+ w. j q: r/ `' [* @: O' l, e
8 z8 w2 S7 g6 H* N
|
|