|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 [+ V% w" v& o. S- [code]EDMA sample test application& v) y( v9 B$ I0 W+ u; F8 h- w; |
- /*
" @, j- e, n9 B0 U6 p; L - * edma_test.c1 I; E/ ?$ s: C6 }2 r, i
- *
! R6 U! _- F1 z( ~% `9 ], j - * brief EDMA3 Test Application+ b3 X& Z5 ^6 N% F
- *
6 z0 }3 {- k' i" N4 w# ?; j: p9 E - * This file contains EDMA3 Test code.
" n4 ~ J: l7 Z) z) h - *
. N' @0 X! I7 h5 N0 }) i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' x, ^* ~$ r6 k6 _. w/ G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 R8 U3 I$ \( j9 U - * TO CHANGE.
7 y3 I& ~1 X: g( _0 ]# b7 I' R1 a - *
4 ~+ E0 S% j- ? - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 u/ c( e1 K& u' a$ E1 y - * E: \# w; @# k, A, r9 h7 [5 }, H
- * This program is free software; you can redistribute it and/or
, i; f9 p! X3 s, s7 e - * modify it under the terms of the GNU General Public License as; K! a+ B/ m9 s4 J9 s
- * published by the Free Software Foundation version 2.
$ O6 B" O6 X2 P, z+ d @/ ? - *9 F K: ~0 H* C, ~, C* w& Q4 y5 o/ s& G
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 ^& N2 F; [# X9 W2 y7 a% J s - * kind, whether express or implied; without even the implied warranty
; w4 v. f; `: ]8 R* Y& ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
s& f4 M4 f( ^+ H# k - * GNU General Public License for more details., D' q1 q7 _# p5 e: i2 y
- */
4 u2 \$ X" L" r) W* C
' E' F: n* u, L" q- #include <linux/module.h>
% }9 ~$ i% j9 w. [$ E4 h. a - #include <linux/init.h>
- W8 @# I4 p% \( G - #include <linux/errno.h>
! G; l- G7 D" {4 K - #include <linux/types.h>+ X8 u* i! B8 _& Y( ?& M
- #include <linux/interrupt.h>
- M1 _, {# I' e# L8 ?3 H: t4 C - #include <asm/io.h>
5 d& s9 ^; Q6 }+ P6 _# F - #include <linux/moduleparam.h>; t5 T5 U5 ?/ [5 i" Y$ F2 {: k
- #include <linux/sysctl.h>
1 o% J/ K$ h' J - #include <linux/mm.h>% k" S. e. e; |1 G
- #include <linux/dma-mapping.h>
6 j5 C, l+ m7 X5 t" e - ' c$ Y" h; l) ]7 i$ B/ a3 O
- #include <mach/memory.h>
9 P# V! F% s7 O/ U! Z6 i3 B - #include <mach/hardware.h>5 T6 A, l: h* O0 c5 ]
- #include <mach/irqs.h>* f$ ^9 q; H. {! K* z8 v, ]
- #include <asm/hardware/edma.h>% \/ _: X; {8 r2 w2 B
- ( i8 D: f. ~9 `9 _7 e6 i$ M
- #undef EDMA3_DEBUG7 w% C: X4 o$ O* w' v/ t0 H
- /*#define EDMA3_DEBUG*/+ h2 O& E. x4 p' ^9 g
- % x/ y1 m6 U( i* F
- #ifdef EDMA3_DEBUG; q8 H/ g ^& D1 X. E2 O' G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( J/ s7 H3 u' |& N. s0 o: m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 F0 T# v! j. M- h3 w( K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 F( r* U/ R: q& k - #else
6 s3 ~% x- ]# F- E - #define DMA_PRINTK( x... )
- ^" U. p7 k8 O' K! z K% {, u8 c - #define DMA_FN_IN
) w F' Z- H0 v0 R1 @0 E1 d* [6 Q - #define DMA_FN_OUT
* O E; |% x! Z# F - #endif# e9 v2 a: ~7 _9 G% C
" v+ y/ ?% @* S J' e( u: o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; d" x$ [% D1 C2 ?! a - #define STATIC_SHIFT 3
* x8 R2 s$ m0 ^9 G - #define TCINTEN_SHIFT 207 k# V) I) W! Y* d" v% K8 K/ K: b
- #define ITCINTEN_SHIFT 21 U9 F- Z/ u2 w i
- #define TCCHEN_SHIFT 22; T( U/ D6 C( F# c" [! H
- #define ITCCHEN_SHIFT 23. [5 {; N* J# d' I
- 5 O+ b% s: r' T
- static volatile int irqraised1 = 0;$ H5 p! Y* c: k& Q2 }+ Y6 i( ^9 G; e. t% i
- static volatile int irqraised2 = 0;
" b. y3 t) `, ^% a
9 Q2 E, _& M# Y7 g, N" ^) }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! m/ h# V% \" j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); N6 f* }5 x( K* K& n+ Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# P5 k+ U2 S' F, U2 \( ?4 S0 {4 a
- 5 G8 o3 a% t0 w
- dma_addr_t dmaphyssrc1 = 0;6 | c8 v+ f1 _8 V f, ?
- dma_addr_t dmaphyssrc2 = 0;2 a0 u7 P8 E: W& }# z7 c$ A
- dma_addr_t dmaphysdest1 = 0;- ^" W' B3 K9 F# z
- dma_addr_t dmaphysdest2 = 0;
$ Z* M3 t$ W$ V# D( E5 l
' i- {% ]* x2 H8 @# H- char *dmabufsrc1 = NULL;
4 t0 ^( k, F% U - char *dmabufsrc2 = NULL;
}& Q8 v4 K9 H. g- B% v+ W* R- A - char *dmabufdest1 = NULL;
4 B% A- W" j! d( i. I0 W9 d+ t& o, ? - char *dmabufdest2 = NULL;
/ t" B. u! D- N s9 M$ O
& }- g9 P' v: g" ~- F U* e+ c- static int acnt = 512;3 e" y* t' z; }, [6 T
- static int bcnt = 8;+ j, E/ g$ \6 l$ t/ c
- static int ccnt = 8;
" S e" q; [& ]" T
. a& `1 ?( N3 K- module_param(acnt, int, S_IRUGO);
- U1 D2 m, A& u, d4 N - module_param(bcnt, int, S_IRUGO);& e9 z+ Q& Y0 G0 l* T! O1 l
- module_param(ccnt, int, S_IRUGO);
复制代码 7 t7 \2 u9 ]2 U1 W
) m+ |1 v; a: t9 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! k) @; T# T6 S v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: ^* N N7 o7 j: } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 o' {3 f) o: S; ?( D
8 P0 w. `6 V. q+ i
( ~8 B: j# T% b: c, } |
|