|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 n& u* q# E$ Q* y
- [code]EDMA sample test application
/ n( I: o a7 G6 O - /*
* i; k( u' L4 q/ {' K - * edma_test.c8 |$ K V, L' o- T6 S
- *
) \* U4 s$ }5 D9 u9 t! M - * brief EDMA3 Test Application
( g4 m) |5 O/ g+ n6 \7 z, K$ g; ^ - *
' |1 ~( Z2 J$ P Y, L: Z6 c9 g - * This file contains EDMA3 Test code.; ^4 O3 _2 B3 ]' V$ i
- *
# t3 Q6 u, a6 G" E0 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' F3 f* s0 }& ]" G4 J I- \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT V% w$ j$ w3 T
- * TO CHANGE.* W3 c7 V; s* o
- *
$ {8 Q$ K4 D2 D - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 z! n* Z+ f1 ^2 B1 ]+ \
- *2 l |# [: F$ N0 x5 ^
- * This program is free software; you can redistribute it and/or6 v# i- j L6 y3 b3 Q4 r
- * modify it under the terms of the GNU General Public License as, A+ I& ?: H6 |* |( e8 C
- * published by the Free Software Foundation version 2.
! ^) m5 k$ R- E" Q" @# n - *3 J3 a6 N, X- W) C, p/ @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 B5 ~+ m/ {" R6 ^. Q! t1 k - * kind, whether express or implied; without even the implied warranty
, u, \& O `( U r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) n1 E) D3 C* M; ~+ X( } - * GNU General Public License for more details.
; d0 Y' f- i* e. w E' i - */" _1 S5 ~. J# Q0 Y5 @+ E
& O( w8 f: a. j" ^- d- #include <linux/module.h>' i0 F, o3 `; Z3 K& |* t" y
- #include <linux/init.h>
: a# _. @4 Y6 t - #include <linux/errno.h>
. X1 d4 q" v0 ?/ A; x - #include <linux/types.h>1 X3 m% C2 b8 n! }9 M$ x! L% R
- #include <linux/interrupt.h>9 ^0 c0 v. N2 t" d; E: Q; q# `
- #include <asm/io.h># A5 g- X/ J0 g6 ]/ Z9 B
- #include <linux/moduleparam.h>
- t9 D8 ]0 Z; T: a/ g# N- R - #include <linux/sysctl.h>3 m/ r- p) u1 g& ~9 H: h* f2 |- K s
- #include <linux/mm.h>% z1 d- t) E: D5 y9 C! a
- #include <linux/dma-mapping.h>
7 i6 m" y, X, w2 c$ i1 R - 8 x$ @5 t; {, e5 {5 K: C
- #include <mach/memory.h>( B0 i5 q3 N0 j0 l! R/ K+ m
- #include <mach/hardware.h>! \& v' L, m1 P2 B
- #include <mach/irqs.h>0 i! K. h, P9 A
- #include <asm/hardware/edma.h>
" Y* Y& ~" L6 G% o - # X) P5 D( C: I+ h8 m
- #undef EDMA3_DEBUG
b6 D$ W, S/ J* }( a - /*#define EDMA3_DEBUG*/
* o6 B. ~4 ~1 V' N) R2 I
7 L" u9 G' }, O1 v- #ifdef EDMA3_DEBUG+ v& B% e' g" J4 `, |7 r! }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ T( ~ W( X& i3 u. S3 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# h& I5 z) h+ a$ ?+ J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ |! o$ _( Z! c! D2 k
- #else
/ G) @- a: N7 {$ L/ { - #define DMA_PRINTK( x... )
* }' W7 b8 n& N; H- h - #define DMA_FN_IN; @& h( x5 q: S# c' [
- #define DMA_FN_OUT
9 D1 V4 P5 X# I% u - #endif
( O! k: W9 y- a. g! w3 f
$ J- ^" j1 Y* R3 K7 n& D' {0 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 N" ^1 j" W n( Y1 I/ T# K
- #define STATIC_SHIFT 3( G/ {8 S( N) p* b8 s1 R
- #define TCINTEN_SHIFT 20* A' a# W2 e- \% H# { f
- #define ITCINTEN_SHIFT 211 `; X, m9 w% P8 q
- #define TCCHEN_SHIFT 22
* m, Q- y# v" u. C B: O3 S5 J0 G - #define ITCCHEN_SHIFT 23
! f1 h4 W: T0 ]. i# R% b
- c/ e5 S8 W7 F& U5 D. I3 r4 v- static volatile int irqraised1 = 0;$ S6 K0 ~- l2 W$ u
- static volatile int irqraised2 = 0;: D5 `; A+ h2 f6 M% o
& J* k- G9 S- E; Z' {- \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& H( H( O% @1 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" w) u" _# w& u! x; m/ \# y) t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F0 z8 w9 @4 e) P1 S( n4 ^
- 4 o/ H6 x, f! ~$ m% c% i8 E' K
- dma_addr_t dmaphyssrc1 = 0;9 t8 d& o6 a8 o8 m0 f |
- dma_addr_t dmaphyssrc2 = 0;: ?6 r) I8 g3 I$ ?+ X: ~
- dma_addr_t dmaphysdest1 = 0;% `) W! A$ ^# p
- dma_addr_t dmaphysdest2 = 0;
3 w9 {4 {7 H( n) C1 R
# c0 I, Y6 t2 s) \( A- char *dmabufsrc1 = NULL;
3 R3 C" _3 f- f) |* D - char *dmabufsrc2 = NULL;; |: k1 ]& ^& r+ I0 M
- char *dmabufdest1 = NULL;+ u# U. k- @ e- I2 z5 e4 H
- char *dmabufdest2 = NULL;5 s3 l9 ?) _7 t
" S$ W& U7 W* r- static int acnt = 512;5 h; W1 q% a5 i+ A( g
- static int bcnt = 8;! I8 A/ Q0 E1 A2 j# O$ \! i% S
- static int ccnt = 8;
* z3 Y) e$ n- q6 o; O - 8 O7 \8 {+ r7 S; j) m
- module_param(acnt, int, S_IRUGO);" ]9 C) l) N4 M {/ M9 J; i
- module_param(bcnt, int, S_IRUGO);- O! u6 _+ B3 k. f3 S
- module_param(ccnt, int, S_IRUGO);
复制代码 ; Z2 T/ g( P0 k& r# b- N* C
8 D* F$ J- g' k, y8 _8 G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* U3 B1 w9 h2 ~8 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ q# C) W' E0 x% c7 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& g; S' L4 j5 G
$ n8 u. \9 J2 L/ }1 d* V1 i
P! H1 P, k$ M. Q* x4 `5 i# g' H8 e |
|