|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 \ {! B( u7 m& \
- [code]EDMA sample test application
7 q1 h& R, ^0 U( x - /*
- U% L8 \/ a1 G a( k- B* Y) e: T7 ? - * edma_test.c
2 N4 s1 g6 l, f) _# v9 t$ E - *4 e {2 X9 P7 i. [/ N+ s2 [% A
- * brief EDMA3 Test Application
8 e6 c: c+ {( n& O6 W - *- t: X) T4 R; e) ~4 Q
- * This file contains EDMA3 Test code.1 P5 t& Q% m1 e( C' N ~* [
- *2 Z3 c a6 w. S4 S( \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: u9 Y5 N. o3 i0 [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 Y# ~/ Y$ K7 P - * TO CHANGE.% m; X4 w2 f% y1 Z* \# H' x h: q
- *
$ t4 q' W' @2 d/ K$ Q* f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ X* Z. z& |8 `; c
- ** l& i( c, h2 S: S) k7 i3 F
- * This program is free software; you can redistribute it and/or2 T, W+ s7 O! I, W2 w1 h( B0 V
- * modify it under the terms of the GNU General Public License as3 D/ @% f% W9 g3 _' t
- * published by the Free Software Foundation version 2./ P$ t8 P7 k, c: f
- *0 y$ O0 g m ~4 r( Y! Z* n/ x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& p4 @8 o9 e0 E( T# t# j" q" ~
- * kind, whether express or implied; without even the implied warranty' _- n( g4 l7 C( T% D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) v. L0 r; A% P4 @
- * GNU General Public License for more details.8 L* \5 h3 j$ O; U F
- */6 L# r8 X1 ?5 V" A, R
- . b. |6 P% Z5 h5 y
- #include <linux/module.h>0 O& p. n& R. n% G8 X5 [& E
- #include <linux/init.h>
8 D+ L1 T7 {8 B4 |2 c o h - #include <linux/errno.h>: c3 N4 j n+ v0 V% k) P
- #include <linux/types.h>3 v( s! j/ |9 H- u+ G- F/ p
- #include <linux/interrupt.h>2 A3 K _( x7 u) I" p' K
- #include <asm/io.h>
1 C' k5 ~* Q) j& J" s* @6 H$ ]1 z% H - #include <linux/moduleparam.h>7 q" o9 O3 e; G7 A
- #include <linux/sysctl.h>
7 h0 a% I" a$ H# c$ J, z3 G6 ]5 t5 N - #include <linux/mm.h>
9 P8 k$ `" Y3 p' Q - #include <linux/dma-mapping.h>5 J: t7 _0 R) c$ \* Q( k
- / S3 _$ W, h5 v3 L0 G) e6 r
- #include <mach/memory.h>
( O6 Z4 ]) Y5 _0 X8 i - #include <mach/hardware.h>% s# G, ]2 ~7 n
- #include <mach/irqs.h>/ Q9 O) {6 {9 v. Q
- #include <asm/hardware/edma.h>
5 |& z p$ T- ]( I- O1 n ]9 C
9 ]0 R' j3 C9 ~- #undef EDMA3_DEBUG2 c2 V6 b* d8 n* {8 D$ y
- /*#define EDMA3_DEBUG*/ L' U7 \8 J* U& z
. k& S' ~3 X. d* M$ B8 X* J- #ifdef EDMA3_DEBUG
% [. R6 Y2 h# q6 T# Z3 g; m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% g5 R$ }9 o* ?4 q" [9 A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 _+ S* ^. F2 a7 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' j6 t, w5 j% ^/ Y- a
- #else- P8 c( P+ k8 M1 z8 M. |
- #define DMA_PRINTK( x... ): `$ N' `4 y( z. l* M- s+ L
- #define DMA_FN_IN
$ m. w. {: F3 M+ s* e - #define DMA_FN_OUT
- G+ ]5 p, D# M; U! R( V6 U! c* @+ @ - #endif# g- f* a+ G; n }% {$ b3 L3 q7 B4 F
6 i& x/ T' b! L8 G* _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' C# t: }/ Q2 ~; b/ Y
- #define STATIC_SHIFT 3& }! t% d5 |4 }: Q; K
- #define TCINTEN_SHIFT 20
# _: v- K) x& P- T1 ~& B6 J& l - #define ITCINTEN_SHIFT 21: F, w; _3 A d1 C1 Z
- #define TCCHEN_SHIFT 22 z, u/ |# Y. d u( d9 `6 m0 Q
- #define ITCCHEN_SHIFT 23
. e: k- ~5 `1 Y" n8 ~ - 0 l1 d8 s, j9 s& z) ^
- static volatile int irqraised1 = 0;
7 t: L" `( f" [' ^ - static volatile int irqraised2 = 0;
+ U. u8 i( @5 o( P) P6 U
, {( P/ a& k$ J) ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* _& Y) J: |3 M& s* P( l8 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 F9 L* F, g) m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l. O; K' s1 @# U
0 l/ Q v* \: U. G* L& H; J- dma_addr_t dmaphyssrc1 = 0;5 G, I$ ^# S0 f* t) e, h6 ?
- dma_addr_t dmaphyssrc2 = 0;
: v: v: u0 I8 V; R4 B8 a8 P9 c - dma_addr_t dmaphysdest1 = 0;" n3 E- f9 w- ^; d2 G: v W
- dma_addr_t dmaphysdest2 = 0;
& n" z& o; o2 E2 t6 ^9 V- E - 3 s6 T' J* _% i' B- }( i( A# h
- char *dmabufsrc1 = NULL;* d! ?5 K r* \ W7 @
- char *dmabufsrc2 = NULL;+ }9 l2 l. x+ j( P9 d
- char *dmabufdest1 = NULL;
! C8 S' g, Y. t2 r6 x - char *dmabufdest2 = NULL;
) ~' o2 G7 y8 b2 g - 1 u) k4 I' n# M+ k1 _
- static int acnt = 512;
^$ i3 G$ l* Y - static int bcnt = 8;
4 r) o, w) o! @ M3 ~0 l+ } - static int ccnt = 8;
3 B8 R, M. d0 y
; a+ W$ p5 s6 a; x- module_param(acnt, int, S_IRUGO);$ Q* i: {# Q4 V1 O
- module_param(bcnt, int, S_IRUGO);
3 T* O7 z# V9 h4 H - module_param(ccnt, int, S_IRUGO);
复制代码 - z2 K9 X8 G; W$ T1 Y
/ W6 A7 s# ]. T' s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' q- f" n6 |/ t B+ Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& t) ^( r' K9 _1 Y9 Q# \, L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Y5 i& m- w- j
1 r7 r7 O) g" F4 z5 T$ E; |# t$ W; Y- {. C# A, J
|
|