|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 \ _2 j' a7 E- X
- [code]EDMA sample test application
/ ~/ z: n4 x0 \" K - /*6 x" v& C6 @! u/ }/ d r- @; m" M2 R
- * edma_test.c+ r" d0 T, s3 C# F. i1 Q
- *7 b2 y( R4 p! m4 L. [% m5 j
- * brief EDMA3 Test Application
+ J& h9 ~; X' Q - *
" P9 ^: [, Y" `% _ - * This file contains EDMA3 Test code., N2 d+ B- {9 V' c
- *
8 G; b" k/ ~# S2 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: H3 v. [8 p0 L1 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 G# e8 W$ k0 T& [4 a$ G/ @# P9 N - * TO CHANGE.
' k5 y% [- [: Y; z/ {7 L6 Z - *
7 k& f9 D, Y9 D6 M" e) f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ P' ^- g- ]# w' v
- *9 l+ e$ l% _/ S9 V2 i+ [1 g& ~7 J8 `5 w" ~
- * This program is free software; you can redistribute it and/or
8 O% H: i- R, P - * modify it under the terms of the GNU General Public License as5 o5 |$ a b ?- _5 b
- * published by the Free Software Foundation version 2.
/ g5 A! [/ u' k9 a3 k - *5 Y0 g7 s/ |4 T% p, t; n3 L8 y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) F; M/ j6 v/ z2 v0 k; }: Z& O/ u - * kind, whether express or implied; without even the implied warranty# h( y( I; V5 v* j+ l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 B7 b6 |# U/ r; W& W8 B$ F a - * GNU General Public License for more details.- p/ Q% S, E4 s; Z! F9 {" w- x
- */, D7 M* Y) ]2 N9 m* U- h! b- M/ h
3 d6 L! X% X( y- X- #include <linux/module.h>$ e+ C6 M) O4 A' Y3 B% V8 S
- #include <linux/init.h>
! g) s, Y/ U1 z. L+ b - #include <linux/errno.h>; M9 x0 f3 \1 \ b7 i" A8 a
- #include <linux/types.h>
+ C: {- M. U `, p w - #include <linux/interrupt.h>. h$ U' ^2 b8 ]$ r: y0 a, J
- #include <asm/io.h>
/ n3 O! E' Y2 _* s1 c" C5 u" j# v* Y9 P - #include <linux/moduleparam.h>
* y! i( W% Y) L5 U1 ~6 M3 a - #include <linux/sysctl.h>: F4 L' e' A0 Y; b0 b& {
- #include <linux/mm.h>& j. R- ^2 v" e4 H
- #include <linux/dma-mapping.h>+ T' C/ }! [: t0 o7 }
5 u1 v" u2 `! D4 Q- #include <mach/memory.h>6 |8 H' o: Y$ m( e
- #include <mach/hardware.h>
! u; Y; R1 j x- f5 S - #include <mach/irqs.h>
* A$ n# A6 ]: Y$ ` - #include <asm/hardware/edma.h>9 F9 `' V" g5 Z
1 _3 W5 C: `' t& C t. I+ V- #undef EDMA3_DEBUG$ w, }1 h; v# \* U! H( a9 @, g
- /*#define EDMA3_DEBUG*/
1 c5 X, k+ D/ }5 l( v( B x
$ X3 i! H) m7 n+ W: A4 \- #ifdef EDMA3_DEBUG
$ x2 ^& r9 e; M, B6 S8 z7 `1 l' p7 Z# ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ?0 F7 a5 Y4 S. |) h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
O& Q4 [ Z1 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- @- W7 G/ a' r U - #else4 F: i9 }5 ]$ `+ e
- #define DMA_PRINTK( x... )
+ Z2 i3 i) G8 G$ }% p; F' k, G - #define DMA_FN_IN
& O) K' U1 I. ?! d: ` - #define DMA_FN_OUT
! {: [" S8 o1 v) t% N - #endif) g$ k- U W, y
- # L9 `1 R# W( p! U) n% z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" D4 S* y( ?! V) E0 L' B3 }% D( k
- #define STATIC_SHIFT 3
' w" ]5 l* o I3 r/ H - #define TCINTEN_SHIFT 20
. Y0 i: {! T8 r - #define ITCINTEN_SHIFT 21$ J1 B( S# a$ a4 E. c
- #define TCCHEN_SHIFT 22
: ~, g3 G" s' i4 A2 K3 b2 c - #define ITCCHEN_SHIFT 23/ T' i1 E6 D5 a/ N# F, P, Z* x* \
6 K# [: B9 R0 F: u- static volatile int irqraised1 = 0;
$ B7 c+ q1 b; q9 m% W7 @! j2 | - static volatile int irqraised2 = 0;
& d" G" K: C; d" R T
7 G0 r) Z2 r1 ?5 Z7 |$ U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 j3 K. I2 _% ]/ T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; G0 U8 v- F k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: _+ B. c5 M* g# K* v- l7 s
. _+ ~5 l) l( h; i- dma_addr_t dmaphyssrc1 = 0;& u6 A' C7 H/ a
- dma_addr_t dmaphyssrc2 = 0;
3 p! w3 o& s6 P - dma_addr_t dmaphysdest1 = 0;
$ h$ k1 o2 Y- a( @$ B% x& z - dma_addr_t dmaphysdest2 = 0;
" ^$ G% a( S: _# n5 ~1 n ?" b
& w" c+ D( a& `2 X( x6 q+ q; |- char *dmabufsrc1 = NULL;' ~, b3 A( D- M' i5 i/ L
- char *dmabufsrc2 = NULL;
, Y g: H- S# M4 G; _ - char *dmabufdest1 = NULL;
9 f; j* ]/ y) R6 c - char *dmabufdest2 = NULL;' Z$ A" Y" {, G7 \/ |+ n; e
6 x/ F- [4 B/ G0 Z" e" O% L- static int acnt = 512;7 ?" d: \+ l& ^( P- {
- static int bcnt = 8; Y7 G5 f" K2 q; h- A- W( N7 u8 `
- static int ccnt = 8;4 z3 h# [0 X/ l% P7 R- h
- % m0 n4 f. n* |, H' o. Z3 N) d2 q
- module_param(acnt, int, S_IRUGO);. M7 Y1 @* [6 _3 E# j7 O
- module_param(bcnt, int, S_IRUGO);
# j. q% C% n* u1 ^+ s' { - module_param(ccnt, int, S_IRUGO);
复制代码 ; M( W0 G9 L p/ n4 _4 h$ a
! @# j/ |6 c0 |; L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' n! \. d2 L* @' n3 L7 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, c) _- u. b! j- C
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, j5 W4 U! `0 d+ k) B
4 N) m1 l: H4 F# Y9 T+ V; l; x' k4 J, L+ M7 r! F! r
|
|