|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- K* M9 x! c' t- [code]EDMA sample test application7 w( n1 D1 n* k8 e& Q
- /*$ c8 ]5 u& t& \* H. \2 P' f5 ?
- * edma_test.c, z- \& m0 Z5 \# A- T& _
- *- L7 H- h/ m+ [! b) }/ t2 T
- * brief EDMA3 Test Application
# j" ]- P5 I" \' F. Q1 s& _ - *
: z- v$ b4 I) `$ ]8 { - * This file contains EDMA3 Test code.+ ]! T x1 A7 ~+ l8 P6 h
- *
) t( C2 F) k/ u+ }/ C3 k I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- O. R3 g/ O/ w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 O" g5 T! G% g! E6 Y$ x" X
- * TO CHANGE.
7 h9 @7 G/ H8 }! K0 \" s% i8 s - *+ Q! U6 @) {2 o- m) h3 g' U o6 Z7 v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 G* u' j* O. O9 ~ - *, {) @# s: L+ G0 I" D) n N) @2 U
- * This program is free software; you can redistribute it and/or, f1 `8 E9 Z. L
- * modify it under the terms of the GNU General Public License as
6 ~, z. @9 R, Z' B - * published by the Free Software Foundation version 2.
' O. ~/ k/ D* W7 q - *! B( n% g8 g- h+ ~- [- a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- @! ]5 \9 j+ @, @
- * kind, whether express or implied; without even the implied warranty
; R0 p8 Y# e6 I+ z: F9 X; e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 n, x. W3 J3 d2 U9 @" u3 I9 F - * GNU General Public License for more details.6 {8 R1 z4 F8 c1 O5 K( @* J1 @
- */ ?+ H' Y( y4 k5 ?. Z
- 5 D+ i1 H6 \$ X9 c
- #include <linux/module.h>
/ V8 [- N9 v3 B, j& e - #include <linux/init.h>
- u5 ^, u% f. n& F% G2 ~ - #include <linux/errno.h>" U0 `% ~ p& n2 ]% ]: v
- #include <linux/types.h># F- r9 B' Y+ x5 e# q- v
- #include <linux/interrupt.h>
6 \3 B% E3 l1 c - #include <asm/io.h>
( L* P+ e3 X+ { - #include <linux/moduleparam.h>
2 d; g l- x. t - #include <linux/sysctl.h>3 d9 Q, v v, a) z8 t& ?1 u
- #include <linux/mm.h>; A) B" X( p* B! b8 w
- #include <linux/dma-mapping.h>
]9 P, ]7 [! Y! K2 ]2 z
4 i. e9 N' N/ \5 z4 _( @8 u2 I- #include <mach/memory.h>- O- z$ M" c% M% J' s# I
- #include <mach/hardware.h>4 m" q# g. j7 L7 O% E
- #include <mach/irqs.h>5 R4 d/ l0 D* v0 I* ?( ?" h% a0 N6 U
- #include <asm/hardware/edma.h>
" H) |! R( f& c- B9 T
2 a0 U) t' q3 z$ ~% [; u& P- #undef EDMA3_DEBUG8 T1 h& v6 Q2 e2 ]
- /*#define EDMA3_DEBUG*/1 c5 a4 I8 o/ R9 b
- 8 ]& ], x: [9 B" Z& Y2 N$ P, D
- #ifdef EDMA3_DEBUG/ {, i1 f# @3 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 o# `# ~+ y9 k5 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 c# _" f) w; T4 k: Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 W9 A$ b) J6 K8 G& g; _ [/ i$ n6 T6 N
- #else' a& v2 I+ d1 Q9 d+ a
- #define DMA_PRINTK( x... )
- p) r$ N3 ^- |9 n$ | - #define DMA_FN_IN
5 U5 U2 k/ E- Z# d - #define DMA_FN_OUT
. h" s5 L( J" p- u' s( D( D9 c7 E - #endif& W+ D7 A/ H, b* \/ x
- ' ?% m3 {+ X' t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& u- Z! @1 G, B- @
- #define STATIC_SHIFT 3- F1 _6 p- h/ c2 x3 u5 q
- #define TCINTEN_SHIFT 207 i0 F* A: b# d s
- #define ITCINTEN_SHIFT 217 w" S% }) f5 x( x$ `
- #define TCCHEN_SHIFT 223 C( J- n! z8 w* r! ^8 A9 H
- #define ITCCHEN_SHIFT 23. S- u$ D4 @7 P
9 a% [* M f0 @; e) }- static volatile int irqraised1 = 0;
9 d7 }- n$ q' J& y! \# y& ^7 @ - static volatile int irqraised2 = 0;/ x g0 R2 v" |8 D5 f9 O
7 f! \, J. }3 J8 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T# L: s2 C& e2 ?2 R* _) x" \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* }* }( F% k6 O% W8 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, A) W/ T7 M+ M/ J0 Y/ j$ q; d9 y
- 4 J& C* r/ E6 o5 J7 o
- dma_addr_t dmaphyssrc1 = 0;
( `5 r. \* |- k# x0 Q! R8 Q& T - dma_addr_t dmaphyssrc2 = 0;" o: c+ V4 T9 ~/ T% J+ X- I
- dma_addr_t dmaphysdest1 = 0;: M$ ]7 C8 T" w; a' s7 c( ^! ^+ E
- dma_addr_t dmaphysdest2 = 0;. t3 q6 w. T6 y$ i3 y
A/ ?% V* U! _1 n- B2 p, F J- char *dmabufsrc1 = NULL;+ f. B( Q5 D |" O3 U/ G2 l9 l7 y
- char *dmabufsrc2 = NULL;0 L/ g( i3 t' b4 }- {4 C4 \
- char *dmabufdest1 = NULL;( Z+ E3 [4 n4 F6 [. o6 J2 [5 q
- char *dmabufdest2 = NULL;/ @1 M7 j+ T. K
- 6 d. j/ S- ?- [
- static int acnt = 512;1 g4 o$ u1 M- P
- static int bcnt = 8;
3 K) F( Q+ o/ h9 X$ } - static int ccnt = 8;- F8 s# k- r/ p4 `' K
, C$ o) Q5 [' g% W- module_param(acnt, int, S_IRUGO);9 P9 A' j) k. k+ c& Z7 G5 [
- module_param(bcnt, int, S_IRUGO);0 i+ ~* n+ ~: ^" E0 u+ D
- module_param(ccnt, int, S_IRUGO);
复制代码 1 b2 Y- S6 E+ V+ u+ n2 Z% A6 ]- H
) l! c# u5 B' P }* l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 x% } S. S$ v! W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ x# _% }& Z/ d- o% f4 W% R% `$ ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 f8 y8 H! v; V" K! @ S v
! ?0 r4 g6 X" g! ]' D \) t* Q8 D
|
|