|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' V. S. {8 n5 ~/ r# m4 k
- [code]EDMA sample test application+ h3 F; E4 M8 e+ I m8 T/ H i! [
- /*1 R0 f4 z0 |& L) p
- * edma_test.c! h% h( P4 N+ u* G
- *
0 y! c4 R* S& I7 n - * brief EDMA3 Test Application
L* V1 c# a1 m0 Q8 U! y5 ? - *1 t$ V* { ~( |- V$ c- Y
- * This file contains EDMA3 Test code.
- Q7 G3 |8 ~: r6 A! j4 S - *
- Q& X& J4 R! X) v( S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- ~, o, \5 e$ s9 k# t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ A4 T3 q, T4 G
- * TO CHANGE.6 z8 ~1 y+ T1 i) A
- *, u- z w# m+ ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ] p3 F( P, k/ q8 W
- *
. ], a' e6 i) b" G9 Q - * This program is free software; you can redistribute it and/or2 L4 C' u% r$ ~% v+ ^5 f9 M# U
- * modify it under the terms of the GNU General Public License as0 w0 Q& ?* n- R0 ]) o6 t3 U* I8 x
- * published by the Free Software Foundation version 2.2 `. |0 u% L# R2 A
- *( V/ p, @/ ]# }) w1 E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& L3 c7 V% K6 \: {5 |" h - * kind, whether express or implied; without even the implied warranty, Q1 h2 k% a/ o3 Q! N! \! Z7 u5 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ Y( ?% W$ |" @- U
- * GNU General Public License for more details.5 f) v+ Z) {2 n3 Z
- */
$ x; y2 L2 ~* A8 F% K4 o) ~ - % U$ E8 c, F+ X1 J% ?6 l
- #include <linux/module.h>! f$ _2 G' J2 g2 t8 C
- #include <linux/init.h>+ Y0 ?# y8 J, C" R% I% D4 L
- #include <linux/errno.h>
9 a% z( D# I6 V/ N. o - #include <linux/types.h>" j" X: f( }, C4 H8 {
- #include <linux/interrupt.h>( |. l5 X$ f2 _1 T1 b( s
- #include <asm/io.h> k+ s, {! @7 |6 Z" ?
- #include <linux/moduleparam.h>) b7 D0 [6 w2 x$ X5 P! P
- #include <linux/sysctl.h>
) g5 _9 }( }" m% L- W - #include <linux/mm.h>
/ H& s4 w# \/ w2 F4 P - #include <linux/dma-mapping.h>4 S% y. \+ w! T; Y0 z& i/ q
- ! w' f7 M6 [9 |, _/ @/ V* G" O
- #include <mach/memory.h>) Q" z5 E( q7 e2 r7 _; z" Y
- #include <mach/hardware.h>2 H) ^) Z/ L3 g+ e
- #include <mach/irqs.h>$ G2 l0 M6 p1 x
- #include <asm/hardware/edma.h>0 f, F' G" k$ K/ Y
- ; b) Q2 F* s- T" U# W8 z
- #undef EDMA3_DEBUG
. K3 } w ~7 u5 k) v1 C - /*#define EDMA3_DEBUG*/
" |2 _* S, H1 n8 e. ]8 Y& j
5 N6 H- }, R0 G8 V! A" o1 j8 o6 i# j/ `- #ifdef EDMA3_DEBUG4 D$ m7 @2 a* K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 ^% E) }) a! o, S, |9 O8 p+ t: u. V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
~% O& X0 N; p0 m" \9 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% l% |6 N+ n0 b6 p% R. a
- #else( {9 s/ D" E: }: k# ?# ^
- #define DMA_PRINTK( x... )( b; U& R. C9 g9 y4 K# ]
- #define DMA_FN_IN
3 z' y# M2 O9 ^ - #define DMA_FN_OUT J9 }+ Y `) C* X
- #endif
% u' e- V* F$ T0 w( Y - 4 F+ f) Z( g `& n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 J4 D- b' S3 b+ N# S/ e) G - #define STATIC_SHIFT 3* Y% L; I: m$ j$ ~0 w/ B" K$ I5 X
- #define TCINTEN_SHIFT 20
4 `1 W: i& z; o, n - #define ITCINTEN_SHIFT 218 u, a9 d5 k. j! P) m5 T4 M4 ^0 g! V
- #define TCCHEN_SHIFT 22
5 _8 a1 g1 e# Z. a9 } - #define ITCCHEN_SHIFT 23+ C/ i6 \% ]4 Q, J
& o9 J, U8 p/ D. R! r% f/ |& S- static volatile int irqraised1 = 0;
8 v" ] N, P" {# k' a( V - static volatile int irqraised2 = 0;
" E0 ]6 J" Q r0 S4 J' f
3 \; a& e' ?! @: A; F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); C9 H; Y8 `1 g6 W0 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 R; q7 y' u6 ^% k& {0 A/ Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& ?# v7 c E: G" g" c
+ o% ~+ k9 C6 Z; M8 D- dma_addr_t dmaphyssrc1 = 0;- X: \3 g( u* s6 \9 z. n
- dma_addr_t dmaphyssrc2 = 0;
( ~0 J A H% f: `& K4 w - dma_addr_t dmaphysdest1 = 0;
9 I9 k' \+ v# O0 W& r0 e0 G - dma_addr_t dmaphysdest2 = 0;
: g! G6 ?, f9 h. V* r2 C - P) b; B7 S- R! V; \' H8 d* `
- char *dmabufsrc1 = NULL;5 S$ D: P' W* f6 ?# Z, Y7 o4 b/ O! |
- char *dmabufsrc2 = NULL;6 v4 t! f5 g; S4 W+ W |0 @
- char *dmabufdest1 = NULL;
' }# B5 C9 q9 C& r - char *dmabufdest2 = NULL;4 R* L! J4 I2 u) ~
[& f$ C& A, l: h* M- static int acnt = 512;
5 T( r3 ?2 Y2 u- @' N - static int bcnt = 8;9 W% [1 T& m( l9 G% v
- static int ccnt = 8;0 G: y1 W' b5 V Y( _9 I
! V% }% H: f# y7 e2 ]- module_param(acnt, int, S_IRUGO);
5 d4 H! @ T1 N- q1 t5 l6 s+ m/ i - module_param(bcnt, int, S_IRUGO); x. a9 r6 X) R4 X( J
- module_param(ccnt, int, S_IRUGO);
复制代码 p* q8 J) j+ I! D1 Q
) a2 q' P _' j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 H& {7 R1 U. T/ @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A( S% X) Z) u# i" I' A9 i6 O9 d. x% A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! F' \: l/ [( I. w% n+ F% b+ O" y; ^$ m! C; [& @/ o" C3 A
& x+ c+ M3 M+ ]9 ]
|
|