|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 T! X: ~( ?) J- [code]EDMA sample test application
0 f7 a" P4 ~+ A, V2 u/ s - /*6 W8 M# @- G- k2 m, d2 }
- * edma_test.c% u; h9 W# S8 y- S, z- l
- *4 \4 o9 x3 a. L; q& w! t$ F" S
- * brief EDMA3 Test Application, U5 i& M0 g' M1 n0 T) q/ ]( I
- *' q. a( x& z. x4 s
- * This file contains EDMA3 Test code.3 R$ D+ x" I" ^, J) m
- *
$ I/ F4 W" _4 b0 v# b: X; K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) i: M" g( K* z2 {9 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 O7 \4 @3 m$ }2 ]6 S
- * TO CHANGE.
) l& u; f0 D% k9 Z - *& Z9 m) [3 F2 J* P" Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% X v( f- J4 R; V) Z/ p
- *# G9 C, }- N* S2 J+ U, v5 \- a
- * This program is free software; you can redistribute it and/or
3 ]+ v1 {& F' K - * modify it under the terms of the GNU General Public License as8 j4 [: U, ?: ?* W
- * published by the Free Software Foundation version 2.: |% h" ^! z6 {$ s3 w' _2 m0 f
- *
5 r# I; ~4 N; T. q8 b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- m, O1 H; U$ i& B- `
- * kind, whether express or implied; without even the implied warranty
# {% X( E# T& Q5 T8 F8 f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) v2 p1 q. ~0 d8 T - * GNU General Public License for more details.
+ `0 _' w3 ?9 f - */
7 o/ {, V! O% G/ f' s# [ - 8 }; B& t8 e/ Q, I
- #include <linux/module.h>
5 Q$ O& M4 h- |. n* s: S% X - #include <linux/init.h>
7 g3 v2 f6 R' _; B. D3 C/ y - #include <linux/errno.h>
3 Z4 {9 H8 I7 G. S4 x( g0 @ - #include <linux/types.h>
) r. |+ ^# q' m w- P - #include <linux/interrupt.h>
$ r/ Z: f, H% s) G t- Z$ P: J; |- M - #include <asm/io.h>
$ ^8 t3 g, T; k7 [6 K( M6 x - #include <linux/moduleparam.h>/ _0 M7 T G" h* H
- #include <linux/sysctl.h>) L0 s0 T" v/ o8 {- u' b2 ?
- #include <linux/mm.h>
# c" S# `1 x' R& t) u+ W - #include <linux/dma-mapping.h>6 t3 X* E" S$ y
9 r% y: C5 S1 E! K( N5 q s2 G' P- #include <mach/memory.h>
$ a8 k7 w! B' X) ]3 }8 l - #include <mach/hardware.h># P4 Q: l( S- L- T; N3 J
- #include <mach/irqs.h>
& B' o: v8 V' r! z I0 y - #include <asm/hardware/edma.h>
( W! \3 @3 f* r: @1 O/ @
3 d5 |/ }7 ~7 }+ u* J4 a- #undef EDMA3_DEBUG# V2 D4 G. U7 s
- /*#define EDMA3_DEBUG*/
v! D. G3 ]. O0 _0 j( b/ b
/ ]/ e0 e& `$ _. v; f: d% S: G, K G9 {- #ifdef EDMA3_DEBUG
7 F* s5 R& k) F: T7 D5 { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 _) e/ f2 p0 B& n% ~ ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 @" @7 X" f; u+ _3 M1 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ~/ y ~- R% O9 \2 u! Z" \# ]
- #else
. E4 [4 c9 n7 l6 i6 P) K- w" v - #define DMA_PRINTK( x... )5 H" D/ G3 p, `4 }1 v
- #define DMA_FN_IN
# l5 }& u- j6 f7 O8 ]- n. q - #define DMA_FN_OUT6 |9 M4 ]* H( ~
- #endif
- j! ]+ b4 A9 `9 t - ' a& }0 b) M/ l* Q# B: C3 H% M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 { g' Z0 F) e4 \) p2 Z - #define STATIC_SHIFT 3# c5 w# i8 V% x1 | q$ j
- #define TCINTEN_SHIFT 205 l# Q C+ [. z% z7 p) a
- #define ITCINTEN_SHIFT 21- l' V! m% W2 O
- #define TCCHEN_SHIFT 22
0 B3 E+ M, a* t9 l - #define ITCCHEN_SHIFT 23
& @& r3 G- g T; I$ ^ - * K$ a% q: J- T
- static volatile int irqraised1 = 0;9 h* S- X$ H% N' m1 u$ ], J3 K
- static volatile int irqraised2 = 0;9 U) q- c6 C; W/ _7 q! M3 M n" ^5 r
- + ] K z7 _ W. C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 p" A3 J$ z7 x; t# m; G& G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 d4 c0 E1 I$ v; D6 J$ r" ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) `' F, B6 F, }" G
7 S% K; d: y6 L- dma_addr_t dmaphyssrc1 = 0;( c' l" B3 X) L- Y: G$ M0 `
- dma_addr_t dmaphyssrc2 = 0;
2 |' t5 w( L) _9 z; g - dma_addr_t dmaphysdest1 = 0;
$ O( J1 _/ S; k2 {3 a - dma_addr_t dmaphysdest2 = 0;4 i7 ~) `; y! e! D, I$ s
' U' p! x, V5 E2 C# l4 J- char *dmabufsrc1 = NULL;
" L6 V7 D9 k: d" y& O - char *dmabufsrc2 = NULL;9 s4 _& s3 R: b( K
- char *dmabufdest1 = NULL;
$ g7 `5 p( ~: M7 E7 N* \& I - char *dmabufdest2 = NULL;
' P! E/ q( l6 k# O( J* Q" _# U
/ y P9 \) D; m; c& l& K% F$ @+ m- static int acnt = 512;
]* w. J9 A$ t1 S" ?2 Z" C+ b5 O' { - static int bcnt = 8;
- D0 ^1 B. D" Q5 k0 g - static int ccnt = 8;
6 p) H- z* A+ B+ p5 P( E' k - . j0 \; o/ k, `
- module_param(acnt, int, S_IRUGO);! U( q6 o1 M! x% A/ p9 j
- module_param(bcnt, int, S_IRUGO);
8 p" E1 x# G! @+ [% J - module_param(ccnt, int, S_IRUGO);
复制代码 # M# r: Y/ b" S, I
# s! J& y+ D0 {1 _* l2 t) a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: m9 Y' Q- F; f [3 W8 l' j- {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, ]5 J" n' q: {- N" K& L; A8 y6 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' s2 m% a2 a, w' _( V+ a: n5 |: |1 g4 l% s- M
4 I# d( O6 H1 }+ W% K
|
|