|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % j, }0 P M7 _
- [code]EDMA sample test application/ E* t0 w7 w& I- K# P- [, r
- /*) e5 |' J4 `$ w! Z
- * edma_test.c6 u; t6 e) Z" K% K
- *
& H/ k1 a3 K- i5 E5 K/ y9 ]: } - * brief EDMA3 Test Application/ F6 u( h# Y: @! i1 l/ h" V* |: |
- ** g5 t9 y% b/ `; }/ O8 V% C0 k
- * This file contains EDMA3 Test code.. t' N% @- S* Q) } G$ H4 u
- *
6 S% H0 F z& A. J4 V! y: J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 e" F k0 D! Y4 G' G Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ L1 ~1 H2 Q0 r& q$ |2 R5 R4 g - * TO CHANGE.
# I8 j3 a7 j9 I# b2 c5 q - *% P* d% }1 g+ x c. M8 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 S8 R& U" Y0 s, I9 _+ V - *
5 ?* O! s. N, n4 y! {6 _& k2 d) e - * This program is free software; you can redistribute it and/or9 `4 t( @5 y& ~% v
- * modify it under the terms of the GNU General Public License as
1 O8 w! j5 R2 e5 a& ]( d) I - * published by the Free Software Foundation version 2.7 ?7 s1 I' K, v/ |' \4 V3 Z2 `
- *! t1 h% u; \$ X h o! Q6 Q5 I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; {- R- \" b; F( n7 m5 |* @ - * kind, whether express or implied; without even the implied warranty
+ d0 Q( R0 l. b$ |, }# c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! m6 B" G- i* H: `8 r: L - * GNU General Public License for more details.
% I; K! j0 u9 I, @$ U - */" @$ p7 c5 C& e5 z( d) D
% }+ V. |! R* L' O- #include <linux/module.h>' K( N5 N1 b+ \2 O6 W
- #include <linux/init.h>
: l: s2 h5 ~% i - #include <linux/errno.h>
3 J& w% N1 H- x3 O' L3 r0 G - #include <linux/types.h>
* Z8 S, @4 B4 {' A - #include <linux/interrupt.h>$ j$ D4 B$ b* F# @! L
- #include <asm/io.h>
% \. e' a3 V' s7 ~7 e" d- I- e - #include <linux/moduleparam.h>& Y7 t7 Z# F- h3 |$ x$ O0 L
- #include <linux/sysctl.h>6 o8 n7 T6 U$ k/ ]) Y
- #include <linux/mm.h>
* F$ V# ]3 X/ z7 x! X4 ~. | - #include <linux/dma-mapping.h>
) s9 i9 M" {1 y8 ^* n
( ^7 O/ k( L+ d5 H$ l8 U- #include <mach/memory.h># v8 Y2 U# z5 B. R; M) ?4 r3 M
- #include <mach/hardware.h>+ Y% \( @ h |4 r) T) s
- #include <mach/irqs.h>9 A) g8 M1 O& @( V( x1 t4 s( |- I
- #include <asm/hardware/edma.h>, v* n d9 `) M3 W7 o
- $ K! M8 S6 `5 y2 @+ s
- #undef EDMA3_DEBUG' j- n4 c5 k* X& u; A
- /*#define EDMA3_DEBUG*/7 v2 o( J: k# \
; D, ?( v- w( `' x- #ifdef EDMA3_DEBUG
" Z) J2 y' Z7 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) s9 u* @* f; X* l( |0 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 G- ] }; g5 \/ P% |' x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! A; Z9 T4 Q* r }- F. v, V+ I
- #else2 j k: {$ g5 C0 ^
- #define DMA_PRINTK( x... )
3 v2 s8 X) P5 H) T - #define DMA_FN_IN
, t. i7 ?" h( b8 @9 _" ]3 Z! a! Z% S; C% [ - #define DMA_FN_OUT9 }" w7 Y& `( f) J; |6 e7 G
- #endif
5 x+ _& B. z( |# o! W: Z - * \# B8 h/ M% m1 z, [% R: E' A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" n- f2 x( @5 v) Y
- #define STATIC_SHIFT 30 g, ]9 r) k: @7 |7 }
- #define TCINTEN_SHIFT 20
! I4 C* g9 m7 r* g2 }+ H - #define ITCINTEN_SHIFT 21
. P4 n% F x; x% u8 r2 b6 c - #define TCCHEN_SHIFT 22
; c7 ] U9 F5 P/ r# u6 s+ n7 l6 q$ M - #define ITCCHEN_SHIFT 23+ `& ~4 I3 v+ O0 v2 p
- 6 V$ L* {- M; ^1 Q( A
- static volatile int irqraised1 = 0;
# }/ _) i {9 y( {0 [ - static volatile int irqraised2 = 0;
/ ?; N2 _: c( g/ \. i8 v
' P# F, [$ D/ X* s! K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( K% ~: K3 \% m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 L" v2 ^4 V t6 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 j7 i+ ~9 [5 d9 z* @
" R2 P1 f" z) S* d- W- dma_addr_t dmaphyssrc1 = 0;
" p$ \8 ~- o N7 S- B6 ` - dma_addr_t dmaphyssrc2 = 0;7 }! J7 O# P5 e6 Z) B
- dma_addr_t dmaphysdest1 = 0;
' f7 ]+ E1 v, i; G: W0 W' { - dma_addr_t dmaphysdest2 = 0;' q4 ~, E+ J+ q3 F: k! J0 {
- 0 h- y. i _4 t0 O/ y. m7 i
- char *dmabufsrc1 = NULL;
( i4 m' ~6 p( ]% |# U5 K7 ? - char *dmabufsrc2 = NULL;
/ U0 c3 U l+ o. b4 a& A) g) { - char *dmabufdest1 = NULL;
- Q, Z' Y' H. u6 |- t - char *dmabufdest2 = NULL;
9 {( o5 X! c1 S0 q' R' _
( i$ W, y5 K2 _9 G- static int acnt = 512;
% Z4 _' U" w9 `9 ~+ d9 b2 t - static int bcnt = 8;
3 [+ B o, q3 M7 v9 z - static int ccnt = 8;
5 D# p: U* }; T2 r( U- _, _
% L$ m: a, @% h' i" C- module_param(acnt, int, S_IRUGO);8 z. `' h+ w* f. I- i& p
- module_param(bcnt, int, S_IRUGO);/ s* b$ q0 c( i
- module_param(ccnt, int, S_IRUGO);
复制代码 6 S8 P2 Z- l4 M. y* c2 I
% X+ W- K6 D$ c6 ?/ p( z' c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 o* H+ ^7 p2 Y6 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 W$ J0 `4 z, m- Q0 ~! v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 P5 Z- |. D3 p4 l
1 I- | r6 Q3 X4 y
! S: X' e: B" d/ ?9 Q6 F5 s; b |
|