|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; X) n) ^1 O& Q i
- [code]EDMA sample test application
3 y K$ R1 U5 z! @3 F8 @) e& o( T - /*
" C2 t2 }' G* ]7 [' \ - * edma_test.c
: c: E, V. l& Z$ C6 `( O' @ - *6 }. S1 m( O9 _# E. C7 e' a ]
- * brief EDMA3 Test Application
/ b+ q6 C4 Y4 z' G, `0 n3 ? - *
+ T$ M; J, M( g7 u8 n/ E" J! J - * This file contains EDMA3 Test code.
5 i0 x( n, G) a: D' J9 q7 b9 E - *6 | f% D( g, G! T+ {; \: t7 ]# ~7 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ S5 E9 v4 r' D0 C- B+ j% M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ {1 F/ ?9 S+ A1 u7 c3 x# J% w: o9 D
- * TO CHANGE.3 |! U$ e; U/ g
- *. i; T9 a5 q: v' ~# T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! T1 _: B% f% \3 w* d; P
- *' T; g9 M. J J' N; [
- * This program is free software; you can redistribute it and/or6 y8 e4 y% C8 V/ |/ n
- * modify it under the terms of the GNU General Public License as
( k. _% K' \" X3 h - * published by the Free Software Foundation version 2.
& i Q; H8 W: c1 S1 @& A. ^ - *% s7 @6 i. `% X5 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 W+ E) e: h7 e1 i$ o
- * kind, whether express or implied; without even the implied warranty
7 z3 ^6 B$ z8 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the b3 ^# r1 e7 ~/ I
- * GNU General Public License for more details.
) f3 M) H; H$ J/ k, ~4 `- {/ w - *// L6 }- S, W+ f! C# r( P
- ' {$ a7 {/ q" T4 Y
- #include <linux/module.h>; F/ l5 X! @9 F( N# x X+ k
- #include <linux/init.h>
5 I: Z1 E% s* f! ]4 p. {8 U - #include <linux/errno.h>
; `: \$ x8 x5 k4 v) I- f - #include <linux/types.h>1 {' V. R% z% O4 o3 ]
- #include <linux/interrupt.h>
, R; e3 G+ z" H7 X9 u - #include <asm/io.h>
" D+ v) z4 X9 o. o - #include <linux/moduleparam.h>
: r6 K/ x2 T+ M5 j3 Q3 ] - #include <linux/sysctl.h>
. L9 P. }2 q l: q - #include <linux/mm.h>9 D- |7 N' }0 v4 U$ R# s
- #include <linux/dma-mapping.h>
- M) E7 O: Q6 F4 L2 G: d7 A - + L% ?" O% h' `
- #include <mach/memory.h>; E+ X3 R% \, a6 S! h/ e
- #include <mach/hardware.h>0 M% d* W$ z3 e6 Y5 V9 W: a
- #include <mach/irqs.h>
2 Z5 N% d6 g, h6 `- d- } - #include <asm/hardware/edma.h>
9 o; ]8 d7 T1 W - % P7 T' Q1 B. Y& @- T! d
- #undef EDMA3_DEBUG
+ @0 E/ |, L/ Y6 ^4 g, L - /*#define EDMA3_DEBUG*/5 U3 m" r2 E3 _0 x" A- V% Q
# P! C2 K/ l. \/ C1 T1 @3 I- #ifdef EDMA3_DEBUG/ e( n7 K }1 k: Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 b. D0 c' Z3 J$ o$ ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ^6 x, d5 D/ v9 Q9 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 p) g& e! G, |% [ - #else i/ z4 Y" g8 r4 Z
- #define DMA_PRINTK( x... )
% m( {# m: q8 Y# m - #define DMA_FN_IN" ?' a$ w5 V0 M$ E% j1 g
- #define DMA_FN_OUT3 t/ J2 R2 p# U5 |. K h( V
- #endif
* J" f- p- {3 s7 |, M - ; X, c8 H, W( c) B4 s. k6 I; z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 j k8 t" t5 C$ B. s - #define STATIC_SHIFT 3% m3 }. S; I/ E7 n A* C- a
- #define TCINTEN_SHIFT 20
$ q* p% ]2 {/ C# O; U; G - #define ITCINTEN_SHIFT 21; _) r) y1 E% u- `
- #define TCCHEN_SHIFT 22
! u9 }$ Z6 U9 t( J5 c- P" f t - #define ITCCHEN_SHIFT 23( V7 m P8 U7 c/ u- h7 }6 T
- 1 H# t7 w* B. T8 k: O& K
- static volatile int irqraised1 = 0; ]/ v7 Q& b+ Y
- static volatile int irqraised2 = 0;' l6 d1 O# k% `3 t. n8 C* ^& C
- 2 C9 v, @9 ~$ L" L5 u, P" l& V' C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z' S; ?1 m* m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); @0 R# ?' Q# I* P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' t/ n/ a& E4 Y) I3 J) ^6 K) \
2 Y- c1 D: o' O/ p- dma_addr_t dmaphyssrc1 = 0;) J* J5 B3 f" u) E3 h! X( \& I* E2 S
- dma_addr_t dmaphyssrc2 = 0;
3 e2 m2 [) M/ u - dma_addr_t dmaphysdest1 = 0;
6 d, p4 F. D% R5 Y N5 q: J; S9 w7 r6 J - dma_addr_t dmaphysdest2 = 0;
4 u" \! _; B& G' Z7 k - 3 N' x3 e& H& \# ]% Q
- char *dmabufsrc1 = NULL;
5 q9 u3 m3 d, z - char *dmabufsrc2 = NULL;' S* S; i3 H* k2 o8 m0 z
- char *dmabufdest1 = NULL;( `. ^' L2 D/ b6 h6 g9 G7 c/ v& N
- char *dmabufdest2 = NULL;4 l- t( z3 a0 I, l, y. K
8 i( [2 T3 q6 N- y2 i, `. D5 D' r- static int acnt = 512;
, f. p! N$ c7 N- C' D: k; W V - static int bcnt = 8;0 C6 |) V0 l+ U6 L. H/ ?- `) Z+ g
- static int ccnt = 8;
4 ]8 U& c" I! r: x7 Z: T9 f" y7 n1 V - 8 a8 ~+ j4 v3 | `: K1 y1 c
- module_param(acnt, int, S_IRUGO);" a% j+ V( n% i9 {" R
- module_param(bcnt, int, S_IRUGO);
- ?. U4 h* @) ~+ C& e - module_param(ccnt, int, S_IRUGO);
复制代码 . U/ c8 f' d2 x3 c
0 I7 {0 C- o: ]# T3 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! u8 m+ p9 H" }5 p1 b' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 u! }" Q1 K6 a4 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! u# s! K& P+ C2 F% M) D; d [3 R: f9 R* {, Q9 w! f. a, \) N
. _1 ?6 B6 _; J1 K- y
|
|