|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# d6 O8 b; p C C, V. ]- [code]EDMA sample test application: r X+ Q; S$ V+ Y1 `
- /*
1 q& N9 m1 z+ n - * edma_test.c4 q- J4 ~$ D( @4 l5 u( C7 Z# G
- *! T/ a% H+ o; z* A
- * brief EDMA3 Test Application
- O& C: c* c8 B5 C5 e* z - *, i$ I. S3 _# s6 U; _8 _
- * This file contains EDMA3 Test code.: n- W# Q1 E3 W& w/ g
- *
5 C4 _/ b+ H2 U. N- d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ~4 r+ r/ e. E* v9 x$ C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 o$ [+ B# Y/ [5 f8 Y8 F - * TO CHANGE./ _! T& P$ Y1 ~ {
- *
/ Q1 d7 X& h( r: M }$ s( e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. I2 k0 S+ g3 S! W; I! f
- *
( u4 r9 t- X: ?$ Z. a - * This program is free software; you can redistribute it and/or
4 g# W2 m* ~ g( j8 ] Y6 G - * modify it under the terms of the GNU General Public License as
9 _5 S; i, Z4 R+ B* d - * published by the Free Software Foundation version 2.% S" [! N3 y: `! {
- *# Q# p0 ?$ n+ k, q/ G7 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ?" T2 D' g! f
- * kind, whether express or implied; without even the implied warranty
j. g) [4 s; l1 `5 a1 }4 U2 i- y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" _ h( ]# a. g$ `) Y
- * GNU General Public License for more details.
6 Q: Q& o | N2 v3 s& S - */
" ^5 x) z A" `; r$ C; O( n
+ N: K; f* Z0 c2 A" k9 O- #include <linux/module.h>( h0 C9 i/ ^, E, a! k" N
- #include <linux/init.h>
( e4 x% J! g3 j3 v8 q Q# A - #include <linux/errno.h>
# Q' C4 |* W: O* C k0 f8 D# \1 R - #include <linux/types.h>2 `- ^0 J: m o; \+ y2 P
- #include <linux/interrupt.h>
: P# q* ~1 `% I) a( u8 v - #include <asm/io.h>
. \) r0 V$ P! h - #include <linux/moduleparam.h>
- N1 J' u( c( B7 B# D& h! N( K' ` - #include <linux/sysctl.h>6 l- a: u' x3 t u, y; W. L
- #include <linux/mm.h>5 p5 n6 v- C r3 ^2 f- I: h+ A
- #include <linux/dma-mapping.h>, W- P( A0 J) H6 {5 Z) z- }- `
- ' p9 f2 d+ G0 t. g& V
- #include <mach/memory.h>
) |- ~) r5 j) {$ h+ ]5 { - #include <mach/hardware.h>
7 `2 c. \, ~: [; M, g - #include <mach/irqs.h>
( j, T2 \ J L/ o/ U- f' J) j - #include <asm/hardware/edma.h>
* k% t' x) b. X2 {* ~ - 3 Q% L+ G. n! B0 }5 l
- #undef EDMA3_DEBUG
( Z4 K5 ]/ {( X9 h- C$ n9 X - /*#define EDMA3_DEBUG*/
+ o* E# _" e! j( f% n# r2 i - + ^7 S" V+ L7 F$ h/ i1 z
- #ifdef EDMA3_DEBUG
/ u, C b; r6 ^! O. r) }) G: ?/ h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 |* M+ v/ s( [8 A" W3 v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! _( q% g2 h) {; [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% k3 x7 f5 P; L+ q - #else+ M. o7 k; Z5 S" B
- #define DMA_PRINTK( x... )1 v) E Y$ t6 S: m7 C
- #define DMA_FN_IN
9 C5 D& a' Q- g Q+ t - #define DMA_FN_OUT
& a* j! M9 a- R+ g3 H; Y% m9 X - #endif
2 @# j U! [- o - " n8 w5 w' W, [3 r* G" s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) ~0 K. o- Y+ E3 Z - #define STATIC_SHIFT 3
$ ~6 F; A+ H8 g, C - #define TCINTEN_SHIFT 202 e+ e+ d+ Y' k' W/ J" ]3 M
- #define ITCINTEN_SHIFT 217 e' t5 M( C" g2 C
- #define TCCHEN_SHIFT 224 l/ q0 C3 f( r
- #define ITCCHEN_SHIFT 23
( n* D) w: T ?2 `+ U
r3 D9 w+ h; \! O- static volatile int irqraised1 = 0;
( ]% }; |- v# ^! }; ?5 G; k1 h( \ - static volatile int irqraised2 = 0;
/ T+ c) P3 r0 j4 b i - 0 \) O* V' E! ]7 y6 [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 J+ z' X' l' _( t5 |& i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); o: b3 ~0 T( P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 W& R8 q' x) }: x4 a( m
- & `# H3 @! V8 U A
- dma_addr_t dmaphyssrc1 = 0;
* ^- J# A- |9 A- ]+ N+ O9 K& M( J - dma_addr_t dmaphyssrc2 = 0;
9 l [+ Z4 W q1 k3 D9 G R) u - dma_addr_t dmaphysdest1 = 0;9 |2 j5 u6 N0 [4 m% V
- dma_addr_t dmaphysdest2 = 0;
* D( f/ F$ ~3 `9 k' X) S
. [, p, J/ e+ ?- char *dmabufsrc1 = NULL;
' w0 {2 `8 p3 u# B3 K+ s; | - char *dmabufsrc2 = NULL;
8 i2 C1 u |/ w0 a5 u8 x- y4 G - char *dmabufdest1 = NULL;
. h8 L* ^9 H' a/ B - char *dmabufdest2 = NULL;9 b* v4 H$ Y0 ]9 x
L/ f' k0 ^$ {- static int acnt = 512;
p8 e8 R% D: w7 U2 b. t$ |0 W5 ^ - static int bcnt = 8;/ l0 L. C4 |/ h! g
- static int ccnt = 8;
7 m- w2 R/ U: X - ' S( v8 m7 H" ^$ Y4 ]9 O: t
- module_param(acnt, int, S_IRUGO);
/ Q5 X3 C8 o) z7 t - module_param(bcnt, int, S_IRUGO);
N' ~) O6 j" W - module_param(ccnt, int, S_IRUGO);
复制代码
; S( @9 ]* o) U: b W& _
|: v- B6 b, Y0 y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. I8 E7 ?+ H3 }9 f8 U; T' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 S; I# k. f6 r; H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: f/ X; D& {! C1 |4 N7 A* Q# X. X
& j7 ~/ `1 {. D; T4 h3 `3 {" n j u: X
|
|