|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 n3 @+ m) R8 w8 s7 D
- [code]EDMA sample test application% U& [/ }# T7 J1 G
- /*; V# {2 n! G9 x# Y6 F; Q1 [- `" T1 s
- * edma_test.c' j- o& B) c9 C) x( l3 o
- *) p% E1 _! a* Z5 M* v! ?0 g; q
- * brief EDMA3 Test Application/ n9 J2 ]# a* C3 N* |1 V
- *3 O& H" D' h: M5 H0 r0 {$ |
- * This file contains EDMA3 Test code.( o0 B* ~7 \2 [. _
- *: Y* K& F' {6 c$ x* s! Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 x2 x" B) c+ k% U; _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT {2 S/ g8 Q$ N$ h
- * TO CHANGE.
6 C# v' D4 D1 d - *; e5 q. l* x: u3 o: A1 l1 n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 i0 _$ J: d. b$ Q5 X
- *
- Y6 n; }+ C/ F2 R0 u - * This program is free software; you can redistribute it and/or
3 o/ E7 W% m5 S1 s) Q0 [- E - * modify it under the terms of the GNU General Public License as, T8 c8 M2 L9 b$ F" j$ a) C
- * published by the Free Software Foundation version 2.4 W# }$ ?+ q1 A. ^
- *# _' y# A& r. G3 \. i+ i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 b7 J0 G3 Z7 @1 d& p7 V - * kind, whether express or implied; without even the implied warranty* V' A5 C( }& [( a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# Q) B6 t( S/ d: R2 D, M - * GNU General Public License for more details.
( g$ r5 j, q A. {. f% @ - */) \, u, N, S! d$ z
- * y) [3 ?' l) K) f9 p
- #include <linux/module.h>
H- h& P; N, b! Q4 d0 G - #include <linux/init.h>
) r; ^& Y, n+ ]( d6 M# ~+ a& Y8 W - #include <linux/errno.h>
& I, x+ |, h U$ w( e# E7 P - #include <linux/types.h>0 c+ A6 [! q9 w, d6 _
- #include <linux/interrupt.h>5 Y9 f& H+ l K, a% a' ]' T) Q
- #include <asm/io.h>
- b/ ~4 D1 O$ L X - #include <linux/moduleparam.h>3 d/ z1 o$ p& I! e
- #include <linux/sysctl.h>
7 V- H3 C, w$ g9 x9 @ - #include <linux/mm.h>
# b) U+ H9 J+ ^1 e4 `, d - #include <linux/dma-mapping.h>
/ w& X) f4 O/ a - . ~" K. D( x, z% I
- #include <mach/memory.h>
# N# a" s7 C- g - #include <mach/hardware.h>
/ n: N, f5 _, v: X - #include <mach/irqs.h>( I5 I# [7 b4 W7 P( ~9 O
- #include <asm/hardware/edma.h>0 O+ T- E& b9 Q, o+ n/ ^
- ; g' q6 i" k' x: P$ L
- #undef EDMA3_DEBUG. u& }' v, G H1 G7 j# U' y! u: Z |
- /*#define EDMA3_DEBUG*/1 q8 J- P7 i5 Y5 B+ v- s/ d, S
- ' B F0 q4 t) z
- #ifdef EDMA3_DEBUG& c9 m! f: X3 f! Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ V% L( J! `' H6 A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); l/ [/ ^3 I, Y2 J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 V% Z" |3 F& p5 q" x( Z. d6 T - #else. b+ B# R0 `9 u/ X
- #define DMA_PRINTK( x... )
6 W1 D0 x" F4 @0 ~ - #define DMA_FN_IN
% M& B' s/ w8 Q2 }& i - #define DMA_FN_OUT
9 ]+ B8 A) S+ L+ y( i - #endif
9 l( i9 h5 a% t, E6 G% h; N+ ^
' e% T% U% l# V! W- w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 c* b. A' ^3 ? - #define STATIC_SHIFT 3* Y2 P4 i/ R2 \
- #define TCINTEN_SHIFT 20
4 b2 C, y) g; M8 O/ f- j) \8 d$ ]) b - #define ITCINTEN_SHIFT 21, B6 t& s" `, W5 Q; G' w
- #define TCCHEN_SHIFT 22
7 H! B- Q5 D0 @; Q ` - #define ITCCHEN_SHIFT 23# L1 ~5 m; W! H- e
: ~5 M9 y* l0 ?: ?: _8 Q* G. v- static volatile int irqraised1 = 0;
% V: H l' r& g& t4 h - static volatile int irqraised2 = 0;# \ b( \6 E* M: n6 d0 \
& Z4 \/ K) n+ ^$ l- c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s( L3 Y- P. D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# K% Y* _8 b. F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( a6 b! Q# ?0 m4 P4 j - " [/ I0 {1 U2 a+ @/ G
- dma_addr_t dmaphyssrc1 = 0;9 v8 C$ `, Z; o& ], n2 c2 u& I
- dma_addr_t dmaphyssrc2 = 0;
. C; J' b$ ` S4 b4 D) E - dma_addr_t dmaphysdest1 = 0;
( R* A4 j* V# h7 v7 t7 B V - dma_addr_t dmaphysdest2 = 0;
$ j# x- Z/ g' t5 \ - K7 }. T* c2 d( I; B
- char *dmabufsrc1 = NULL;: C2 y4 E& g2 ^% ] ~0 y
- char *dmabufsrc2 = NULL;7 N t; W$ W( R; n0 e1 U
- char *dmabufdest1 = NULL;
/ t! w% k2 C; y% Z. v - char *dmabufdest2 = NULL;/ W$ N4 |+ q% q3 {% o1 I
5 ?4 `# j+ A9 f- static int acnt = 512;4 S: ^8 j- D1 h. a+ f
- static int bcnt = 8;" S! R8 v( p- }
- static int ccnt = 8;! U; V7 }1 \4 U
- j9 [+ w- d) J1 r- module_param(acnt, int, S_IRUGO);
* {6 e' K9 w1 C3 Z$ r" N6 G% u - module_param(bcnt, int, S_IRUGO);! d [% Z9 }; N* X# Q, V, c/ Z1 ]- X
- module_param(ccnt, int, S_IRUGO);
复制代码 8 J6 T4 v" {+ L( ?9 B9 u- C9 q
* ~/ J+ [3 l* \- z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 I7 e, H; C* U9 V2 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! [+ L; f7 g+ b3 m4 ^3 u' `: h5 { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 z* O: ^& I$ K6 i2 v( u1 J
1 q2 F5 }6 J9 ^5 c' E Q! j# T7 \8 i
|
|