|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Z4 q4 ^( C `, X1 ]
- [code]EDMA sample test application
' K9 k% K, M: i - /*
$ c$ T9 R, D" H, x& A9 j K% C - * edma_test.c- D* i5 V( q) G* q$ D
- *
+ B% A" h$ `/ s! t! z3 n) B - * brief EDMA3 Test Application
2 ~9 S2 x' ~: a6 j* `# J; | - *
/ l( c0 _! B9 R" [" }' ]1 i - * This file contains EDMA3 Test code.: @8 z! d! i* g8 l2 B; n! w
- *
+ P# x0 i' S/ X7 V; L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) [+ {# h9 ~ Q( C/ i# x7 A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 u. T8 c: g3 }- E* L& N
- * TO CHANGE.' s: K! _1 D. @. O
- *4 S5 K! u0 R9 ^1 ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: B& ~9 z M$ \9 C3 ^: `- D - *
4 k. X+ k- `* N: I' x$ @1 H, q - * This program is free software; you can redistribute it and/or% t) ?$ _; ]/ C% G
- * modify it under the terms of the GNU General Public License as; O, [! i9 T; V$ r
- * published by the Free Software Foundation version 2.
5 }! ] M2 h. D3 S( z) Z - *5 o7 P4 \+ W# z3 D1 B( q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 ]& T) ]" V+ T5 z
- * kind, whether express or implied; without even the implied warranty
* D# V# d* H, u; @1 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ U0 e3 V0 V7 g& Q/ |/ l/ j
- * GNU General Public License for more details., Y! Z5 T9 {( C( b
- */: P4 S+ D+ Q, ^, e, s& t
& X) d9 Y7 J" w& \2 [2 S0 F' c+ J- #include <linux/module.h># n+ C9 h# G/ k! V1 i9 Y7 ]8 g
- #include <linux/init.h>
/ M6 L7 I* C' `6 r) q1 V - #include <linux/errno.h>
4 x& N- z7 K$ E" h, ?1 n - #include <linux/types.h>7 ?6 }9 d! S# {3 P( ]
- #include <linux/interrupt.h>. \' `% O" O0 @4 T( H
- #include <asm/io.h>! c/ ~. N$ p: T, F, W
- #include <linux/moduleparam.h>+ f C4 S6 ^+ ?- _# \0 O
- #include <linux/sysctl.h>: _ f) Y; w6 E
- #include <linux/mm.h>
. P$ A$ K* T% Q6 `5 F - #include <linux/dma-mapping.h>+ s1 h1 f: q" S- }& q
# o# i% c+ t& _* s- #include <mach/memory.h>" E3 E3 V4 i9 P2 u
- #include <mach/hardware.h>) t( D6 {3 y, {! J4 Z* }
- #include <mach/irqs.h># {2 N0 w3 b% s7 _# s. U6 g w
- #include <asm/hardware/edma.h>1 w M5 T3 y) L5 N- L9 n4 t
3 E4 f0 q$ E7 Y. @3 I. O: l8 `6 a- Z" R# m- #undef EDMA3_DEBUG
) y9 w9 t2 t8 k6 S7 d1 P1 C2 t& c, F - /*#define EDMA3_DEBUG*/: A; C; c$ N! X4 C
- 6 h% P& F1 H9 O4 Z
- #ifdef EDMA3_DEBUG
* v, B9 G$ o. o X2 H" } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, m, y. P& p$ O) ?4 z$ D; \- i+ i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 L( E/ O! x5 E. Y" I$ f7 A6 m6 n% ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 o$ Q8 D/ d$ b! [4 j0 [3 Q - #else8 }. |6 h) }( M6 P [5 c y
- #define DMA_PRINTK( x... ) U9 q, J0 ?1 L+ X% ]! l
- #define DMA_FN_IN( _! L7 O, h: f) T. u
- #define DMA_FN_OUT; s. U7 ?) ?# n. s& g' V
- #endif4 x6 Y; w; \/ u1 J
- ) h0 n" S; S. w. t- Y& ?- ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& i8 g* l# p0 r, f: ]9 f0 y
- #define STATIC_SHIFT 3
/ Z& K/ u1 A+ }3 Q; `1 B - #define TCINTEN_SHIFT 203 ~5 ^, R# W# @' d! a
- #define ITCINTEN_SHIFT 21. k$ B O, N) V9 W& C
- #define TCCHEN_SHIFT 220 s; v( ]5 s' L" C4 K6 B# Y: l) N
- #define ITCCHEN_SHIFT 23: X* I* _/ Y/ l7 X- Z2 w
' k9 E5 T& A' f1 L- static volatile int irqraised1 = 0;
+ p7 [6 |7 K$ f# C - static volatile int irqraised2 = 0;
. V, e# }' b, @8 o8 x! w( l
' W% v) B- s/ ]/ ]6 I7 X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J6 m- E2 p2 A0 }( a7 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' o4 C, P- N& k4 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. T8 `% C9 I# K+ U
- a! L7 E- y9 W0 b8 z- T+ h, R3 ?% s- dma_addr_t dmaphyssrc1 = 0;
& Q6 v* r( @8 `& N5 a: D, F6 u - dma_addr_t dmaphyssrc2 = 0;
+ m+ f5 o5 h8 Q - dma_addr_t dmaphysdest1 = 0;2 Q b( q) p2 f" X
- dma_addr_t dmaphysdest2 = 0;
; M" P/ M* p7 c& V
/ y* w' Z0 ]3 v( q, e8 O6 w7 c" q2 j8 q1 x- char *dmabufsrc1 = NULL;
5 y. r2 U( ], C( `+ ^ - char *dmabufsrc2 = NULL;
. [( }2 c3 g) K7 f6 o2 s0 f! N - char *dmabufdest1 = NULL;
# p+ i3 Z2 b9 T4 L* s5 D - char *dmabufdest2 = NULL;
) r4 x- j! H) g' @& l6 y
. |& r8 s: Y7 P, y' A) ~/ B8 n/ f! p- static int acnt = 512;5 o6 A) N, J7 ~% L5 _
- static int bcnt = 8;
1 ]) Z) q( ]3 u9 e/ |% ~* b - static int ccnt = 8;
$ y8 ?" G) a; ?( R O - 2 {! g, U# M! c
- module_param(acnt, int, S_IRUGO);. W: Q |+ i8 J6 w
- module_param(bcnt, int, S_IRUGO); K- M$ c% g; @' u& r% U
- module_param(ccnt, int, S_IRUGO);
复制代码
5 v7 v- ^( K# W$ V) B% j# Q3 x8 A; `4 o3 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* F% S, v3 O* q0 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. \) Y& @% [ ^; d* H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& u' }. p/ M) f
" t6 D( M& t0 C; u
5 U* a+ q$ N- e& k2 R1 K |
|