|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; U! z" Y) F% H; m( ]- [code]EDMA sample test application
, m+ y c9 r U - /** M$ O u! h) I
- * edma_test.c
- E: A" }4 o! s/ E. k - *9 w8 O* G0 Z6 ?2 C+ n3 u7 U
- * brief EDMA3 Test Application( T& X1 H A1 f" W$ S% y8 M
- ** o; ~9 W. q7 g& P, H2 b. j. f; j
- * This file contains EDMA3 Test code.
9 c/ q# d1 y9 D3 u - *' j* G2 ]0 m0 h3 X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- f4 I0 I! R' s2 j8 R& t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 L( y% b" q6 x; k# B' W - * TO CHANGE.
" I$ i% G: X: D, _% ]- ] - *2 K) s4 h5 o3 Q% A* Y/ G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 ]- U& }4 e- D, u. A' K7 c - *
8 y- W$ u! h& t& ]$ S" |+ W - * This program is free software; you can redistribute it and/or# b, c1 i9 N* a+ c' P$ O
- * modify it under the terms of the GNU General Public License as; a J R# _7 }: O
- * published by the Free Software Foundation version 2.
0 d8 [- i! y- Q; _3 r- ?( g; q - *
. }' k" V5 M6 N+ u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 y8 _7 P) P; N7 B
- * kind, whether express or implied; without even the implied warranty
2 y6 R+ b/ Y" X: } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" D* A4 O! T$ r1 K; u) G; H - * GNU General Public License for more details.9 Z9 f% j$ }# _( u5 ~+ O
- */
; I. Z' `6 x, b# Y" S
" \( b# K/ T. B8 m- #include <linux/module.h>: _* m3 O. F* h! l% V) |
- #include <linux/init.h>
- {" Q; ^- [$ r3 k5 P/ V - #include <linux/errno.h>
v) U, B$ g9 i! S7 o# x( i - #include <linux/types.h>3 N0 M* O1 P8 {# d
- #include <linux/interrupt.h>
# K& \- N2 v& P - #include <asm/io.h>
2 h7 _; V, }3 }% ]. r - #include <linux/moduleparam.h>
$ q: \8 w/ ^/ j W! F* r8 Q2 P - #include <linux/sysctl.h>
- v& y% y1 v5 M d - #include <linux/mm.h>& g* J/ i0 H: B6 q) p& P' J; p
- #include <linux/dma-mapping.h>6 W- b5 k; h/ G F' F. y8 Y( b
- " W: [. W: O$ s5 ^: @; y
- #include <mach/memory.h>3 _ z6 g: a/ p6 z' O" v
- #include <mach/hardware.h>" q, Y/ r6 L# V Z( [$ |6 \
- #include <mach/irqs.h>4 x6 e7 B; S+ ^. V. ~* z6 x1 ~. s
- #include <asm/hardware/edma.h>
# L0 U; H) I2 B - O. p2 n; S4 E0 m3 `' o
- #undef EDMA3_DEBUG! }/ K6 ~* q$ N' Q
- /*#define EDMA3_DEBUG*/% X( g' |- Q$ p3 e
- 6 f( ]- f8 H, h3 I5 ?, S
- #ifdef EDMA3_DEBUG
' g' b( d/ m& M6 o. J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* w% n4 r; s4 f9 h& t+ ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* {3 \$ e5 }; y: D8 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 O$ M% g x% u6 P* e7 T8 _' e$ K
- #else
. c2 M: y2 }) _( _ - #define DMA_PRINTK( x... )
. _' s; O+ V; _( M/ f - #define DMA_FN_IN
2 I% A& A/ X E% N) ]( `" j. I: x - #define DMA_FN_OUT( v! S* I+ W# ^$ K4 ~/ i q
- #endif* E" {% v3 Z5 s- D/ V6 B D
1 e( f, B: P- l6 `4 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ T6 Z6 r/ L S( y# H - #define STATIC_SHIFT 3# j u: \: {7 I% s# t
- #define TCINTEN_SHIFT 20! y* q' A; c2 O; N
- #define ITCINTEN_SHIFT 21; u1 }& W0 i7 A1 m) S5 Y: r$ i2 k
- #define TCCHEN_SHIFT 224 y% e! Y5 F0 |" L D
- #define ITCCHEN_SHIFT 23
; u( [5 \" a7 R2 U5 l T - : N+ h" {, m+ S- S5 p7 t
- static volatile int irqraised1 = 0;
: D. j0 Y+ W8 a3 ^; t! W% `- ? - static volatile int irqraised2 = 0;. F! R$ u8 F; \
/ M) D' y8 r( B& x( ^1 q6 o B5 o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& C$ g. p. I3 N2 l4 _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% P8 D& b6 M/ i. o" c/ Y9 p1 n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- m* u: r, j4 o+ m7 x" _ w: y - " @+ U d$ r2 }' v
- dma_addr_t dmaphyssrc1 = 0;
9 \! j# O; k L( f1 ~ l, r6 Y; L - dma_addr_t dmaphyssrc2 = 0;5 T* Z* g0 X# s7 a
- dma_addr_t dmaphysdest1 = 0;
& `6 q) Z1 t* T- m. s' { - dma_addr_t dmaphysdest2 = 0;
/ U! Q$ q1 \ ?3 Q1 T$ A - % G9 z' K2 e1 @; @0 E& j8 q
- char *dmabufsrc1 = NULL;7 T7 i4 D' t2 @
- char *dmabufsrc2 = NULL;
7 j/ G J8 ?# j2 }$ y3 j$ K3 w - char *dmabufdest1 = NULL;
' |0 c4 ~ _. V* ` - char *dmabufdest2 = NULL;; c6 _# K# r" i
9 b. T* l. j: @9 h, [, s- O- static int acnt = 512;9 U# S7 [ ?# Y& l
- static int bcnt = 8;
) x6 Q+ }! p' R3 a' F, Z% Y - static int ccnt = 8;
% p! {4 p( R- V3 ?8 s
1 L! a+ S- V' r. J, e. B5 B+ O- module_param(acnt, int, S_IRUGO);
# y( q, c! O9 y9 D% I8 d - module_param(bcnt, int, S_IRUGO);
% @; x/ E; Z' h* W: z - module_param(ccnt, int, S_IRUGO);
复制代码
8 p+ J7 U" m: A0 q& b* i- s$ I8 \/ i* X4 o& x/ j6 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ p# p: d# R4 U8 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 i8 K8 E& r# X$ [7 M
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 }* b9 M& f5 p; ^
2 n+ K9 O! K8 i! i1 F) t& J( F" H$ V, U+ _1 M G
|
|