|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 H+ h& C( P b; d$ ?- [code]EDMA sample test application/ Y* P) V9 b8 A9 I& Y& T
- /*
' {. t$ }# A0 `) h5 e" U0 ~ - * edma_test.c8 R0 h# u: z0 z0 H; {( K8 J
- *8 ]% O$ K j( O- {
- * brief EDMA3 Test Application
* e1 l+ N% H/ Z8 T! ? - *
- [* h' O8 C5 C - * This file contains EDMA3 Test code.7 t5 Y1 c2 D$ W. h0 X
- *: L; j1 \; O& f7 t" h7 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 J' f: N |7 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 V# P, T0 p7 r - * TO CHANGE.6 \6 ^0 C- ~' N* n! E' ]
- *
5 _7 T. |) P' R' i: A' s/ m% H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& d9 {: d" | A/ k2 [* m: C
- *! E8 o: _ o& [
- * This program is free software; you can redistribute it and/or& M# t& T# Q8 e
- * modify it under the terms of the GNU General Public License as
9 j) D% x8 I; G. {) h0 x - * published by the Free Software Foundation version 2.
' ]! j6 U" Q) c+ x - *
: K3 \# _& A, p1 |; J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( L" X0 D, B1 M0 {: Y, m
- * kind, whether express or implied; without even the implied warranty( @; w f) b/ X
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, P( f/ [* X6 H1 O
- * GNU General Public License for more details., G0 f9 Z `: D5 I! `9 J8 w
- */0 m) X M% S5 D
- ' {) E( `1 F; y( i4 I0 N5 I
- #include <linux/module.h>
: h- e' w8 [2 D' X5 g: c" g - #include <linux/init.h>* |0 L7 Y# ^/ k1 h0 O: Q& r
- #include <linux/errno.h>" |5 j& `5 k( g x, z! I- O6 h/ D
- #include <linux/types.h>/ |% N, f+ k4 Q" l# u+ G
- #include <linux/interrupt.h>( b+ E+ n. M9 V2 O# n' J* J- o
- #include <asm/io.h>
' h) `" J9 a% u, x - #include <linux/moduleparam.h>
5 D7 ~/ J/ Q. x' ^ - #include <linux/sysctl.h>( ^0 v/ n& E6 e4 ?! j& j
- #include <linux/mm.h> H( D+ k+ J' X
- #include <linux/dma-mapping.h>
. a* z3 _, Z$ E
/ \3 M9 B; `: x: n& s6 s- #include <mach/memory.h>" w# V9 f+ K9 T0 g
- #include <mach/hardware.h>& x# F! V) F1 o
- #include <mach/irqs.h>
7 ?2 @+ U2 ~, T. ] - #include <asm/hardware/edma.h>( e3 `5 p6 Q3 p9 K/ l
- % B5 u: E X6 U) i+ C/ C
- #undef EDMA3_DEBUG' l- O% d- P* x4 G% g1 ?& v
- /*#define EDMA3_DEBUG*/
% e5 n) A- g' w - ( T4 r" H3 m; S
- #ifdef EDMA3_DEBUG, A9 a" Z5 c: A" ]/ [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
u+ H2 c3 ~: K9 g& e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ]- H8 i+ I* K5 y+ H; \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): _; a( ?/ h0 L2 ~& x8 g
- #else
3 `( C4 t9 m% S) [ V( e& } - #define DMA_PRINTK( x... )8 i+ B6 s! T' g) o6 D* E: | w
- #define DMA_FN_IN
& ?+ M' K: ~2 n i8 w9 [! { - #define DMA_FN_OUT
" A- @* p0 z l( d7 T2 T - #endif3 N' K: J$ E3 u, M9 I( z
- 4 l3 l2 F+ \+ X6 ~' n5 Q, g4 a* _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 E0 I1 B4 {4 m
- #define STATIC_SHIFT 32 I5 m3 C7 K% j% y& W
- #define TCINTEN_SHIFT 20- X2 [# K' C; L& {! S
- #define ITCINTEN_SHIFT 21
! g7 b# U' H5 D: R - #define TCCHEN_SHIFT 22
6 X+ K4 B6 K8 C7 K# W - #define ITCCHEN_SHIFT 234 N) K9 }! N% ^! H7 R6 d) G+ \ }) C
1 j% R* d0 \. V7 }# y- static volatile int irqraised1 = 0;9 O( b- q/ ?6 s& G O3 z& E2 y0 j
- static volatile int irqraised2 = 0;
4 C$ u* e/ f0 e$ O9 j
2 \2 W/ f x3 y5 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ?' m, |# R8 m0 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 U5 z* ]. t* O O$ E. G% x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 M; \! D3 y' Q) z
: @ c4 K. G7 z; F- dma_addr_t dmaphyssrc1 = 0;
6 o: @' ?# M0 o - dma_addr_t dmaphyssrc2 = 0;5 @7 H% i& C2 G# n
- dma_addr_t dmaphysdest1 = 0;) C/ W3 s# ~' Z; X. k( L/ [
- dma_addr_t dmaphysdest2 = 0;
6 I2 C V: j p4 n
Q9 K& y5 t" q! }, r, B- char *dmabufsrc1 = NULL;
$ C$ r8 C' H7 [& ~8 ~1 @ - char *dmabufsrc2 = NULL;3 \# v) e& M# u4 u+ {7 S+ ]; V4 O
- char *dmabufdest1 = NULL;% X3 f* U# a3 m4 q Z
- char *dmabufdest2 = NULL;
6 A" Y) X) Y; m9 H4 w8 O - + t0 X4 k, u' B/ k, G
- static int acnt = 512;0 r" r7 {5 \- B, Y& V4 s
- static int bcnt = 8;
' ?6 h2 B" Y3 ?3 V - static int ccnt = 8;
* |+ o1 s$ x" l
8 {. i9 s0 ]5 T, Y. A- O' N; }- module_param(acnt, int, S_IRUGO);" B, s1 a3 K* u$ i Y4 o7 o
- module_param(bcnt, int, S_IRUGO);
! |: g- `/ K" s: O* k7 S; e0 C - module_param(ccnt, int, S_IRUGO);
复制代码
9 o3 ?/ `9 G) ~. v5 `
- ^7 X( M" C8 y0 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ u' X2 u: u9 y3 R- e" _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! _. z8 b+ e8 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- o9 u& E& S9 @$ G. _9 \ T! p2 f8 X: [) X3 t
8 c. [; z5 ]0 s3 W% u" [9 N8 i7 C3 Z1 T
|
|