|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( O5 {* ^1 M6 S( p% b& S
- [code]EDMA sample test application: `0 G$ Y' h* g% J
- /*
; C+ w" b5 G7 l7 f+ c - * edma_test.c
6 {2 E2 d. ~: z0 W7 I# _7 j" f+ y9 y4 | - *6 w1 Z7 D y1 K
- * brief EDMA3 Test Application
' l' F, [* f: W - *1 W: S# g/ s0 y" P
- * This file contains EDMA3 Test code.
$ X0 ?+ v3 ^( \' F6 { - *
@0 ?( y* @# F9 ^1 O; o: Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 N7 I$ ]/ N* @& @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' d% g+ K) y: e- E# [
- * TO CHANGE. f$ g, ]. e3 A* J
- *( K% T& W- S' S. g2 M5 m2 T: U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' n4 ~: l1 D# m% C
- *) R4 S) Z6 }, H. w) B
- * This program is free software; you can redistribute it and/or
, @ w1 r: c6 K - * modify it under the terms of the GNU General Public License as5 n) Q. [, u. R* w
- * published by the Free Software Foundation version 2.
, [1 V' _* M R, W) ] l1 ~ - *
1 I6 B- l8 P# W8 u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ y9 P3 w% F9 @8 {" t+ X6 f( Z - * kind, whether express or implied; without even the implied warranty- P# W7 ~! [8 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- ~/ {1 y5 P0 i. O& I/ f
- * GNU General Public License for more details.
9 Y9 x4 a. f) V; G - */4 M0 _( U6 y+ g% h7 h' i! c
( }) n; U( O3 R9 e6 y- #include <linux/module.h>
+ P9 D% |7 P* y9 r$ S; h" o, \, j - #include <linux/init.h>
& k% J; G. N+ j9 N - #include <linux/errno.h>
6 T/ W1 e8 |8 x8 p! J9 } - #include <linux/types.h>* G c6 b' A6 W% d
- #include <linux/interrupt.h>
( d- s) `" I9 K3 [2 W* |% `9 | - #include <asm/io.h>6 D8 t$ U' g$ g
- #include <linux/moduleparam.h>
f, W6 u( v1 M1 x! ~% m/ ? - #include <linux/sysctl.h>8 [% w4 ` B- p+ X& W- v- `6 ^
- #include <linux/mm.h>! i4 e I$ {, a- _
- #include <linux/dma-mapping.h>
3 Z' S) M9 G6 s3 ~5 ?, P6 c5 {1 N
" N: G; [2 |' I! j/ g+ q z- #include <mach/memory.h>
7 K! X! l+ g# m7 s - #include <mach/hardware.h>
! T% S/ J$ y: U1 d5 [( @$ ^/ s+ Q - #include <mach/irqs.h>
8 m, I9 f, u8 J* [6 a - #include <asm/hardware/edma.h>9 y4 X4 [$ Q: w
- 8 F+ s: u; z3 v+ v! J3 K0 R
- #undef EDMA3_DEBUG6 @" m8 O, I5 ~! a) b* L
- /*#define EDMA3_DEBUG*/& j' e1 b! ^+ ~
- 3 k/ G2 r! `9 @( P
- #ifdef EDMA3_DEBUG f1 [% ]$ Z8 M8 b" F
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). {$ ?% x/ V3 j: Z9 t- h6 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 E4 F! s; d# B" g3 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& L) u' K$ Q# W, D
- #else
' k1 U8 r0 P! n" D$ ] - #define DMA_PRINTK( x... )( R* y7 T$ w7 i* U& ^( Q
- #define DMA_FN_IN9 c8 l7 L* V# a$ @# `/ x+ R: u
- #define DMA_FN_OUT- a$ w/ X% ?1 W7 F
- #endif( a- M/ Q2 Y% \3 g
- $ D* d! D: W1 m; F" E$ K" D' t1 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 @4 n9 `0 J& `6 Y - #define STATIC_SHIFT 3
6 g, S( w4 i' g/ j8 C& @' a L# [ - #define TCINTEN_SHIFT 20
) h" s; s! y4 `8 m - #define ITCINTEN_SHIFT 21
% Y0 B, p8 F8 z8 j6 T - #define TCCHEN_SHIFT 228 R8 s' ~+ _& m& I+ d% I3 t% q
- #define ITCCHEN_SHIFT 23
9 V# s9 x9 ^, j( ]# q - , W& \+ A' [* |; M: M; C
- static volatile int irqraised1 = 0;6 d$ b" ?/ x; C2 U, q
- static volatile int irqraised2 = 0;7 o: R1 U( V! i5 s
( K% x+ j8 I6 J s0 `4 o% I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: `: j1 A3 j* K7 n; J1 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r ?4 {/ W& n6 d f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 v; C, i6 l) }) ^
6 n, G! s+ ?( b; A) L( P6 _( j! ~- dma_addr_t dmaphyssrc1 = 0;
3 v a* b g( F' X - dma_addr_t dmaphyssrc2 = 0;. K3 T4 i' G6 o0 U+ x }
- dma_addr_t dmaphysdest1 = 0;
@( e+ W) z7 S3 T/ X9 k% O - dma_addr_t dmaphysdest2 = 0;) m- v# l( H9 O0 }! o/ G% i) C
- 7 x- l. _7 k0 L( W& |% [# w$ a
- char *dmabufsrc1 = NULL;+ ]1 c$ x2 W" L8 U. S
- char *dmabufsrc2 = NULL;
: F" p& ?# s* p: [) Z2 U7 z( l* G+ t - char *dmabufdest1 = NULL;
# k/ N+ f4 B( H7 j8 L - char *dmabufdest2 = NULL;1 q# P% O, `" j, R" M( B
; a4 A- a( o- a) l# G# o- static int acnt = 512;- F9 C+ C' M& P$ Y0 U, ^
- static int bcnt = 8;, v/ z+ v# z z& K0 J
- static int ccnt = 8;5 r& }$ J" v8 l+ a+ L; Q
( L2 k! b) \! N; e- module_param(acnt, int, S_IRUGO);8 x" {0 P) U3 I& P* F
- module_param(bcnt, int, S_IRUGO);
/ `: P) `: M" N' P1 p: s% d - module_param(ccnt, int, S_IRUGO);
复制代码
4 ~2 I, Q7 f' M# l% J( M1 {
9 w5 x: {& O: p' |" j9 A5 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& T4 Q0 B0 O; _ p5 E0 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 a* I% |2 n% ?2 C0 E6 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; Y8 r# A) n7 I2 Y1 r4 y' N3 y% G. Z. W- c& G# ?, G
" W2 T( ~4 t. K! }; q" j
|
|