|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & |. r7 d* C( ~1 ^" ?- b+ z' q
- [code]EDMA sample test application$ s) k# a, n) e
- /*
, O& Z' U$ t* K - * edma_test.c
' l9 h% i; u* | - *
) x8 Q% ]6 ?% `; t5 T2 f' f - * brief EDMA3 Test Application
+ Z5 b4 L2 M& E+ ?+ d+ b' n - *
' s0 T: v0 I6 b/ H- J - * This file contains EDMA3 Test code.* f/ H5 n) O7 q8 t; F0 l
- *' v( J( @# G: t6 w# H! O* b$ G$ E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& P7 e0 f' k( K8 m# n/ Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 U" j9 _' n4 d1 O L4 d - * TO CHANGE.* O/ q$ a" u: P Q- z! @
- *, x, M z& X' s3 K$ q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; {) i1 f4 B0 U' U x" D& G7 I - *$ {! o4 k( ]9 O, F( [
- * This program is free software; you can redistribute it and/or
4 n8 R( I8 H' L# D) [! K: A - * modify it under the terms of the GNU General Public License as) _6 J4 _, d. m8 z
- * published by the Free Software Foundation version 2.$ l" p. q( Y8 A- U4 z+ |* Z
- *
8 T8 v4 T! p# i6 Y$ I4 V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- {$ d% j3 H8 A8 O. } - * kind, whether express or implied; without even the implied warranty+ F5 M3 Q, O( O ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 A8 w* q/ P' o& S- X
- * GNU General Public License for more details.: y4 k/ F. g# p! [7 a
- */
% a2 s7 E5 y. r - 8 H+ Z& w) h* S: [
- #include <linux/module.h>
' Z+ t7 k3 v" T6 u - #include <linux/init.h>
/ A' M7 c% Y. M+ \) d) ], Y; l - #include <linux/errno.h>
0 y( b H" T* ?/ p! n - #include <linux/types.h>
, a) G% v& Z2 N, d+ X/ @: L" ` - #include <linux/interrupt.h>
, N, h. l7 J8 D) N6 f0 v - #include <asm/io.h>+ J( R4 v7 P" }5 h. X9 Y2 f6 @& f2 R
- #include <linux/moduleparam.h>* B, A- V. v) d$ w" Y4 O: {, t0 l$ Y
- #include <linux/sysctl.h>
- ~: K( t; I0 ~ - #include <linux/mm.h>( K) I- N* Z% z; A
- #include <linux/dma-mapping.h>
6 ]$ W8 K9 ~2 ~* F, | - : c! n% I* L4 r/ l1 S! Y2 W
- #include <mach/memory.h> t' K! R+ B/ w& ]- P
- #include <mach/hardware.h>: B& X, `, P$ h. y
- #include <mach/irqs.h>
3 A5 |- f+ T/ U3 D- Y7 P. u& q - #include <asm/hardware/edma.h>' M2 c5 n& h( N/ q6 A; O9 }
- 6 F6 F" U* S) T. m( q; r
- #undef EDMA3_DEBUG
" }( p. }( ?* p7 t3 r# t - /*#define EDMA3_DEBUG*/6 j. I6 d( W$ `, Z6 b( O
0 n5 e% m, k, K7 d4 h7 i3 P- #ifdef EDMA3_DEBUG2 H8 x; i1 g I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 g7 A0 ?1 s8 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 p- S! ?7 Q2 ]9 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): y V5 c6 v; t. B
- #else
: f/ L5 h- _9 p7 W1 h$ G - #define DMA_PRINTK( x... )- o. F' ~- u: D( _2 L
- #define DMA_FN_IN' r" O. m! P' \2 t( Z0 q1 v0 A' h
- #define DMA_FN_OUT. w' x0 N: k0 i
- #endif
( d( F8 m1 n% N5 r
( s, D2 v! L/ V! h- #define MAX_DMA_TRANSFER_IN_BYTES (32768). W& [5 M& G9 J$ z, s
- #define STATIC_SHIFT 3
/ O B) Q& s5 l6 A9 U4 ] - #define TCINTEN_SHIFT 20, D5 @+ W! k3 q% [! @! ?
- #define ITCINTEN_SHIFT 218 s& q& I( S# Q& K- m8 I& w& d; `
- #define TCCHEN_SHIFT 22: k4 |1 X0 |; W
- #define ITCCHEN_SHIFT 23, _) r6 M6 L( p) y4 v$ l- i4 v& E4 E
- / O1 f% H( H6 J+ ~) s7 u) b
- static volatile int irqraised1 = 0;
+ [+ E3 g, R& H( L: H - static volatile int irqraised2 = 0;
' x4 N9 ^( k* V$ l0 J- M
) U+ ^$ j2 [1 _/ b: ~2 K3 L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. s! K! k. e1 Z8 e7 }1 B; e r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 x3 p, a4 \9 a) J. F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 C. ~$ x# {, ]4 ]9 V _4 Q' `
, K8 w0 L6 z; [2 {1 i- dma_addr_t dmaphyssrc1 = 0;
6 B: I2 D9 w! w8 m - dma_addr_t dmaphyssrc2 = 0;9 K6 W; o2 {' Q# R
- dma_addr_t dmaphysdest1 = 0;/ e( q' X$ |% l+ y
- dma_addr_t dmaphysdest2 = 0;( X% c- S. m2 `: n
_7 q+ f' m0 N4 O2 \- char *dmabufsrc1 = NULL;
2 j5 d( O& x. v3 J V8 o0 y - char *dmabufsrc2 = NULL;, |0 P- g; F1 n( u0 e
- char *dmabufdest1 = NULL;6 h5 ?$ h4 [* F$ z" ^ K
- char *dmabufdest2 = NULL;5 a6 }3 [3 I& C, B" d
- * y/ y2 y& \% R2 [' @6 M. C
- static int acnt = 512;
4 P* o. j" X" Q# L2 E" N' C - static int bcnt = 8;( e, n) L$ c+ \0 `& \
- static int ccnt = 8;/ Y: }- W1 S5 k$ V7 V/ K2 U: w
) A% p% |% P5 n+ c) g( E+ O- module_param(acnt, int, S_IRUGO);
- _7 D8 |+ Q' F/ L# c8 B$ K3 {4 t& n - module_param(bcnt, int, S_IRUGO);8 l* C& _. ^9 e; |
- module_param(ccnt, int, S_IRUGO);
复制代码 + c$ \/ i3 N: k+ K7 W7 s
- }7 e( P. q: S5 \ F+ C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 y; n) b. G% k7 k3 h) Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- S4 ^6 [; L+ K- W$ a9 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ C1 r0 r! r$ d( ~" h/ I+ j
- e0 C5 B$ L6 {' i9 o1 m6 u$ K% T/ A" j: y
|
|