|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 k/ ~. l5 \# ~
- [code]EDMA sample test application' P: m: i9 B. ?- O, ]7 K) C2 j
- /*' a1 P$ x0 Q3 d. [! P, [" o: d ]6 u2 ^
- * edma_test.c$ u* k- J7 T) @, W& Q) H/ f
- *
' C5 _# x) J3 t3 t c: R - * brief EDMA3 Test Application# D7 e) z& {% Q- b; t2 a
- *
( c3 o. T8 v' X& t8 ^: x - * This file contains EDMA3 Test code.6 [0 y! z& t, U% D. s1 q
- *
% j+ D. ]: g) Y4 {; s: Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# ^+ O. u/ c$ E- i) a7 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 E7 M, m- A! G* l! R. B4 @( J - * TO CHANGE." n0 _5 W5 f5 f9 b2 {0 B2 g$ D
- *3 Z6 {. G4 S" a/ l: e; k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, n$ N- L' L6 k& Y
- *$ g6 ^, q, ~7 e" T' Q& X. |
- * This program is free software; you can redistribute it and/or7 W9 J$ B9 k2 `5 e" s
- * modify it under the terms of the GNU General Public License as
$ N9 Q2 a0 F( c ^4 @' Q# A) g0 J8 _* |! C - * published by the Free Software Foundation version 2.; _3 _; w: |$ ^5 r/ m+ G
- *
7 W; F' _4 P8 ~9 g: {* I1 x; K; P6 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# \( l7 Z1 h) W* \/ B. \& G - * kind, whether express or implied; without even the implied warranty' _. G, A) P4 D S/ ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ |5 b+ Q9 J9 _2 F8 r - * GNU General Public License for more details.
4 G7 R5 C) E% m! w( @! P9 a0 A - */. E6 d) b( R1 Q( d- a I4 B
- , ?- w: ^( G0 j, k
- #include <linux/module.h> {4 z: `# w5 O( f. d9 ^$ o
- #include <linux/init.h>( u& R* S! G7 _
- #include <linux/errno.h>6 V) a% E, t$ y2 `* Q" _
- #include <linux/types.h>& v# K" Q* R: d3 x! P6 D. B8 t
- #include <linux/interrupt.h>
2 M" v9 O+ ]: k9 d# Z3 F - #include <asm/io.h>
* A7 O9 n0 Z( s3 v - #include <linux/moduleparam.h>6 p( X' O3 e, d) }" x$ P# B6 K$ |8 N
- #include <linux/sysctl.h>
* ^1 X; N2 o. l2 q - #include <linux/mm.h>
# P+ n* [! K1 j8 w, ~0 `$ y - #include <linux/dma-mapping.h>
% V, r6 L3 ^: ^- h$ g+ S - / v. ~8 P. @, `# C) Z
- #include <mach/memory.h>" L) t7 ^0 o6 p6 P* z: b+ f8 |
- #include <mach/hardware.h>3 d7 H, ]7 s& Q
- #include <mach/irqs.h>
0 `3 L3 Q. G) T6 Y$ I - #include <asm/hardware/edma.h>; E3 q* W. g( y+ c8 ~
- 8 B, }7 M5 `, `7 }% V0 X3 q* j
- #undef EDMA3_DEBUG
0 [7 H# o; o6 o - /*#define EDMA3_DEBUG*/
3 L" e% r# _5 n0 E - 6 o1 ~# ]) i; o! J
- #ifdef EDMA3_DEBUG+ i8 i' Z1 Y5 R' e& T$ @& p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' \4 |3 A1 C* N7 a, p4 }: T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): w7 `* |1 e6 u: ]) N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% ^& ^; W W9 L7 U
- #else# Y+ t0 }1 P; d
- #define DMA_PRINTK( x... )
* F% i4 O. S- Y1 ` - #define DMA_FN_IN
- T# ]: }+ p/ B( Y- G$ Q& c - #define DMA_FN_OUT
6 u" D. G% k$ H) \! Z0 f - #endif( g' _# x/ d- {) q1 u, l9 v
8 s( {. k1 \, V; _' s0 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& l9 `- G0 b$ Q1 J1 u# ?9 b - #define STATIC_SHIFT 3
9 b, `4 s$ C m% B/ w - #define TCINTEN_SHIFT 208 Z1 i+ z) P* H8 n y) T1 H0 U
- #define ITCINTEN_SHIFT 21; R5 H# P _2 J5 A. c
- #define TCCHEN_SHIFT 22
* @4 H1 [% W# p; U - #define ITCCHEN_SHIFT 23/ T$ h6 b5 T$ q) y% a, e
" ^3 _; j/ I0 B- static volatile int irqraised1 = 0;1 F" |; C0 x* y+ i b Y) n9 S
- static volatile int irqraised2 = 0;9 ^7 g: ~- s4 f
) I( I9 P3 C' s4 b m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ o9 G3 k V2 X9 v2 Z" [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W# T% k' `. Q1 r9 @6 M8 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 r; ]& o4 [0 M5 F - % N" i2 ?, j9 ^3 w7 s2 f
- dma_addr_t dmaphyssrc1 = 0;
3 E. h, Z4 P% A, t7 h0 q - dma_addr_t dmaphyssrc2 = 0;4 l; c- [8 D3 {6 g$ p# S
- dma_addr_t dmaphysdest1 = 0;
, W8 \4 r! V9 I1 X, g3 ?. w, H - dma_addr_t dmaphysdest2 = 0;1 A' B' w4 l- u, M5 B! S: z
- ( e. j8 L/ ]0 U- `* F% v B
- char *dmabufsrc1 = NULL;
5 k d2 N* y% Y; i' i* ^6 ` - char *dmabufsrc2 = NULL;
: N; Y* u+ v9 v$ d - char *dmabufdest1 = NULL;
?4 w, J% L$ {: { - char *dmabufdest2 = NULL;
) T. B7 E9 l' Z+ Z4 c) a, y+ f
# _: C; `, o% h# ^/ l- static int acnt = 512;
( {; u+ T1 S( k7 e7 ] - static int bcnt = 8;! Q: C# H. U- U+ O- F
- static int ccnt = 8;% _9 r) M, R+ [( u7 p* a
- 7 i( x& |8 t) {$ ]" _' q( S( g6 A
- module_param(acnt, int, S_IRUGO);0 `: t0 h- h3 Q2 u: {/ `% `
- module_param(bcnt, int, S_IRUGO);
0 o6 C& Y" e( O$ r( v5 B - module_param(ccnt, int, S_IRUGO);
复制代码 ! j6 h+ P+ o7 Z9 W2 L
" x4 N3 v; q' T+ W; H8 t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. E" M5 A' s( t3 earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ _, L5 o* G& B3 h' _0 m- _* u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ s' j, ?$ G2 ^& W3 J" s
6 A8 q. J, H1 G; Y
0 A3 T9 O) Z1 H! P8 l3 z |
|