|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * [ K( ]1 a8 _7 E# S+ c7 V# v
- [code]EDMA sample test application
% N, ^8 k/ i; i* }, p - /*
; a% P. x* n6 U% F0 H - * edma_test.c- v. B/ {1 C0 i) o8 A* a2 Q
- *, V1 q# v; J4 z2 [
- * brief EDMA3 Test Application
: q6 Q( p) h* v2 l - *" l1 c) e0 y/ e- j
- * This file contains EDMA3 Test code.9 f* U8 Z) t( q: z1 p/ ]. \
- *. r% T+ K( z! d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Q1 D9 C1 n7 F8 \% y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT [5 P7 ?$ v& a0 f0 E6 [; ^
- * TO CHANGE.
; ~: ~5 Z) s1 {+ r% K - *& L( W8 k" [. f Z$ _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 ^: i0 [- c! ]3 I* S - *
, Q8 R" Z+ p/ Y- M) i - * This program is free software; you can redistribute it and/or
; T5 Y& ~3 `2 Y - * modify it under the terms of the GNU General Public License as6 y( {+ F, u) M7 |+ c- H
- * published by the Free Software Foundation version 2./ P4 R, v4 E8 ]7 h) p
- *+ ?. j }- i7 ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any Z* t. g, C+ A- w0 S
- * kind, whether express or implied; without even the implied warranty
; f/ h/ I% p- v! k. ?/ K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ }- z6 z! E$ m, O) B5 q4 x0 e
- * GNU General Public License for more details.
4 [, q" l7 U+ F* H - */' K4 u3 o9 K" i& B
- % v) ?3 { x0 c& u$ Y; C, K( x% u
- #include <linux/module.h>
: `: I1 a9 C$ F" M - #include <linux/init.h>+ N& j- G! ^" H/ ?
- #include <linux/errno.h>& {7 V$ Y( J% }7 z( a- m3 A
- #include <linux/types.h>+ q: b" b, X% Q+ X- x
- #include <linux/interrupt.h>: [# o5 |9 H6 u4 q3 u- W/ [) h
- #include <asm/io.h>3 u4 |! n3 I* @& G# k1 q
- #include <linux/moduleparam.h>
2 @ ~! a0 l& b- k - #include <linux/sysctl.h>
8 R9 u$ j! a% a7 f, g - #include <linux/mm.h>" i) A+ G+ S% E9 {7 K0 U
- #include <linux/dma-mapping.h>
- M- h! f$ _/ Y6 ~7 B) c. ]
3 S7 {1 F( k/ b- #include <mach/memory.h>
( @/ _* A" ^5 Q- `7 d - #include <mach/hardware.h>
! i1 e7 c+ C% Y5 e8 I# \) a7 \ - #include <mach/irqs.h>; ?- F. J5 z, K* U7 o H$ W
- #include <asm/hardware/edma.h>) ^* g# f. U F7 P- z% r
, M9 D" d1 b! M8 a4 z- #undef EDMA3_DEBUG
' y. [7 N& R! w! R3 [ - /*#define EDMA3_DEBUG*/
9 g7 Y9 j& |8 X H2 k/ H
2 V! ` r% c3 [& P- d- #ifdef EDMA3_DEBUG
4 O' G% `, \( H" X, [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). k& D6 t# w5 _7 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [ S y4 u% S* |2 i9 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; E8 E9 P! j, k1 ^) q F - #else1 l+ U3 [- x5 k
- #define DMA_PRINTK( x... )
2 [7 j9 n' `7 R5 J - #define DMA_FN_IN( f: |, s* }' m) ~ x
- #define DMA_FN_OUT
+ ?3 ^; A' X e% }& Z& P - #endif
n) Q* ~. [; }' d! d - ( A* e1 p% z- J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ t$ I' r% Q, R; {6 j* v
- #define STATIC_SHIFT 3; A: b0 Y8 W7 S0 q# d+ I! T$ f3 n
- #define TCINTEN_SHIFT 20
5 O7 K* l5 c7 o! x- j( z( e - #define ITCINTEN_SHIFT 21! C' |3 K; X1 l; e8 x
- #define TCCHEN_SHIFT 22
" `/ V# v/ F) I$ i/ } - #define ITCCHEN_SHIFT 237 a6 m" L/ m: h+ s5 R0 b
8 t$ l. i8 ` D3 m H8 O- static volatile int irqraised1 = 0;+ T2 {, _( E, `
- static volatile int irqraised2 = 0;
" P4 e1 e7 |6 ]4 n
$ @6 ]" C3 \8 ]- ?( k7 A# m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- H- t3 M' n) ~4 |" H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ j& |# j1 P- X& N |. p' x9 I0 ?6 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `! y4 a2 F. f! U o
0 l4 { z- B) ?4 Q1 U1 t O# M: G. H- dma_addr_t dmaphyssrc1 = 0;
6 f) b+ U j- K9 E' c9 | - dma_addr_t dmaphyssrc2 = 0;/ v I; r% o+ P9 d3 M' q4 j
- dma_addr_t dmaphysdest1 = 0;
. J+ t9 f0 j4 m+ b - dma_addr_t dmaphysdest2 = 0;! y7 @9 R6 w* g+ F" Y
7 I; V$ u) q+ r( |4 `- char *dmabufsrc1 = NULL;
$ Q M" y& x5 n+ {% p" Z: p - char *dmabufsrc2 = NULL;
% [5 }% w2 c0 s1 N+ L: {7 a' \ - char *dmabufdest1 = NULL;
. X3 o3 T! O: ]5 \# W5 a - char *dmabufdest2 = NULL;$ y9 j- ~# y- F" c, T
- ; I2 f" Y" k1 f
- static int acnt = 512;
4 w# t0 n a0 e. w- | - static int bcnt = 8;
' @3 c6 M; s t) [7 d) k, T" W) t - static int ccnt = 8;
' | {, S3 C: V- c7 ^0 X5 `/ Q - * L" } u2 k) }" e4 {- [. p8 q7 m
- module_param(acnt, int, S_IRUGO);0 D" d0 K* S8 p" ]5 r
- module_param(bcnt, int, S_IRUGO);
- L' O0 S: {3 p' u; r! a2 Q - module_param(ccnt, int, S_IRUGO);
复制代码
$ ~& F6 g' _' Y5 ?# ^2 u7 H+ V3 a( i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 N4 q, b( ]& g& karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" P0 i6 f: Q! u/ r; w% d' \; J6 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" }) u0 R/ [. K' d I1 W& a3 p0 e
3 m/ ]) \0 J3 W, t. f9 {
( Q3 x' w+ U" |7 p& A |
|