|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 O4 E- [# Q; m
- [code]EDMA sample test application2 b( e! q- E5 J' @
- /** I; W$ J# t3 i4 @
- * edma_test.c. X, y9 [$ _7 v- x
- *5 s' E6 m$ c5 Y6 L' G. A& r
- * brief EDMA3 Test Application7 `" }4 O* L8 ^8 r) Z2 C/ [
- *
, T; a C& G0 l* b! T8 Y) O - * This file contains EDMA3 Test code.
- D" E5 E3 e% V/ A+ A - *
9 h( w& f- ]# y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: L0 q5 v+ l$ f# e- E/ W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 f! f. ?+ s- x - * TO CHANGE.
5 ~: N. @. U$ D9 t9 P2 f2 a, g - *
7 G6 |" c9 n, `8 M( {2 Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! }/ Y) D+ b7 V1 q2 d; G2 ]
- *
) s. ^: A; a" }6 X& L - * This program is free software; you can redistribute it and/or
4 e+ h5 ^, f x& u6 K" W" C% Z - * modify it under the terms of the GNU General Public License as( [4 E" h/ R9 l1 p% K
- * published by the Free Software Foundation version 2.
) A) Z+ K N) {" ` - *
* j$ |$ S! w/ Q5 `) g! J, w1 G3 q* v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: E5 h, e5 T3 o8 E/ f
- * kind, whether express or implied; without even the implied warranty
/ L3 j$ c0 Z5 R6 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' w$ R Z3 v; n+ S8 ]
- * GNU General Public License for more details.
, W: y/ q8 f6 b7 Q& x, s1 O+ B- K4 Q - */
: X+ u" N4 w% B9 P6 |# [
9 o- e# k2 X1 S* F( r5 l9 f" F. [7 X- #include <linux/module.h>0 B% V( z8 ~: I6 ^) C( k
- #include <linux/init.h>) Z1 y( y8 v) E! k: v% a2 W9 \; w' S
- #include <linux/errno.h>3 J* M6 v8 v1 m u
- #include <linux/types.h>! C" m, o [- Q d
- #include <linux/interrupt.h>
9 |& U% D+ S9 |, |0 Z- J - #include <asm/io.h>
% C, a) L, @# T5 e: `/ G p - #include <linux/moduleparam.h>+ E' F9 }! `! W& ?% p
- #include <linux/sysctl.h>1 F) ^3 Z5 h- ?
- #include <linux/mm.h>
: W' S# P6 Q+ I6 N - #include <linux/dma-mapping.h>3 n0 W0 `9 x. L f. n+ G/ b
- 5 G+ ^: o3 Y6 O' m+ f! m; Z/ G
- #include <mach/memory.h>
* w+ P( n, W" v( Q$ c - #include <mach/hardware.h>8 O( I: f, b5 T5 H! u5 \, N
- #include <mach/irqs.h>
! K- W4 A0 l( @+ m1 S - #include <asm/hardware/edma.h>7 ^2 G( m( D2 {3 E7 m
- 6 a3 u2 r. E/ @, b# m( ?2 C9 }
- #undef EDMA3_DEBUG+ r+ w% `6 H: @0 r$ {+ U+ h" F7 _5 B
- /*#define EDMA3_DEBUG*/3 m& p% L" A. X' v
% Z+ O) h, g2 k+ U" Q- #ifdef EDMA3_DEBUG
5 E8 T |4 @3 Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% G# n0 V b* A4 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ H, U. D: }/ l X6 ^( | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- Z, _& d; k4 F2 Y
- #else6 L% v* v$ m3 a2 {% y3 x5 N7 G
- #define DMA_PRINTK( x... )2 o ^/ I7 n* L: c9 p$ Y6 F& @
- #define DMA_FN_IN
4 R; l# P- Z& d6 E! K7 v+ { - #define DMA_FN_OUT
% V# c1 e. f4 d& G$ |; } - #endif
2 D/ o. o) g0 o
) P+ E: P( _( o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ R4 e. u' _- Z3 K3 _/ g
- #define STATIC_SHIFT 3 b3 E, ?7 ]+ S! N# X2 j0 v8 c
- #define TCINTEN_SHIFT 20( C' s* a* `8 R5 I9 y# \3 Q( r# g
- #define ITCINTEN_SHIFT 21
' W; z3 s! L5 [, ?" j. B - #define TCCHEN_SHIFT 22
/ N7 A5 ~& ]# T$ M& B - #define ITCCHEN_SHIFT 23! l- B: E: j) I6 w
4 |- G9 O+ A* H) E. B: @. a$ G- static volatile int irqraised1 = 0;
* k) M3 F2 L' W( l - static volatile int irqraised2 = 0;* H' d# @* h- w/ O
- + j% x8 T/ e9 p; e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ~( h( T5 M6 `7 M! p$ T" I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P1 k2 ]) Y2 Q$ ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ^% k! f8 Z7 m
- ) x5 V' l6 Y6 G S$ K
- dma_addr_t dmaphyssrc1 = 0;! { s/ K- R b/ O/ M; N1 k; r, \
- dma_addr_t dmaphyssrc2 = 0;, [- ?' A1 | d$ i- m. I
- dma_addr_t dmaphysdest1 = 0;' Y1 m/ f3 Q0 D e! o9 q1 {
- dma_addr_t dmaphysdest2 = 0;+ j+ a3 i1 X9 W5 F, `7 J6 T
- 6 ~0 C' ]! |& |6 f9 ]
- char *dmabufsrc1 = NULL;
7 i! O" w( h' m. F$ K8 _2 C - char *dmabufsrc2 = NULL;# L2 @+ a* y4 n" J2 ~$ k3 j2 K
- char *dmabufdest1 = NULL;
) W$ q5 o: O" N S - char *dmabufdest2 = NULL;
5 }! v5 H# U- @. F) R# z7 ~9 m
3 u: i8 u3 [# `& a! @ L- static int acnt = 512;
/ h; }8 a6 P# F) B7 K. S9 ?# g - static int bcnt = 8;
; f# y0 R4 e, R* r1 c( ` - static int ccnt = 8;& Z8 Z% ], K( F
i6 G7 A) l5 f* Y, c" M, I- module_param(acnt, int, S_IRUGO);
1 F7 q1 P! y7 B: T$ } - module_param(bcnt, int, S_IRUGO); M$ m% S u6 K$ H2 x
- module_param(ccnt, int, S_IRUGO);
复制代码
6 u( T. ]3 t+ c9 s7 I
- @3 ?! Z$ g+ I1 B" l$ v" ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ?: k# X( C2 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; r$ S2 ~( x7 H1 s h/ a/ n0 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: e o& L8 h, L6 \
8 h# c2 K3 p2 ?8 x' Z: J
) {0 u6 M: i3 J; H. B+ z3 M
|
|