|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% U% _* m) h% t, }3 ^3 e7 w- [code]EDMA sample test application
. N( U/ @, \; c7 z, ~! Y - /*
2 X0 ?3 X( k r- i) B6 f- C4 M - * edma_test.c r1 Z1 C [) t- Q2 @7 L3 S( i
- *# k! ?5 x, \5 Q% Y* N( O+ X. b
- * brief EDMA3 Test Application
5 l9 ~5 W4 p' n1 h$ e - ** u* v- O/ } t9 z
- * This file contains EDMA3 Test code. M* J. `4 |! m" M
- *! Q6 n- \" M/ u6 x( ~6 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ ]" Q" @, l0 m3 j. i, i* q' b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 b; g2 E4 ?7 G; X - * TO CHANGE.
! d/ c1 M9 l& I: t' Z6 h - * }" i1 H% h2 u' O# e- `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, h* ^5 K( I( H" b# O0 ~
- *: z6 K6 I+ y O# l0 p2 W
- * This program is free software; you can redistribute it and/or0 y @6 y1 x4 Q: g
- * modify it under the terms of the GNU General Public License as) Y/ U3 P3 [$ ]
- * published by the Free Software Foundation version 2.
" n) ^1 \/ ?) a+ R - *3 F' j, j+ i8 P( B9 k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* W6 y$ b. D" ?7 K; R
- * kind, whether express or implied; without even the implied warranty- u8 A3 q* @. B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
R0 D% f( E$ I# m* E3 d. k- \ - * GNU General Public License for more details.
9 B$ ?1 V' L4 P' h' I - */
; A2 d5 C7 T, l0 A
9 H8 x0 O, q" }5 U- #include <linux/module.h>6 p8 `2 v* R; {4 Y! e3 ^* Z8 [
- #include <linux/init.h>
3 `5 ?. |& o" [4 h5 u9 A. b# M - #include <linux/errno.h>
( K8 C+ F8 L! E- h8 d% P! i9 U - #include <linux/types.h>
# g, o4 e( C, ~0 [; | - #include <linux/interrupt.h>) N! c0 m& c) F. q! e4 o/ Y! f
- #include <asm/io.h>, @' G# \) V* q5 D) |
- #include <linux/moduleparam.h>0 S2 S7 U! L/ \ m$ v
- #include <linux/sysctl.h>
2 S+ D% D6 F( C# o+ S - #include <linux/mm.h>
* u7 M3 h1 z, O' m7 n - #include <linux/dma-mapping.h>
6 q* H) A% q4 f
5 l$ U6 j; X. C0 F, e/ @- #include <mach/memory.h>
6 ]- i2 f z( H: U3 u* {4 c - #include <mach/hardware.h>5 |" h, H& ]8 X+ ~3 }5 v5 l
- #include <mach/irqs.h>
% t# T1 p" @+ r- k) |7 i - #include <asm/hardware/edma.h>; P, e# m& M" Z% o( ?" J
& B' T5 i6 G* P' D) [, e$ x2 C3 N! V- #undef EDMA3_DEBUG
4 h/ `) p+ h' u u0 H3 z - /*#define EDMA3_DEBUG*/
8 r5 y* ]5 H+ @ v: W# c - ( Y" v" A6 C* r: U% n. e& k/ Z
- #ifdef EDMA3_DEBUG
P0 S3 a$ r* p1 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' X7 j" y* U5 k i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( `8 n. x3 y' ~; I! Y# @: H$ m8 n+ S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' n3 K4 a5 G7 [3 ] - #else
, r* X$ _' h1 z) Y. N* E& y - #define DMA_PRINTK( x... )2 J. F, n& g/ X! B
- #define DMA_FN_IN
( f1 \: L- q9 G/ y% Z - #define DMA_FN_OUT
" y; m( _, L3 {- f/ U) {, V - #endif. X8 w, M, _1 e0 p
. b9 z3 R! {/ g& C) `$ b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& g8 Y0 y- V) w
- #define STATIC_SHIFT 38 l3 R- m# s" ^ I, H
- #define TCINTEN_SHIFT 20
$ }% V+ X$ Y2 [8 u7 _/ f" {! s+ U - #define ITCINTEN_SHIFT 21& ] s# B6 |1 v/ z
- #define TCCHEN_SHIFT 22. {9 f; \# g1 g$ ]& n5 z$ K X
- #define ITCCHEN_SHIFT 23- c. p. r' z' v" v, A4 z, k# R
- - x. r! v5 b$ D% G+ O" K5 j7 _
- static volatile int irqraised1 = 0;
# k! U9 @- k( ~; I3 k, v) o v' V - static volatile int irqraised2 = 0;
; n& D! c" S7 P4 B8 ~8 Y4 d. U - ( u8 P/ }/ b* u, K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r4 m, w/ C6 H8 x! @ y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F7 X# `" \0 H% d4 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 B: R' J; V1 b$ c9 \4 x7 K. j( d - ; @0 k7 l: K. k# A: l6 |! d$ ~
- dma_addr_t dmaphyssrc1 = 0;: E8 @' t' |9 x# y2 ]4 g" p
- dma_addr_t dmaphyssrc2 = 0;
' R- M# D; J$ |* C) D; Y - dma_addr_t dmaphysdest1 = 0;
! Y) P% ? [% ~1 t/ @% M - dma_addr_t dmaphysdest2 = 0;
! P; ]9 v( p8 x( A - : V. t3 E& m& r
- char *dmabufsrc1 = NULL;4 ^" ?1 s R' f* f, `' o/ \
- char *dmabufsrc2 = NULL;
3 J; W2 u' c) Y! J% o - char *dmabufdest1 = NULL;- N# n P/ _$ |% s
- char *dmabufdest2 = NULL; }7 m. T7 H/ ]( n, O# w
- . H) g( R+ B! b8 N( x9 R
- static int acnt = 512;
* D1 r1 H) I2 R - static int bcnt = 8;
( L) s: |. Q& t: |/ `: W$ o - static int ccnt = 8;
4 i3 |) i7 E) M: n2 f J
M% Z, k5 p: H w- module_param(acnt, int, S_IRUGO);5 Q( q! X, r8 X. z/ j; T' u& v
- module_param(bcnt, int, S_IRUGO);: o4 N* m8 c. M" u
- module_param(ccnt, int, S_IRUGO);
复制代码
, B5 b7 ^0 }4 b' f$ O# ~' l. ?6 Z9 j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 A0 o6 h8 J3 x1 t2 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K3 L" c+ G3 l% m9 X6 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
\4 S; f+ u" q1 B M& U( k; V t& w# j5 W$ Y
" X# l4 v5 J' V: |' g+ s* X/ g5 y
|
|