|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 W9 m5 S3 a# E! R/ q$ p! i
- [code]EDMA sample test application
. Y% }9 k. W4 [% ~9 Y9 C - /*3 f: X8 `# |( ~4 O- d
- * edma_test.c- H& E, [7 K1 K- W& _. Q; I q
- *
4 F9 b w$ N7 R: ]7 d - * brief EDMA3 Test Application$ u' n7 }5 P% H6 b% p. B9 g2 q
- *
6 `7 W e! ?: y8 j! v/ x6 M& L - * This file contains EDMA3 Test code.3 L3 d4 z3 c8 y6 ]
- *
4 w: i* L) M7 G5 @! Y5 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
C+ ]+ |2 W% I/ `4 E( o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 c( |, h j/ y
- * TO CHANGE.; X. L! r6 k+ F8 f
- *
" k5 z) A ]# [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ A m6 c: e. w% p$ x+ y N
- *8 Q# H; X* O3 }
- * This program is free software; you can redistribute it and/or: c, ~' A9 O8 \3 r" |
- * modify it under the terms of the GNU General Public License as
6 D2 ]" W7 l. l" p0 |# d) ?2 M9 I+ U - * published by the Free Software Foundation version 2.6 D+ T1 P9 M% c0 \" j% I
- */ `$ s- l5 k0 j1 d8 K. C- N' y6 W8 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 c/ L9 e. S2 F8 u! W( G @ - * kind, whether express or implied; without even the implied warranty
. q( H$ t5 J+ T, p6 B; w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ \* m/ a2 B& S1 p! r
- * GNU General Public License for more details.+ s- M; f) O% b+ K P: i$ _' H- B
- */! c4 J! q. y+ f0 m+ K. w
( Y; R) n6 M( R- #include <linux/module.h>
) h. Z* H: O) [- O9 n - #include <linux/init.h>4 W. Y# q! o4 b) {8 U, ?) N# Y
- #include <linux/errno.h>
1 a( Q) w4 ]3 t# j* M+ H - #include <linux/types.h>
4 _7 ~" p0 L2 O- z2 A3 p. g - #include <linux/interrupt.h>
+ C0 A* G9 P( R" o - #include <asm/io.h>; l8 _$ L) y' }0 A% B; T5 v
- #include <linux/moduleparam.h>
% M, N: D8 H A; }3 j+ g - #include <linux/sysctl.h>
( v+ F/ l2 u6 X( O2 r - #include <linux/mm.h>8 v: a) c7 Q# m& m; r5 Z
- #include <linux/dma-mapping.h>
, \, t- d ]3 O: ~( q5 H h: _ - 6 i% O; u" r/ H3 Z
- #include <mach/memory.h>/ F, h# J5 | K: y+ T$ S1 J
- #include <mach/hardware.h>6 U: w* g% V+ _
- #include <mach/irqs.h>
2 i4 I0 D" O% z3 E - #include <asm/hardware/edma.h>- h4 v& C g. T
- 3 V( ?. O7 L% I' K
- #undef EDMA3_DEBUG* u# I" x. A! z
- /*#define EDMA3_DEBUG*/
" L% t9 E4 ?2 { - , z) g* N7 \2 H- o' C+ i
- #ifdef EDMA3_DEBUG
( t- J' F+ E( M8 D7 V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 [$ R% @" `% K, ]# a7 m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ z3 x2 n/ U" d/ n! b! A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 K0 H6 e/ o" q8 u. C1 P! m- A
- #else
1 j# f, c. [! R# Q( |' @! w - #define DMA_PRINTK( x... )
4 S) O! |. s1 a# F# B1 { - #define DMA_FN_IN1 l4 {6 ?+ K$ F3 I3 U2 t/ O- m
- #define DMA_FN_OUT
* h5 R" U4 D( K6 | - #endif
4 ^2 m* A" O2 S% J. { H% F
. ^3 y( L# y( f/ B! K0 g. T, O4 R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 j$ M- h0 u% I/ L# ]6 l6 s6 n
- #define STATIC_SHIFT 39 Q& G( X" w4 b8 A. ^
- #define TCINTEN_SHIFT 20
$ G ?2 N; x5 ? - #define ITCINTEN_SHIFT 21
- l7 g4 c9 F# R% c8 Y+ o( h - #define TCCHEN_SHIFT 22 y _! H$ L2 N% r! f7 u* ]
- #define ITCCHEN_SHIFT 238 G; Y$ h3 _- Q4 c
0 J! T/ S. @+ }5 b: [, O: B- static volatile int irqraised1 = 0;
: Y0 E3 _# S; i1 k* y# c - static volatile int irqraised2 = 0;
+ f$ `0 X# B& n9 j( h6 \. [- r - * s& P% a7 o& p& O# @# Z5 E- F4 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d' G s2 f. o. F# k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 P& a; r, i/ {5 ~7 t: x1 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~3 _$ q: i: l. G
1 h) {# y! F1 C7 u) E- dma_addr_t dmaphyssrc1 = 0;
9 \( d9 y: {1 C4 i E* o - dma_addr_t dmaphyssrc2 = 0;+ g7 V8 v1 t0 @9 H
- dma_addr_t dmaphysdest1 = 0;
/ n4 o( ~ [ z0 E - dma_addr_t dmaphysdest2 = 0;0 P2 ^" C3 q4 }. _$ E4 y* I- N
- 2 L" |' r2 I2 r- [
- char *dmabufsrc1 = NULL;: E, z# g6 @) x8 I. ]" W& @
- char *dmabufsrc2 = NULL;% {& R% t5 b- H) V' c; E; x5 _- i
- char *dmabufdest1 = NULL;
! N$ E4 u/ d3 w- J+ {. N* a- J - char *dmabufdest2 = NULL;; m' x5 v8 N* r: h: b8 ^. O
- ' u( [- D8 O a i$ v+ l
- static int acnt = 512;! ^! y9 L( N6 I* o6 R+ v
- static int bcnt = 8;6 I& [- X* [9 z
- static int ccnt = 8;
0 p0 f8 l8 I8 I& E7 }% j9 L - 0 w' A$ J6 l" w2 G" W
- module_param(acnt, int, S_IRUGO);
0 p# f$ p8 ]0 ^# u3 a* M - module_param(bcnt, int, S_IRUGO);7 F! G1 I: B8 I
- module_param(ccnt, int, S_IRUGO);
复制代码
3 Y; p+ a- O' I+ | F
# i$ T4 i' m/ ^& s# k$ n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 C& H F5 i/ g, l- W! yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: M2 z7 W8 Y4 m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ I+ p' Q( e! Y; Q0 h+ Z- v$ q' G' D
7 a, `$ Q. |$ k* l+ `* x2 e) k
3 U8 p# {4 D/ T5 N7 V- a3 S7 i. I3 ^5 I |
|