|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - C! R6 f5 N4 b( S
- [code]EDMA sample test application0 L) S$ [( F( o- R7 A, c
- /*
; R7 D! N) s' A, B2 f - * edma_test.c
- j+ }* C) T- m - *
; x' f7 u! F1 [, ^ - * brief EDMA3 Test Application1 W+ p! r2 P5 R+ M9 ^1 E+ P* P
- *8 g& d$ o' z9 {. ~
- * This file contains EDMA3 Test code.
( w/ M( c# D+ |# e* P0 M' T* ` - *
4 f% c$ V& w6 q4 N* ~/ V2 [! @8 T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% V) E$ i3 z& v: V! w" f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 D' n& \, n% ?/ \5 k
- * TO CHANGE.
2 k4 Z9 s( f0 M* [4 n% S9 f7 V6 E - *9 u8 M# }. L+ ~' f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 `( E z8 ~* u9 z& T3 j* ]: H
- *
( h( @8 ~4 r8 T0 W7 t - * This program is free software; you can redistribute it and/or
& B$ }* m/ j/ c! k0 }) w - * modify it under the terms of the GNU General Public License as
- C5 v( i+ W7 Y7 I - * published by the Free Software Foundation version 2./ w6 M. m5 X$ Z) ~
- *+ L1 ~. y6 x: V2 G7 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
l" b; a" ^1 R8 @7 } - * kind, whether express or implied; without even the implied warranty- R) R. ?; m3 b0 d% J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 u, _! v8 _: v' J
- * GNU General Public License for more details.
3 ~' w5 C* H" W8 v3 W - */
( {2 F! t+ L2 V# ^3 R5 G6 a - 7 ^, X. U5 L+ Y
- #include <linux/module.h>
" f7 j' V) Z' r I. M4 J - #include <linux/init.h>5 y, P! _6 G$ o6 M' O8 L' j
- #include <linux/errno.h>4 Z" o, b6 M) U1 x& ~$ E5 u
- #include <linux/types.h>
- D! Y# A/ w0 x3 G2 G+ s) \ - #include <linux/interrupt.h>- m. P0 d6 [& H8 o* U
- #include <asm/io.h>
% _ i# g& l8 _; t" t; L: z# N - #include <linux/moduleparam.h>
0 L4 d! f) S. T- U' k! B! H+ l - #include <linux/sysctl.h>
. \8 p( F" p& t ~ - #include <linux/mm.h>; g" b; w. t3 v0 g3 C
- #include <linux/dma-mapping.h>7 g' w5 T" o9 y! E9 E- N
- * r5 k4 _' J% d; _. J5 }
- #include <mach/memory.h>
4 \* x: ]: m+ k+ R L! j - #include <mach/hardware.h>
7 G9 b% H9 s3 k! l. m; ` - #include <mach/irqs.h>. Q Z! l. T X& h# s4 T( d
- #include <asm/hardware/edma.h>2 z: q; s4 d! n: w9 `* a- Y
- # [2 E" ] Z0 b# X
- #undef EDMA3_DEBUG$ j1 Q5 c3 H- I# X8 n# L
- /*#define EDMA3_DEBUG*/ H, P$ q6 U+ U8 Z' Q! p8 S
' N6 J; [6 s, d; ~. w- #ifdef EDMA3_DEBUG
% V8 w4 X/ J I, S8 g9 K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 V( R; {$ J; ~: L. Z' E% E- y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ O7 Y3 X! u3 w( s8 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% s. Z1 H% g6 q# C- I D- U0 M
- #else' }9 S7 }% t/ T$ W5 `4 ^0 g
- #define DMA_PRINTK( x... )- j) L3 ?; g N/ G: |
- #define DMA_FN_IN
4 m. e) O3 Q; i5 x - #define DMA_FN_OUT9 ^2 N& J7 U" V2 _; K. _7 A) j
- #endif6 W9 h# F# a# v: a
$ P8 f4 A1 n, a8 S* n0 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ `" z. e) m+ j+ v- x
- #define STATIC_SHIFT 37 u* E$ h7 O- B3 q8 ?6 z
- #define TCINTEN_SHIFT 203 ?) E) q4 V& ^0 Q3 M
- #define ITCINTEN_SHIFT 21: a9 i( c! I: H! H1 [/ ~# Y: B
- #define TCCHEN_SHIFT 22
$ f5 `. P5 D# ~/ ~' A: R# a! s - #define ITCCHEN_SHIFT 23
2 d# T, S* R7 f0 g- I. X
# k% K4 L6 f, y" e4 i8 J- static volatile int irqraised1 = 0;# y9 {; S2 @0 ~# T2 d. E
- static volatile int irqraised2 = 0;
. ? ?4 \' w1 r0 H
( ~6 L$ F( v" N. r+ P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 A1 q- q6 i. F F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r5 P/ S. Z! L* [! N& E; ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 T1 X- _( h1 B$ k0 Y& g$ v/ q - % A6 }; S" v4 D/ w2 z
- dma_addr_t dmaphyssrc1 = 0;0 S7 u9 q% |( @+ ?8 c
- dma_addr_t dmaphyssrc2 = 0;
& V" o, i$ v5 d J9 | - dma_addr_t dmaphysdest1 = 0;, j+ S6 B+ N6 ]' L4 D
- dma_addr_t dmaphysdest2 = 0;
$ V7 R8 ^/ R% E1 I+ }/ P: n2 O
; ?" S$ X: m/ _7 V% o+ Q, i6 t" c- char *dmabufsrc1 = NULL;
; |. J, T0 O a" o5 } - char *dmabufsrc2 = NULL;6 | l1 n" C2 a" z% Q; }
- char *dmabufdest1 = NULL;& [' E9 @' x: U3 }
- char *dmabufdest2 = NULL;
' N ?1 D! C3 j" h$ B5 I) W* L
7 `5 k4 j2 f8 o1 C' T0 X" ]8 l- static int acnt = 512;
% g, a, W8 C, L3 v, M& p7 n# Z - static int bcnt = 8;
$ s% W+ E2 a# | - static int ccnt = 8;* I3 C4 J: ?/ k: h5 ~
8 ?# u* v$ F& p2 B- module_param(acnt, int, S_IRUGO);
' e- `( B" v4 d9 x' @3 m9 r W - module_param(bcnt, int, S_IRUGO);" f8 L+ A9 x6 z3 m- H1 H
- module_param(ccnt, int, S_IRUGO);
复制代码
) _( V L Q. J" v `# V1 l+ u
' [7 x0 { A# [/ [! v+ _: D+ G8 @7 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( V: ]7 O/ }$ n1 K: y5 R7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) A- D9 |9 x$ n. ?8 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 I/ \, Z; Y2 u. n5 U7 K1 A6 |3 R
& h, P0 B( M+ {1 o' E |
|