|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Q( Q( H0 Y. [- _) |
- [code]EDMA sample test application3 [& ]* x" J- g, a7 R' h
- /*
[; h2 ?% A5 { H. ? - * edma_test.c
' m Y; O {; `, n$ T( S! u - *" s) I# Z" o& p
- * brief EDMA3 Test Application& z; \5 e: v+ Z9 b; |3 m9 q
- *
0 H- X+ H& A( V; q - * This file contains EDMA3 Test code.0 C6 y+ h: k- P% P( p& J
- *
, s# M* v4 x" V8 \! W3 O4 @6 x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, m& X; [, g. V6 o1 r- c; @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) g0 N8 Z9 d3 e, U: s+ U& R
- * TO CHANGE.
E% P* ?. Z( s" {" N" t - *
, U% n: `; E3 s7 Q/ u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 V" @, o, O% c( [( A - *
- q [4 b( L. P3 @' w1 q - * This program is free software; you can redistribute it and/or
) Q: C+ W# T+ a" W) N: q+ W - * modify it under the terms of the GNU General Public License as
1 Q( q; P* f9 q6 h - * published by the Free Software Foundation version 2.6 C& s- D& ?4 Q' j& P0 w9 q2 b6 ^$ B
- *
( B8 L/ n/ l) x3 e8 H* x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- U8 g) _5 F& C+ Z; J/ E - * kind, whether express or implied; without even the implied warranty/ o- t& L) F" N, \; s- {0 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ P# n: K, ]' v( @7 x% e8 q( F, A - * GNU General Public License for more details.
7 h6 E2 s5 O" }% y% | - */
, L: ?. g {" f' K; l* N& P: a
( B/ Y b0 y7 s1 T7 m- #include <linux/module.h>
6 r7 x( k" e6 d( l) E7 d - #include <linux/init.h>/ V6 q U6 |$ d8 k/ H
- #include <linux/errno.h>9 I! ?( f1 v6 q. c0 N
- #include <linux/types.h>
* R3 e# |! m) o( j0 I - #include <linux/interrupt.h>; k7 {! b! \3 v$ f& a1 S9 W
- #include <asm/io.h>
, a L! E2 \ W- S - #include <linux/moduleparam.h>+ a6 p" \& l! O. `# K6 J* O0 V9 C
- #include <linux/sysctl.h>
9 Y$ F0 |+ w7 p( | - #include <linux/mm.h>& \0 n, {1 q m# N0 R
- #include <linux/dma-mapping.h>
9 d. v: ~# @9 N/ } - 1 `3 T7 l) W) w) N3 d1 T
- #include <mach/memory.h>
, F2 l, v" o- r% R% p' v - #include <mach/hardware.h>
! M8 c7 O# _. P2 c8 m9 F4 y' G - #include <mach/irqs.h>
8 s" |+ {3 S- Z5 m - #include <asm/hardware/edma.h>
& M T0 N! d( ^# a2 v1 ?3 k - ) q$ ?( J3 G5 u# g. g/ E
- #undef EDMA3_DEBUG M0 ?+ j2 v* q. \# R
- /*#define EDMA3_DEBUG*/
: c7 C# x* v- Q, p
1 n- R+ @& d6 `( _. P+ d- #ifdef EDMA3_DEBUG
. X% r' K9 G) G! |4 r, H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# \ Q) c, Q1 I' [( U1 i# I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 L1 l# s/ H0 ]$ G% x* t0 T; o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& u$ M* Z5 J) s! h1 t' L - #else. }: J5 `+ |' W
- #define DMA_PRINTK( x... ). ]2 L$ [% N7 ^1 w, E+ [9 n
- #define DMA_FN_IN
5 e. ` O1 Z! ]0 }6 h$ V - #define DMA_FN_OUT
* c" q3 {3 H. E- z# m - #endif! C- g' d0 S9 Z9 y- Q' K8 f3 K3 z
+ I9 L2 K) }0 Z/ _3 ^: I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 }0 O( }( X+ u - #define STATIC_SHIFT 34 @" q3 [& J3 z B+ H E
- #define TCINTEN_SHIFT 20
8 @3 B+ r% S( b. _7 y' E - #define ITCINTEN_SHIFT 21& y u( g5 M- w4 I
- #define TCCHEN_SHIFT 22. R2 Z5 x2 ` ?+ w+ j# L9 S' V+ R Z2 t
- #define ITCCHEN_SHIFT 23( T$ @7 v8 n N5 e( q+ J
# t1 z/ j" B2 R0 q+ v" N- static volatile int irqraised1 = 0;
& w- s. G! M, e q- m1 ^ - static volatile int irqraised2 = 0;
" u, z* ~$ ^& F/ ?
& \/ m5 {4 ?0 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* A" J) t0 V8 s( T. p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M) j3 {$ k* a; G/ U7 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! m& v3 B: v# l. t4 `2 A) G - 7 Z+ A7 B$ T; S
- dma_addr_t dmaphyssrc1 = 0;
, e- U: V+ U3 T6 A* A, _! ~ - dma_addr_t dmaphyssrc2 = 0;
: J& d- Y/ N2 c3 y - dma_addr_t dmaphysdest1 = 0;
}9 X, C3 p; ]! u- e - dma_addr_t dmaphysdest2 = 0;
9 F% U, _* P; z) [) X - , j6 O& `( c! P5 T* t
- char *dmabufsrc1 = NULL;1 l5 Z2 g4 ?/ ~5 A- D* R
- char *dmabufsrc2 = NULL;! ?! a }" c% w( H n0 @* h
- char *dmabufdest1 = NULL;
% {3 L$ n3 V4 Q2 T! n/ b" l; \ - char *dmabufdest2 = NULL;
8 r3 A. {. s% W! c7 }* W" Q - / q: \! i( L( Z0 e# |. y# `8 \
- static int acnt = 512;2 Y3 ~8 h' i, C: E' @9 a
- static int bcnt = 8;* {$ s1 }* ?. j* @* w& @+ m, V) @
- static int ccnt = 8;7 w. j0 M- Y, o2 |* v
% `- y, k& L% z" }2 L- module_param(acnt, int, S_IRUGO);
4 j3 K+ s1 X0 f7 |# H/ a/ k - module_param(bcnt, int, S_IRUGO); {( c2 Y& u o; L. e+ a
- module_param(ccnt, int, S_IRUGO);
复制代码
8 r. o! F) t# [/ k" \7 N0 C$ l9 |
W/ K- g: i4 u# [) ~5 |; H( r1 T) V0 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {) v: n% i3 L z( [9 ~- C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# I/ b/ I6 H! C& R( b+ a# X3 t; q4 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 L) E9 ], w9 |
$ I }( O3 \3 f; b
6 |2 B8 w; Q/ f/ Y3 Z C/ ` |
|