|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 P$ B+ i7 T* D+ ~% o
- [code]EDMA sample test application
[5 e2 U8 r; H+ ^5 {, M S2 v+ ^ - /*
O6 [9 x( M9 t' n0 p" R" {0 h7 y - * edma_test.c
& n- u% o# {9 @4 \3 N- ? - *8 y0 Q% K. [4 q* h
- * brief EDMA3 Test Application+ b+ {; Z+ o5 `* ?
- *6 @$ \6 |* ~2 Y" g" E2 s7 ?0 K
- * This file contains EDMA3 Test code.; K+ K) j5 c) V+ F
- *
8 u/ w. g, K9 x" k/ W! g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ c! @; p9 e+ \$ G% s* Z0 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ S) S l9 |' s/ U1 Y6 m
- * TO CHANGE.! B7 y) P) X0 h7 F" X
- *8 ?/ b' v+ Y: q$ K$ ]6 v5 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Y @/ K! A, ^/ f( @
- *( T' I% @4 j: Q. ]- \
- * This program is free software; you can redistribute it and/or
, Q( F& R0 H$ j. o# o7 v - * modify it under the terms of the GNU General Public License as
& b% ~( m2 a- d/ J7 ?" H2 M' M - * published by the Free Software Foundation version 2.0 h w; B3 [) \
- *
4 ?( ?. a" r$ O6 H. f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 \( d3 ]2 Q) L& z( k: l, p0 C
- * kind, whether express or implied; without even the implied warranty
6 s0 P& w# B- l. {4 Y# k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 Y( S, |7 Z& Y9 f$ k4 p
- * GNU General Public License for more details.0 `* P' z/ F G' [3 X
- */2 H: q; |! G5 b) P, T
; y! @6 M/ v+ M$ e' C2 o7 ?% e- #include <linux/module.h> W% T6 Y+ A( x: d: u
- #include <linux/init.h>8 f0 w: u# R0 J }* ^' p
- #include <linux/errno.h>" ^0 @% p7 x8 M* {2 f; r/ |
- #include <linux/types.h>
% p" u( ~/ F, W0 ` - #include <linux/interrupt.h>& K9 {6 {! N* k- q
- #include <asm/io.h>
( L; z: _# u( Z W& X - #include <linux/moduleparam.h>3 O% B# `1 B {9 b' ]* Y$ C9 o2 j+ d' ^) l
- #include <linux/sysctl.h>
) N" K, w B5 X6 v% M - #include <linux/mm.h>
: S, g9 \9 ]$ T/ W! K - #include <linux/dma-mapping.h>
! \+ h5 d1 y: ]4 M% v) T - 1 K9 n% Y* Y8 P
- #include <mach/memory.h>
$ r& G9 s9 @0 K1 { - #include <mach/hardware.h>
' O' I+ e V, I - #include <mach/irqs.h>
* }7 y! m1 G# n/ Z - #include <asm/hardware/edma.h>
5 `3 t5 Z- `# u8 ~$ [
- t0 I( ^. B7 n( e- #undef EDMA3_DEBUG% D% b6 `9 I% D3 `8 Q% S+ w+ k3 j
- /*#define EDMA3_DEBUG*/, V+ @4 t* t! ^6 i$ `! ?' d
- . `: X. u0 I, e5 v n/ d
- #ifdef EDMA3_DEBUG3 t* E8 H$ p+ a# ~3 ~! H5 t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- \3 T3 N$ A8 M7 b5 D2 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ X8 ^3 i$ |, `+ f
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ P! r+ K. A. `) I5 [, { - #else0 {& l# l/ J# l2 _9 i% u- N
- #define DMA_PRINTK( x... )- S/ S0 n9 \3 R
- #define DMA_FN_IN8 L/ ~2 Z8 J b# L1 r
- #define DMA_FN_OUT
% h. P% E I8 [, ?+ i# ?# g - #endif
2 n ^+ |) X3 A7 |* _. N - * j# r W1 D8 R3 L, C7 r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# H f" ]- N2 d" E n% A0 n/ Q% _4 V - #define STATIC_SHIFT 34 a' ^ |/ W6 R5 I. I5 {2 U6 ]% P- y
- #define TCINTEN_SHIFT 20
8 Z4 D: j( w' n6 f - #define ITCINTEN_SHIFT 21. a: `* X8 R% a0 r& j' ~, q( J
- #define TCCHEN_SHIFT 22
4 o# m# {( P6 }: ~0 ^+ f" _% ? - #define ITCCHEN_SHIFT 23% ?8 g- a5 p6 z' @
- 1 m* J$ y( x; g: Z
- static volatile int irqraised1 = 0;
" _" x" F$ \- \$ g, G; j - static volatile int irqraised2 = 0;& I5 m/ @, K' a9 P% R) R
: M7 ~7 c6 F4 {5 W" y* J% E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 V4 w( g# I0 R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* m8 C3 J4 \7 ~' [( f: `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ f5 r; d3 t: ?3 z( q) L
- . i: j9 j8 }& B% S: _: _
- dma_addr_t dmaphyssrc1 = 0;
9 i0 d- c/ l* ?; U - dma_addr_t dmaphyssrc2 = 0;; h9 N! o8 \" L; \3 b# g; p1 W
- dma_addr_t dmaphysdest1 = 0;* D& H, \2 [2 N0 j( Z5 n
- dma_addr_t dmaphysdest2 = 0;" R) i( ^. L2 l' Q& V+ W
3 s( o7 B/ ~! q0 ~- F# I2 U- char *dmabufsrc1 = NULL;* @3 r0 l* b! p4 J( n f0 j
- char *dmabufsrc2 = NULL;! t" I0 ]( T# z# d
- char *dmabufdest1 = NULL;
! |% Z& P6 l6 e( }: e - char *dmabufdest2 = NULL;+ Z* U1 P- N6 {6 o- i" u, ] r
# W% i8 f& l/ k3 T4 H7 x- static int acnt = 512;4 ^% j$ e9 f0 {; R( N( Y f
- static int bcnt = 8;+ U7 L* y+ K% d3 @5 N e0 k; I
- static int ccnt = 8;1 ]6 H- B" K; t* S
- V& V- M/ ~+ a5 h- U0 i- s/ g( d
- module_param(acnt, int, S_IRUGO);% p: @" U* c% _3 ^. A1 D
- module_param(bcnt, int, S_IRUGO);8 B0 M: I! b9 t
- module_param(ccnt, int, S_IRUGO);
复制代码 + P' c0 K* f7 w- p* }' } a
I0 M* o0 O( r) D+ B: X( S5 g' [1 j/ T! I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* b. x3 b& }" g# R/ Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 g% ~; X8 {& j4 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. w9 ?5 |! w" Z0 x" s/ o: a
* F; R) g# ~ h' h7 w
, c4 M) `, E8 P2 x# H" R6 ` |
|