|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x& ]# W. l% T# L1 Y2 `6 Z
- [code]EDMA sample test application; D+ d0 t+ S5 K9 s1 v# o9 N
- /*
- A( Q/ V$ G& e4 h/ s+ \4 M2 V - * edma_test.c
$ L% R1 s& A2 [: Q1 A! G, l8 ^ - *( Y T1 j0 q' A: u3 s/ L7 y* ^
- * brief EDMA3 Test Application
& N6 L ?/ ?# O - *, m2 g O7 f6 ^' w2 v# \, A/ g7 T
- * This file contains EDMA3 Test code./ W. J0 y' Y/ R
- *6 Z2 {# N" v1 o3 {' |0 r8 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! S1 q' F( }1 T. h, W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. t7 b$ G8 [% F: ]5 Y
- * TO CHANGE.9 F5 q6 Q; i9 m; o/ V
- *3 |3 h; w7 d' C$ T" J% ^7 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# G/ h- C: l4 I
- *4 ]' L! E4 X. b) e6 k
- * This program is free software; you can redistribute it and/or
# N% y3 g+ m" ]/ r# ~ - * modify it under the terms of the GNU General Public License as! u/ [8 f. \5 a& x. ?# A( Y" T' B# U
- * published by the Free Software Foundation version 2." j4 d3 T# _/ j# J5 d9 d
- *6 W3 v7 J8 L! `4 Q9 ^ S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 D7 o+ Z0 H8 L! t
- * kind, whether express or implied; without even the implied warranty4 h0 H- l: I+ f: V C; g' [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) V v3 H* k6 \' `) l
- * GNU General Public License for more details.
: z7 k! e8 Q, d$ ] - */6 J: I+ ^# E/ @+ D( S9 \
- + _6 [9 |. V& V1 j
- #include <linux/module.h>
- a, f* [8 e- Q4 k: N - #include <linux/init.h>
1 W7 M$ P6 _2 G/ i4 p- D - #include <linux/errno.h>. P1 E# t) G! l7 N
- #include <linux/types.h>% G j7 ] O$ c: E9 ?( N2 a* S$ E
- #include <linux/interrupt.h>+ {$ @8 h& Y/ S' Y
- #include <asm/io.h>9 j' u' B1 D, `9 J" u! H- ^/ O2 \
- #include <linux/moduleparam.h>+ P3 `6 N3 E' k
- #include <linux/sysctl.h>% p4 }$ Q# o. e) i: u
- #include <linux/mm.h>8 s4 @+ i( w4 ^9 K- d6 |- E
- #include <linux/dma-mapping.h>
. B& O: `! i5 d, \/ A/ n$ O
' J6 m$ I/ I9 z; o) g) I+ a- #include <mach/memory.h>
4 R' I5 M- r9 \. q# N/ ] - #include <mach/hardware.h>2 s) m0 W; S1 m0 p
- #include <mach/irqs.h>
0 z U4 s# M, j, ^ x - #include <asm/hardware/edma.h>
8 ~9 l, x5 z, ^7 k - . \: \6 n6 i* j# s6 ~
- #undef EDMA3_DEBUG
& h0 o0 d7 `+ ? ~" f% K- Z1 i - /*#define EDMA3_DEBUG*/
( |; v8 m t2 V# P$ @4 B" V - 1 s3 h- L' ^+ J; a. Y' g# X G
- #ifdef EDMA3_DEBUG
5 K/ G; N" }7 C0 i: v5 ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 U9 i) ?: n2 |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); C: H) ^8 A, ^! N. ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! I* f6 }# x, b& F, B7 n5 |$ B5 ? - #else) Y, A* s% U% R1 I
- #define DMA_PRINTK( x... )3 V4 z8 |. ?8 C; x; S" I
- #define DMA_FN_IN
; G8 Z; p( f {" {3 C - #define DMA_FN_OUT
9 _$ `2 U5 _; w' @: e. V' W - #endif
2 x; p6 L$ r+ b% Q. Z0 Y
$ R) r3 b' M" f- B3 ]$ i+ _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" B6 R K3 {3 a2 P - #define STATIC_SHIFT 3+ A$ H$ T6 z8 d9 W& M
- #define TCINTEN_SHIFT 200 M# }, `( M) v$ S$ F
- #define ITCINTEN_SHIFT 21
% l/ w; T$ F3 W8 R! S. U% J - #define TCCHEN_SHIFT 222 p7 K! y/ g& d1 G- {& }; t
- #define ITCCHEN_SHIFT 23( {* |' ?( t1 E& Y
- 8 \* \+ G3 V: u% U2 ~; a
- static volatile int irqraised1 = 0;5 A7 w) W' Y i
- static volatile int irqraised2 = 0;
1 A/ \; y0 A2 b7 D6 r- V/ Z1 V1 s
7 A4 k3 v) V' A+ b9 w- a9 j6 }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ~" U* p9 H/ r$ |. F7 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Q8 O \* x( U# q2 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, H. a6 ~8 G' Y5 N' o
- : R% k D( G0 Q/ a$ J
- dma_addr_t dmaphyssrc1 = 0;
# E' O% L$ _% ~2 ?& J$ _ H& N) p - dma_addr_t dmaphyssrc2 = 0;
& {6 u C" {( J - dma_addr_t dmaphysdest1 = 0;
% E# n0 l: i$ R* m& ?+ Q# K - dma_addr_t dmaphysdest2 = 0;( l2 _8 }! r5 u# b2 a) |# W
: h8 G) J. I; P: V, b, _- char *dmabufsrc1 = NULL;8 Q/ j+ Y2 I Q
- char *dmabufsrc2 = NULL;; ]! Z8 @% m& k' D7 k
- char *dmabufdest1 = NULL;; t) o7 L9 J( ~$ W
- char *dmabufdest2 = NULL;
: H8 `! a8 t* C$ v- ^
: G. Y$ k% W0 l- static int acnt = 512;8 W' e2 V! {, z. D
- static int bcnt = 8;
9 l1 l+ K% a a3 a - static int ccnt = 8;
- \6 m5 x3 ?0 J, n# C9 Q
1 i( l2 D& U, f( f- module_param(acnt, int, S_IRUGO);1 B. S u- ~6 [6 F$ ^8 q: d
- module_param(bcnt, int, S_IRUGO);# m, v+ F8 b- D2 ?* u5 V; D
- module_param(ccnt, int, S_IRUGO);
复制代码 $ h/ N: n6 B' S
* i) N2 z8 f R- o, N7 P" }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% O& k( D/ X9 V) @6 h; B( ^" D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* H- q Q# q G" a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 v2 X# y. I! b5 L4 n1 R( f0 x, Q* W; L9 k, g2 a G
) A% g" ?) }6 r. o
|
|