|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' G5 p* B3 Z$ q7 z- [code]EDMA sample test application+ O4 Q* L4 E0 L' Z3 ~! F: j2 ?7 q; p5 ^' q
- /*$ \) w2 @" a/ L1 c
- * edma_test.c
5 I/ H. V4 P$ j. Q0 W! |3 B - *
8 |3 J( T+ e. O. u - * brief EDMA3 Test Application+ R ^$ l( u1 v' d: X" h+ p" d
- *
: C! U, h! a* b) r5 }% p - * This file contains EDMA3 Test code.
) a& o( r2 ^7 u" u( U - *9 L! h" _2 ]4 N; [: @
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& W7 }! S9 l% l1 ^) \% a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 \$ z! y9 i% @) B* ?6 S" n' f- |
- * TO CHANGE.
( Z" {4 |( p! t+ M% m' {. J - *! B! L, `" Y F- _3 }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 N1 J& M7 W# ^" U
- *: ?& g+ V5 _9 a" C& C
- * This program is free software; you can redistribute it and/or/ a) u/ f1 C: N0 h0 b
- * modify it under the terms of the GNU General Public License as. i- a2 o9 _5 s
- * published by the Free Software Foundation version 2.$ \ E! i. L4 o! n2 a! r' e$ \
- *$ z' y+ P5 g" a) V: U# P$ w, j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( w4 P! A2 M0 x - * kind, whether express or implied; without even the implied warranty
/ z& {9 i( u3 v' p8 `2 |' G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 g u, d! b. M# L+ P+ h& K5 G - * GNU General Public License for more details./ P5 m4 Y" E% S6 F) u
- */
% {: \) c7 e" e
# `: ~- `- k( j" D. ]- #include <linux/module.h>2 i8 w/ B2 n- |. k, |) Z6 S" ^$ {
- #include <linux/init.h>
2 F6 _( P! P: f$ h0 D! p. n3 p - #include <linux/errno.h>
1 h4 o8 K- c- `1 V9 l - #include <linux/types.h>
! H% W+ j! {) U& R: B: U' d - #include <linux/interrupt.h># F9 c& f% _- a, D3 g% a
- #include <asm/io.h> k* z E& U: D5 ?* M
- #include <linux/moduleparam.h>
9 u3 N" Z! g; _4 u3 N8 Q - #include <linux/sysctl.h>
5 v; b+ B2 j4 r! N8 P" f - #include <linux/mm.h>9 A0 x$ ]+ z1 L. [8 d
- #include <linux/dma-mapping.h>
" @6 f% l# |; ` C - ; Y' k8 R. e1 M- O. R. y' W
- #include <mach/memory.h>- y- s8 k2 Z! I$ x7 r) x4 r
- #include <mach/hardware.h>2 Z1 m. k5 F/ b+ A
- #include <mach/irqs.h>
( ]* e% [' Q- @ Q2 p - #include <asm/hardware/edma.h>
V9 n9 c8 ]8 e' i% ]3 E - 2 V' |! d/ y, D' |0 Z7 `% B+ q
- #undef EDMA3_DEBUG) m0 n8 M# U! {1 h2 D3 _ z3 n
- /*#define EDMA3_DEBUG*/0 }/ K2 j# v% C4 H N+ H
- 1 c5 S7 @7 ^1 Z6 i
- #ifdef EDMA3_DEBUG
8 j: x+ A- `# e5 P# U- F( L+ U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& {1 H# J" x2 i) A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# g- h) [* Q0 D6 b* K8 j0 C2 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 \2 B. Z) h4 J P3 X
- #else z) k* Y5 O) j$ S2 Q& f
- #define DMA_PRINTK( x... )
& j# A7 z% y/ q4 E7 t# S - #define DMA_FN_IN
; F( z+ Y4 ]+ n; T. Q - #define DMA_FN_OUT( Q' t3 B; l: X1 D6 @7 _% f
- #endif. r$ h6 T* e/ D" J
- 1 q$ V5 U' E# M. ~" E2 q! X$ k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), F7 d4 v% \# Y x( ^6 M' C2 a+ s- x
- #define STATIC_SHIFT 3
. v3 Z3 k4 C4 u# _$ `& q - #define TCINTEN_SHIFT 20& @" X4 R( U2 N+ i: R0 I+ k
- #define ITCINTEN_SHIFT 218 F( g3 H$ q, b2 J; }- m6 u5 K: O
- #define TCCHEN_SHIFT 227 L K, j- j/ Z/ x( P4 U
- #define ITCCHEN_SHIFT 23
# k/ O B4 b! ]" z5 f# a+ r+ q9 N
/ i) ?$ G# _5 f. F- static volatile int irqraised1 = 0;: O) g9 Z& e9 o$ v/ }. j! F
- static volatile int irqraised2 = 0;
! I: `+ [2 B7 b5 S
2 M# B7 W3 X0 R4 z: t& m4 E2 r1 E, D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q3 x* D6 i" s8 v0 Z v$ c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. N2 }0 E- |, N y& _) y; k; r; ]* ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! {% O9 {+ h3 A3 F/ j- Q$ H - $ b7 _7 k# f$ W' b3 _8 x
- dma_addr_t dmaphyssrc1 = 0;, |/ y' @* s- h# q
- dma_addr_t dmaphyssrc2 = 0;4 S, A4 u7 P. o/ w7 P# H" C
- dma_addr_t dmaphysdest1 = 0;. W. R+ U: O) F$ ~" s7 J) `8 y" P
- dma_addr_t dmaphysdest2 = 0;
: S! O( r4 y6 N9 ?5 V - 3 i/ T x- n" ^% N& d' L; U
- char *dmabufsrc1 = NULL;4 o7 C$ c6 l( _; i
- char *dmabufsrc2 = NULL;! u$ U; B* T8 o& ]0 e- ^% W- z
- char *dmabufdest1 = NULL;
5 J5 P; v& r5 l3 }+ W6 n - char *dmabufdest2 = NULL;
) h4 E3 P4 c E+ C% C- M7 L4 C - ' u) Q- ~5 H, T; w5 w
- static int acnt = 512;! g$ _1 y, ~* J% [" l. a$ T
- static int bcnt = 8;9 o& l8 [( w, G
- static int ccnt = 8;, n: ]) P, {7 X" R! |- H& R, y7 Y5 m ^
- ! i; p: H' D4 O$ d7 U% a! j8 v
- module_param(acnt, int, S_IRUGO);/ g: \2 y& O/ Z* C$ V) _
- module_param(bcnt, int, S_IRUGO);
. [& w8 \1 |$ G. w( _ - module_param(ccnt, int, S_IRUGO);
复制代码
( C4 h3 i( f9 K; ]/ D- c# q
4 Z4 j+ i1 s0 I- ]% ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& }* e5 q; e1 c% s6 K- `, ~4 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 R1 o/ \- Q3 S) v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 z$ Y# N9 V" D7 V# O
1 J! a+ n* H5 J: m& y! }
; F, K0 j& z6 i6 u) ] |
|