|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ~4 F6 d. C( x6 u! K% ]4 D- [code]EDMA sample test application% I/ K u2 _/ R" n
- /*, j+ c1 o3 B- u! J% C
- * edma_test.c3 f' { l0 N3 I. [; T3 b" x, P
- *
2 B0 h, k3 L2 d- D - * brief EDMA3 Test Application
. L# J+ T7 L0 a' ` - *8 J9 T9 D% _2 B( E
- * This file contains EDMA3 Test code.0 y8 r) W8 \- K" a) H
- *4 }- k( b& i1 v% y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. t5 N% N$ v U& E D. U8 ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, M: _# G. _0 D1 I" ?* I - * TO CHANGE.
7 G; B5 q# B2 E; B4 i3 q - *
: L) g N7 B0 \7 {" O8 K! M0 B9 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 B. c+ |$ {- ^" ]- b" r; ~ - *
# Y7 O4 ?6 S% {4 X$ q1 d. B - * This program is free software; you can redistribute it and/or
9 Q: @2 Y5 r% x1 q' \& e - * modify it under the terms of the GNU General Public License as
$ y) k! N2 T Q1 {: G - * published by the Free Software Foundation version 2.- v& A- l9 s' R6 H5 g/ T
- *
% ~$ u. p/ F: Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 J# Z; }! r9 _" _; o3 J
- * kind, whether express or implied; without even the implied warranty
% v: h8 H; W9 K* H E0 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ a1 B9 q* e" Z% W5 C
- * GNU General Public License for more details.3 o ? R& Y/ x0 b( m
- */2 ]: H" f9 T) Q" }" V- D
0 |( k, ~& P- S2 ]6 m- #include <linux/module.h>7 y# Q* X& N0 R
- #include <linux/init.h>% R4 s d3 C! R5 g- E
- #include <linux/errno.h>' ~% V! Q# U+ R O6 b2 o, K
- #include <linux/types.h>, z, H6 U% M2 L% ^' I, D
- #include <linux/interrupt.h>
8 N* y4 v8 m W; L. G, B - #include <asm/io.h> C5 K: q/ T7 z4 g) y
- #include <linux/moduleparam.h>* c0 q& S- l/ ]' [
- #include <linux/sysctl.h>
4 Y7 v. J6 r2 S - #include <linux/mm.h>
% ` W& ^' m1 z3 X - #include <linux/dma-mapping.h>
3 J6 y4 n3 ]# O0 ^, T7 d
- m# P6 E/ s* M6 T. X1 X- #include <mach/memory.h>
: U& w: L/ x9 x& f) A M' g - #include <mach/hardware.h>
8 @! T2 ~# A3 z, Y. v: x - #include <mach/irqs.h>
3 }1 `) G3 H1 f7 d1 X" _ - #include <asm/hardware/edma.h>4 `) V# b/ q; T5 l( d
- * V4 E- x2 i9 u$ P
- #undef EDMA3_DEBUG
' S! ]4 a$ z% k- l8 {( I1 i - /*#define EDMA3_DEBUG*/
' T2 \5 f3 j+ D" o; E! R
, C2 v8 L' z' \) P3 n- #ifdef EDMA3_DEBUG1 q5 Y0 z$ W1 M9 W5 e8 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 t8 R- g c a7 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 d0 A6 E3 U9 S8 u$ o3 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" A1 N& }2 }! t! j- [: V - #else6 K8 q" [ |9 \! h0 |% c, s
- #define DMA_PRINTK( x... )
, B0 \( X) F" ?5 ^2 g - #define DMA_FN_IN
" @' ?; w% U: ?" R - #define DMA_FN_OUT6 M7 ^; t( f7 F! }
- #endif
+ b! ]* M* b! l
6 m- Y. u3 Z7 w9 ]0 \1 v2 X, \% g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) H! o0 J+ Q8 B6 \2 S - #define STATIC_SHIFT 3# r1 O. ?+ ~6 b- M+ T
- #define TCINTEN_SHIFT 209 d% `- p1 u- X$ P. g
- #define ITCINTEN_SHIFT 21
' M j3 ?( N6 n+ D5 g2 v - #define TCCHEN_SHIFT 225 }9 d9 A/ ]- j" h S+ |: F f: ]
- #define ITCCHEN_SHIFT 23
" b1 e6 K, c6 a# P
. G3 s. y, u8 H/ a) J6 Y( @- static volatile int irqraised1 = 0;, Q. j- N* p+ u1 H+ o; }$ i' `7 l8 W
- static volatile int irqraised2 = 0;
+ `* E! ~! z; r( f! E& @
! z9 m1 X( W/ u% I I) k# t3 o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. s5 o# X! y) `, ^/ Y7 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 p8 ~) f( N/ k1 a- l7 U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 R$ F k0 S- e' s
0 \! d; w3 l9 j+ E- dma_addr_t dmaphyssrc1 = 0;
$ R5 }8 i' G5 k: @" S! i - dma_addr_t dmaphyssrc2 = 0;! G' Q! g( O- C* [
- dma_addr_t dmaphysdest1 = 0;
* R! J5 p/ W1 O% v W - dma_addr_t dmaphysdest2 = 0; I0 p- V+ z& E2 y
$ L+ ]5 E* y6 ?2 w1 S# r8 h- char *dmabufsrc1 = NULL;
+ R1 O7 }' B5 |! G2 b0 X. \ - char *dmabufsrc2 = NULL;, @& f' Y3 }' N9 b& G" ^- e
- char *dmabufdest1 = NULL;, M i _' ] g' N5 U1 B# p
- char *dmabufdest2 = NULL;
' z& c8 G) M4 S; R - * L' }5 M( l; ^! l
- static int acnt = 512;
6 C4 Z; v6 Q: @" [ - static int bcnt = 8;
& u! Q/ p+ ]% S0 h' u; T9 l - static int ccnt = 8;
( B& w5 e$ d: t9 u8 J
+ f! P; `9 ?( {) ]) T0 l' e8 L- module_param(acnt, int, S_IRUGO);
9 T9 h& C* v4 W1 B - module_param(bcnt, int, S_IRUGO);
, {; E2 |+ O' C, X, h4 a5 s( B - module_param(ccnt, int, S_IRUGO);
复制代码 * J6 H* {3 c+ ^% W$ ]- A
1 [$ j$ H7 {1 S* r0 I7 u9 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. Z. Q- {+ `1 u1 t( E1 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( L2 m$ b" V4 f# z( D 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* {- u% m& F a# A# i+ L, X
3 i+ n4 k# k4 T; d+ A3 ]" y3 U! H/ g/ [
|
|