|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ `* H/ j8 i+ t
- [code]EDMA sample test application O1 ^* ]4 {4 e0 t, e; r
- /*
& W; }" i/ m0 ]* X2 ~# h - * edma_test.c7 T% @$ x0 ~! A% h* V' H
- *" |+ R+ Z+ k/ t% c
- * brief EDMA3 Test Application
& ]: @9 d/ N5 \7 V - *
) y2 z- ~ S, ~8 t6 k1 x - * This file contains EDMA3 Test code.
, X* ?+ k2 A1 R& _) s/ D - *2 A/ E- p1 t: v6 d$ W" B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* X: M5 P/ x9 z6 i8 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 e" O e: b% A. O9 h0 V5 t$ e: {
- * TO CHANGE.- k- x, P, I( ~
- *
) y& e: U' W9 M' x; A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: ~4 N* r. I9 O3 v - *, F6 i. Y7 I7 t- f/ D; _
- * This program is free software; you can redistribute it and/or$ y1 |- {$ Z- z5 e
- * modify it under the terms of the GNU General Public License as
2 N0 O6 K& B4 x6 P7 i( ~ - * published by the Free Software Foundation version 2.6 n E& G( p- A3 ?$ W5 s8 Z( K
- *
. v: C) Z$ z- \" E- o, B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ V6 i$ c# Y) r$ f& { - * kind, whether express or implied; without even the implied warranty. J5 g( z* c! }- x2 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: ^/ h2 |% r3 _
- * GNU General Public License for more details., `* t0 A) n Y0 v
- */; I1 V# {0 v C- U' H' l" F. [# ?
% T8 ^9 J# e4 A1 u; `5 [6 A- #include <linux/module.h>
, u# w6 C; r3 O, y9 R) f8 ]4 | - #include <linux/init.h>/ q8 p& }4 `1 L+ n3 ~, W: I
- #include <linux/errno.h>
) |) J; u& }7 q) L4 u - #include <linux/types.h>
% g9 ^; i- U& D+ ^ - #include <linux/interrupt.h>
! e. `2 ]' o/ H d; { - #include <asm/io.h>5 C- S3 K) E" |0 t
- #include <linux/moduleparam.h>
5 J! d, ^% M) } - #include <linux/sysctl.h>) ~7 g0 m; Q/ T& i4 p$ P: y
- #include <linux/mm.h>
2 N% M6 T% F+ f- t2 J- w - #include <linux/dma-mapping.h>
5 w) R8 z; M N4 j/ v - $ N8 ] Z% ]+ \' I8 R, G! X( {' J
- #include <mach/memory.h>
% G/ u3 o _/ V% G/ c \ - #include <mach/hardware.h>
, n: c5 e9 o' Z' x/ Q, O - #include <mach/irqs.h>
( |' a- D9 X4 s- [# | - #include <asm/hardware/edma.h>8 F# n1 d8 B4 _3 i: f
. z' `% ?3 j4 P1 i8 K9 V: T7 I, f- #undef EDMA3_DEBUG- h9 h: E( q* Z' ?8 j0 f
- /*#define EDMA3_DEBUG*/ [1 x0 h2 h9 y( X
H2 }5 i5 Q+ E5 E2 A- #ifdef EDMA3_DEBUG) P: W& {! _' l8 m6 ?0 `5 q& p ^
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& Y( U- i( Y. x. T% { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ e9 M3 a' w+ f: ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 ~( l' i! s7 M7 h
- #else
1 z/ _+ n9 o' M- U% g - #define DMA_PRINTK( x... )" |; S$ h$ g( ?9 N; g
- #define DMA_FN_IN
9 C, c* n" Y( e( u0 v7 |8 s) x8 X - #define DMA_FN_OUT
- U% J8 G( s! e) r$ { - #endif3 F" l* Q+ y9 l: E0 z: h$ j& [
/ H8 F2 j9 z8 u% P3 q0 B4 E6 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" N6 y8 ~$ Q5 ^5 n, l
- #define STATIC_SHIFT 3
1 \, T" ? C- {# p - #define TCINTEN_SHIFT 20: a S, v+ `: A
- #define ITCINTEN_SHIFT 219 J' q a9 g9 d9 I- F! Y4 |
- #define TCCHEN_SHIFT 22
) Y, t( A0 q) g% c6 ]9 n8 i1 { - #define ITCCHEN_SHIFT 233 g A q7 m& p' ~" M9 D
# L- q; v6 ?5 I0 b- static volatile int irqraised1 = 0;: c& m1 Q% ~7 i
- static volatile int irqraised2 = 0;* F M7 Y, [, n b
" n/ V& ?4 N; W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 V2 z, x: c, X/ h: ~0 D; ~ K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ a2 J' _! s/ }! N: U+ K, d+ s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! y- @' Q, D" ^, I9 b- Q8 x0 f
- - m. W# k2 ^4 s; q
- dma_addr_t dmaphyssrc1 = 0;
9 \/ ]1 ?4 u/ C" U+ `+ ` - dma_addr_t dmaphyssrc2 = 0;, e: J9 H" i! b Z7 |
- dma_addr_t dmaphysdest1 = 0;7 T( Y/ t! W( x0 c6 R
- dma_addr_t dmaphysdest2 = 0;: \: B7 ^. i3 O. e- T ~: e
- , W, D j0 U+ t% m% f
- char *dmabufsrc1 = NULL;
: B8 Q" a2 Q* M8 X8 t - char *dmabufsrc2 = NULL;: @- c* y) a a9 ^7 X4 t0 T8 R
- char *dmabufdest1 = NULL;0 f, E* V" V3 m/ q. i, O
- char *dmabufdest2 = NULL;" @0 H! t! b' r4 I& k
1 P( K3 o' g8 f0 k; K5 L/ c- static int acnt = 512;
) w, U; ^ y/ S% E& E; T - static int bcnt = 8;1 w; N5 T3 M( i7 Z& S S7 _+ } V% |/ l
- static int ccnt = 8;
% x+ Y+ f4 z& @ o - 4 Y- t/ k _( C) E& |( J% r
- module_param(acnt, int, S_IRUGO);
5 U6 E/ A8 h" H" `3 Q - module_param(bcnt, int, S_IRUGO);
; I, q3 o0 o( |3 L- A: ] - module_param(ccnt, int, S_IRUGO);
复制代码
0 T1 N+ p4 Q& ~# o. ~% T
S" i- \8 F3 P" |$ D/ W, v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- A5 i1 z) N/ |2 s3 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 z5 \$ M+ K8 [" w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 y0 V; u' N' R- M
, q! |- E; [9 q+ Z2 ^& _/ r' J% B/ A* l N+ t& e
|
|