|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , C, r9 n" D. f. a( v5 }
- [code]EDMA sample test application
2 v6 x! c+ S6 l. e1 E4 z - /*2 I! F% Q/ ]+ j- u% ^- d: }6 x
- * edma_test.c
3 ^( W8 l! |$ p; k. n1 X' P - *
1 \% l+ s6 H2 b5 j. h - * brief EDMA3 Test Application
6 q$ j$ W0 W+ F2 ^5 T+ s: D - *
' _2 G3 Y6 k9 O* K - * This file contains EDMA3 Test code.
6 V# I* c9 y8 |3 m# m - *
" Q" {, t) r* W. L6 }/ u/ Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: g. T' d3 h5 z; h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! M1 |& v9 E1 Q0 J" k& M" j
- * TO CHANGE.# |! h# `* y8 v* _# W2 Y
- *
# p7 z& ]' _1 N! G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 M6 u4 ~" E+ _
- *1 D: A6 `* V) Y8 ?1 K
- * This program is free software; you can redistribute it and/or8 @/ c! f& d! Z, x0 B
- * modify it under the terms of the GNU General Public License as9 l& J* `1 q* S% ?% v+ P2 f1 a
- * published by the Free Software Foundation version 2.
- l7 G) z% y2 t2 \! e - *
, f+ ^2 ^8 A/ L9 E1 g# z, b/ n% n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' B# [; h" B0 b6 g( a
- * kind, whether express or implied; without even the implied warranty
o0 U6 r* |4 ~/ Z2 U B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 }1 S9 j/ s* n. }5 y - * GNU General Public License for more details./ B* T. W0 ]( W( P3 p! x7 k# n+ O
- */0 Z7 ~0 G9 e- Y! U) q$ a
- 7 t- c7 {& C1 F: R, a# l P: e
- #include <linux/module.h>
7 L8 y* r* F; w; G7 _5 p - #include <linux/init.h>
, C# b! H3 w( ?8 k t j% B; r - #include <linux/errno.h>
! G# i' }" @3 H7 e - #include <linux/types.h>
) B7 n# O$ R% g3 k - #include <linux/interrupt.h>
+ ?. W7 E h* A9 V: O5 _" P - #include <asm/io.h>
8 F4 ?5 ?7 s+ D - #include <linux/moduleparam.h># g4 E- ?7 T: I" O o! [4 y& ? M
- #include <linux/sysctl.h>! |3 Y% s. \/ q$ W7 D% P
- #include <linux/mm.h>
g& {6 q, x7 F1 |/ U - #include <linux/dma-mapping.h>8 |+ [ W' H6 l
5 L6 D, t x& S0 K0 G5 \4 {- #include <mach/memory.h>! }3 E" R# C* J p& T
- #include <mach/hardware.h>& O/ F6 a9 j( Q1 {- ]7 w
- #include <mach/irqs.h>
; L- ^& `. A4 t. l - #include <asm/hardware/edma.h>$ I% d s; N* g8 q; N
- ( w9 E) L8 {: Z
- #undef EDMA3_DEBUG
; L% u0 c! [0 [/ v* T - /*#define EDMA3_DEBUG*/
! F" G( ]; x9 @, |9 Y2 c - * g B9 U: `9 Q4 N. _% N6 q
- #ifdef EDMA3_DEBUG
5 _: t) B+ x' { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* e: N2 w, r# L- F3 u! R& ~. |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* s" p- _4 H. ]) J+ ^) v6 v
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* j5 T" u' T) U! ^4 ]
- #else
/ Q- d! v6 T# B# \ - #define DMA_PRINTK( x... )
& R3 I( v _! I- ]5 Y! L" Y - #define DMA_FN_IN2 u4 c( i" z2 J
- #define DMA_FN_OUT
& N& \* S6 ?9 b- Y. r2 ` - #endif9 i' Z! f* f! [5 c* r1 k0 g( R- _
- 3 }& l: G# {, J4 i7 Y) f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ n: f+ x( `* s3 V& j - #define STATIC_SHIFT 37 ^6 \! R. L# f" v3 v
- #define TCINTEN_SHIFT 20
* r; w9 b- z4 h- K( V2 f - #define ITCINTEN_SHIFT 21
+ p1 H7 L( P J# T3 r - #define TCCHEN_SHIFT 22
& |4 n, m0 q p( k) I8 o: i& ] - #define ITCCHEN_SHIFT 23
1 `3 h5 h6 U/ L" N: E# o% Z/ w
9 S9 X$ S9 v) K! Y' O) I- static volatile int irqraised1 = 0;% Y# [7 g) z0 B* K+ _; Y3 ^
- static volatile int irqraised2 = 0;& p$ _ C3 q. r$ `! T
- a; E e. Y9 b& n) L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ^) `7 N U# b, J4 A+ M* h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& [9 ^% q0 g* y& s% t/ o! ~7 G" H. x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z/ T3 Q& Z% m, k
2 t# e6 T" p4 s o- dma_addr_t dmaphyssrc1 = 0;
: \( f, Q3 \' n# w* }4 A& r - dma_addr_t dmaphyssrc2 = 0;6 `" F' e8 {1 F2 @* z8 C0 h
- dma_addr_t dmaphysdest1 = 0;
7 O1 q0 g# d; {1 P6 B7 q" Q8 l0 `0 ] - dma_addr_t dmaphysdest2 = 0;0 Y6 k% d q, i2 _* w( j
7 {3 U# s5 @6 I- char *dmabufsrc1 = NULL;
3 _3 k) V4 t! U/ e" C - char *dmabufsrc2 = NULL;- `- G8 @4 A" {% V9 z
- char *dmabufdest1 = NULL;3 e2 `+ `, i6 j; `& O1 ~
- char *dmabufdest2 = NULL;/ n( j& Q, [" ]8 n/ o6 U* r2 M
- 5 t' I$ d! f8 U* K" H0 a
- static int acnt = 512;
! ~7 ~2 L N- Y! U - static int bcnt = 8;
' D1 A4 v3 X4 }8 @. ~! V; N - static int ccnt = 8;2 T7 f, W# v0 J6 ]
- % N4 S: R" ~+ d' {7 f
- module_param(acnt, int, S_IRUGO);
+ s) |) j h0 n# k - module_param(bcnt, int, S_IRUGO);
9 ~9 V5 U1 h7 A( E: ~, r - module_param(ccnt, int, S_IRUGO);
复制代码 6 _- e* b2 r: T. V6 s5 b A
) a' ^, C, ]! Y% G. q4 v* y Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( s& k: L4 ~/ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" V; L1 ?6 m0 ` p: Z8 A* _' q4 e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 I k' P0 }# n y* A& A& ?4 e& b0 Z6 }& t" R
0 J8 Y7 W: e3 b3 k
|
|