|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- F- z) F! Y! ~' x- f0 i! C- [code]EDMA sample test application
0 r0 h$ s$ ~2 x - /*% Q& B5 v- H3 U- D" i) u
- * edma_test.c. I; @& C6 y; K6 S1 @- |5 w
- *
' ?3 p9 u% ] p, R. w - * brief EDMA3 Test Application
/ i& A( E, G( @& k - *
& u7 y5 p" `% B8 b - * This file contains EDMA3 Test code.
# f& {! c6 r4 G) S! b+ P5 T - *0 y+ a* A# J; s) O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! X- e7 ]+ w7 u4 G2 e) D" g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 m# Q7 i) i, I, F - * TO CHANGE.
9 L( R0 _) @. P- l! h% V( C - *6 N" @7 m6 P7 O: Z% f! g* H2 y- ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ ^5 K7 F5 \+ J3 c" \ - *
1 X$ |' q) J8 g9 N9 I/ g - * This program is free software; you can redistribute it and/or, L i$ }9 [4 j; p T! ?) u
- * modify it under the terms of the GNU General Public License as
6 p' v x0 d) Q, C0 I - * published by the Free Software Foundation version 2.% j# {) A1 j1 ~' Z. D3 w0 E/ I* E( r
- *: K3 W! H- u. x: H& Q" n+ l( A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ l2 \# W! ]: @2 Y/ o) t# z - * kind, whether express or implied; without even the implied warranty
- m( l" M# k# O O C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% ?) I: N: a% D( c. a) V: _3 d( k - * GNU General Public License for more details.4 F( O M9 n& Y7 y& a
- */
/ T0 P% b4 _6 g
8 K5 A" A: n6 D' v/ H' k# w- #include <linux/module.h>
! A; {$ X# J! M- P7 f - #include <linux/init.h>
+ E! z: w# Z8 L( C! W( v% F - #include <linux/errno.h>
) X4 P8 I4 J: T2 m - #include <linux/types.h>
3 Z4 S. z+ V# [; ^ V4 ? - #include <linux/interrupt.h>
+ |1 A8 x2 D! f. ]& n+ | - #include <asm/io.h>
( g& N& K X+ A- ?1 G - #include <linux/moduleparam.h>
7 I$ f8 s }7 ^( K L - #include <linux/sysctl.h>8 k; r: e/ B( j; | M. F) V" X" Y! [/ P
- #include <linux/mm.h>( L0 D" Q1 I! i5 e
- #include <linux/dma-mapping.h>
. A" I3 j/ c- U* o
9 E/ t4 K2 i! H5 t) z- #include <mach/memory.h>
8 }& E+ x# w3 S5 E9 }/ d+ p - #include <mach/hardware.h>
/ T' R: G# o9 z0 \0 Q0 H" O( x a - #include <mach/irqs.h>
% X1 u: {5 [0 ]+ R/ g& w - #include <asm/hardware/edma.h>. ~% h* b: ], }8 y
4 T0 A5 x" F% I0 R& S( ^- #undef EDMA3_DEBUG! L' f( L- f. v7 p& H7 T4 L* A
- /*#define EDMA3_DEBUG*/
1 P, G& \, S9 s" c6 e& s, \ - - J8 q8 z/ E5 _+ v: w
- #ifdef EDMA3_DEBUG
& p% B5 y5 [- M% L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ?3 n; ?. U1 ]; {- `* I5 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 F8 y- m" x) q- t; H. e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- F1 `* z7 V# J/ g. ~* X+ z4 N - #else2 `. w) i& W. C! ~
- #define DMA_PRINTK( x... )
+ ?: X6 G! X( y b; H - #define DMA_FN_IN
4 u( O7 v% A9 `( t% L5 K9 Q - #define DMA_FN_OUT( T6 L% \, f2 C' N Y
- #endif
, a7 i" I- L2 e1 O6 l: j: p
; r3 m/ z& \* P( w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% i( ^2 a9 X* |- |; o' _' _! { - #define STATIC_SHIFT 37 g' V$ P" ]7 t& b P
- #define TCINTEN_SHIFT 20
6 H1 }8 j" r( ?) \' I2 C0 r; Q/ @9 u - #define ITCINTEN_SHIFT 214 t( y$ T0 u7 S# ^# F+ `' o
- #define TCCHEN_SHIFT 22: I1 Z' F" k# g! K" }
- #define ITCCHEN_SHIFT 23
! c/ a/ W8 P2 r; k; y2 | - # x) D! l% q, d \' [
- static volatile int irqraised1 = 0;, R, V" H' t( h- f" l
- static volatile int irqraised2 = 0;7 y4 r3 J, r" j6 u- K" E
- 5 b/ z: i B: N [' \- {! v% @. w% f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C* s/ e7 y& V5 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s" a4 I) x; y; b+ b) y7 S" w- F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 c4 k; H% I4 |
2 j- f3 w5 Z B9 J, a+ A- dma_addr_t dmaphyssrc1 = 0;
& Y# A$ R7 h. q$ C - dma_addr_t dmaphyssrc2 = 0;1 J9 ^' h1 A1 r( z/ T, @1 y
- dma_addr_t dmaphysdest1 = 0;; ]1 _) _, ?; h' f: i! p7 D
- dma_addr_t dmaphysdest2 = 0;! M- l7 m- m6 v' a
% @4 Z# z. Q6 z: ]1 L' S- char *dmabufsrc1 = NULL;
6 L2 z9 |' M9 @; b2 k# w; L - char *dmabufsrc2 = NULL;
}2 R- _! B2 }# c4 ~! u8 ^- j - char *dmabufdest1 = NULL;
2 g3 N2 p0 f: p - char *dmabufdest2 = NULL;- c: f6 L' F l, {
/ R' t) b& D6 Z$ |- static int acnt = 512;
" }6 @% E1 @9 _# d# q - static int bcnt = 8;
. _6 M+ n6 [ H+ E) l - static int ccnt = 8;
5 f( k' X7 _2 u+ k9 c/ Z - + x7 Y, g; B' G1 V1 v. ]/ @
- module_param(acnt, int, S_IRUGO);
" K6 m& ]; h1 Q& ~% e - module_param(bcnt, int, S_IRUGO);
8 l% u3 @+ V* ` ^4 q/ Q - module_param(ccnt, int, S_IRUGO);
复制代码 8 t0 }9 U: o. m$ S
0 ^7 s* L2 m6 H2 x( ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* D g4 R+ N; T6 M8 ]( @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& b1 ?7 s0 `; R3 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 s+ I2 v3 S6 }" u
) L }, h% `& L! E
( c( @8 B* v. W) z; O- `# v |
|