|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( I7 m2 R% L0 I- [code]EDMA sample test application' c& S! z; f$ n) A0 K
- /*# E" [5 a3 \* Y
- * edma_test.c
+ b# a5 j0 `: U! G- v - *
- s* |% a ^7 V' W5 t' c - * brief EDMA3 Test Application
2 v5 O$ |6 P2 \ `, ^% { - *5 c: w. n% _+ z7 n% R5 @
- * This file contains EDMA3 Test code.: J3 y7 F* `; O7 j/ k
- *
5 t7 p) ~% R" B6 s# Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 f3 d# @+ L `, W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 a$ j. G6 a/ G% A9 {' I+ D& E* H
- * TO CHANGE." T. X7 ^8 }% D, j% m- }
- *
. ?0 q) p4 H V; [% y) E" z7 c$ e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 [% L9 I n7 w5 a) p
- *
% M( p1 q6 d6 I6 r( i1 P6 ?& n9 F - * This program is free software; you can redistribute it and/or
! l3 `& l* H. ~' M. ^* v6 X( V8 K - * modify it under the terms of the GNU General Public License as" A$ t9 _( w; d' K
- * published by the Free Software Foundation version 2.; L" i( `3 Q* G- b: }
- *
% z( o5 {+ A1 l' c: `( P - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) x( G9 [2 q2 Q3 ?' E' r3 i - * kind, whether express or implied; without even the implied warranty
" A) r) t& U8 x. t6 \+ R( N! o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& N. L( m- z3 y3 `! Q; A+ m
- * GNU General Public License for more details." ?9 F8 o' i/ ^# ?& d! M. i O! f( R; c
- */ @) V& n6 b7 i! g0 y( P
& J( l z! h7 Z% W3 o; g- #include <linux/module.h>
3 D. B* s0 S0 ?7 ]5 \ - #include <linux/init.h>6 A X7 t) G; R' K$ P0 X$ K
- #include <linux/errno.h>- U; L& Q, ^ [ Q6 v4 L
- #include <linux/types.h>3 h9 F# p+ K& v" m
- #include <linux/interrupt.h>
+ ?. f6 k7 L+ a9 z3 j4 x( z! g0 ? - #include <asm/io.h>+ _" y! R) i3 J4 i) r
- #include <linux/moduleparam.h>8 i& Z+ F' U' Y' x' r, b, J
- #include <linux/sysctl.h>3 I# f: u% ?! z8 f: {! e/ f
- #include <linux/mm.h>
( k0 K/ g" r' t/ ?+ W2 R - #include <linux/dma-mapping.h>
0 Z4 g: [" ~. F9 F4 y - 8 w+ o( c; M; \# B* x; p1 q
- #include <mach/memory.h>2 G% H; w& Y# Z! U
- #include <mach/hardware.h>8 D9 E# }. \9 z& W/ w3 X, i
- #include <mach/irqs.h>( {$ p$ D9 w0 u7 \" B7 N# w+ T
- #include <asm/hardware/edma.h>; T, J* J* ~+ K# U
- - W# o$ O F" N$ B
- #undef EDMA3_DEBUG- a. [/ s. q' |3 x. y8 `
- /*#define EDMA3_DEBUG*/( A/ `& ]* b! L# a6 p, O! l7 i* q
; {5 R5 o, {4 h' V+ N" `! y- #ifdef EDMA3_DEBUG. L5 M: |; R; t" w, F+ `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 X" i \- f7 u( O2 W - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, }( `4 i) G# t& v: O$ }# t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! i9 A5 V9 X- g9 w; s - #else
h/ h/ U2 I7 O+ u& ~ - #define DMA_PRINTK( x... ): w# M3 a) m& C; s2 A
- #define DMA_FN_IN+ j [: m( Q) E
- #define DMA_FN_OUT
3 e2 K- g! v& Z, f - #endif
4 T1 a" Z& A9 [0 c# Z% M4 `
: A: F( J$ s: d _7 Y6 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 H2 k. ~; V$ N1 m5 o6 f8 r4 m - #define STATIC_SHIFT 3
& M/ `1 h$ O5 D) j$ b2 A - #define TCINTEN_SHIFT 20; M5 A- B+ D& _7 b" [
- #define ITCINTEN_SHIFT 21( y" Q5 f, i6 c- F/ e9 O' ]3 ?
- #define TCCHEN_SHIFT 22
( @3 d$ g, l1 a - #define ITCCHEN_SHIFT 23+ x8 T O2 c8 W1 R& C" {
- 2 w# [2 @0 p# x# `9 Y b' j+ T
- static volatile int irqraised1 = 0;
9 _6 M. b" w4 @) W8 e - static volatile int irqraised2 = 0;
) r3 V% v- T, \& }. u# F# e8 B; L# g
- q" l- N0 u) d; B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) j/ G! R! C9 _( K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }* N* a+ `; \% m; @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 L. f- t) S: Z6 o2 l# U1 |% h6 a - ; d/ B" G7 E9 R$ j( a1 I1 v
- dma_addr_t dmaphyssrc1 = 0; h, D! O% F! N! C
- dma_addr_t dmaphyssrc2 = 0;
; b' e0 o c/ a* X8 } - dma_addr_t dmaphysdest1 = 0;3 b2 n) C' e$ \: G: S6 s
- dma_addr_t dmaphysdest2 = 0;. L2 p1 L8 y" N* A
- 7 C. M" y2 p0 x j+ v$ P
- char *dmabufsrc1 = NULL;
" _ w+ z, F& J9 B# Z - char *dmabufsrc2 = NULL;
) L+ N$ ]# z+ g+ b: E* O) s4 p - char *dmabufdest1 = NULL;
5 c9 p. G( G# j. B$ |$ B2 l - char *dmabufdest2 = NULL;4 G- r" e% L1 j* J6 b& i
- 6 r. r/ u# h" {. _5 r# _
- static int acnt = 512;2 Y" g% W& {- x- |! s- K
- static int bcnt = 8;* t/ Z! a- s+ `. I' A' j* J% p2 D
- static int ccnt = 8;/ y0 ?% q8 P% T8 i
- ) Y& S* I. R6 I0 f0 ?( v4 E% t
- module_param(acnt, int, S_IRUGO);3 n0 z; S$ p2 F7 L4 L @8 L
- module_param(bcnt, int, S_IRUGO);
. K+ c$ N0 o- a7 o3 b" m - module_param(ccnt, int, S_IRUGO);
复制代码 1 O3 Z0 q+ ]! F; x6 p
: @5 K, G) Z, e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- d0 f! f' P6 k; Y H& X; Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ G+ ^9 q, G% q0 {% E8 j) r$ p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 \2 s% t' x( C% c$ N7 L
8 Y- k- q4 F9 ^1 Z0 b7 T
- Q, |8 i& _% [# @7 Y
|
|