|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! X! j( l. \! K8 h( Z# @
- [code]EDMA sample test application9 [+ N, [. g) Y0 W$ p$ K0 i2 n
- /*4 f `/ K1 O6 N/ Q3 c; Z0 h9 q/ e
- * edma_test.c
1 y4 K9 f$ c. E - *0 P; H+ d7 F1 Y) b3 ?$ e
- * brief EDMA3 Test Application
% A: l0 j) @" k. H/ K - *
9 z5 R w- ~/ t - * This file contains EDMA3 Test code. E) h E5 q, n
- *
$ d, |: j/ Y" M# l# N; G5 S, v. k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- \* J/ C: g' `7 V L$ r, k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 C4 \& b$ G" y
- * TO CHANGE.; I& \* s! F/ p8 {
- */ Y' N# c( t+ w+ |8 m) _* g; k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
I ~, x9 Z& s7 v. ]; u" R - *
& G$ k8 F4 l1 @ - * This program is free software; you can redistribute it and/or
1 W1 O( f# I6 a5 t8 {! y* O - * modify it under the terms of the GNU General Public License as
; S/ T* }% [6 V8 J+ K, `3 H - * published by the Free Software Foundation version 2.
$ s0 M& M' A6 U - *
" I L+ H: h5 g* [; \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, T, Z. o% F& Q4 x* t0 l - * kind, whether express or implied; without even the implied warranty
9 W% @4 E5 I5 C* ?% w6 ^! ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 F) k7 N3 z( T9 V
- * GNU General Public License for more details.+ z+ D* E& j% T$ B* D
- */$ I/ R. ]6 O% j2 e
- ; G/ @7 w& U: M
- #include <linux/module.h>
8 l1 n/ c* b4 L2 m - #include <linux/init.h>
! \1 ^7 U5 q A9 P6 u; m - #include <linux/errno.h>
1 Y& J" v# \( | - #include <linux/types.h>
4 L" A8 R/ x% W+ }0 M8 [& o: S( t - #include <linux/interrupt.h>
. J: I4 c w+ a- R6 G - #include <asm/io.h>
$ x- X" j6 L4 w - #include <linux/moduleparam.h>, ]6 e+ Q2 d; [0 t- \8 x. x; t
- #include <linux/sysctl.h>
7 U p; V9 q3 P' G7 N& y3 i - #include <linux/mm.h>
, h! D+ r3 V; ~$ V* f2 { - #include <linux/dma-mapping.h>
! V* L) D( }; E0 w# f, h
. V( N' Q, Y& ?) R2 }4 F- #include <mach/memory.h>
1 }! U4 Z8 c& m0 f8 e* o. @1 }+ [ - #include <mach/hardware.h>
4 `" M5 s" Y+ ]8 k$ R" I: @: b# k - #include <mach/irqs.h>4 S7 ~+ i) x, K% ]- U; b
- #include <asm/hardware/edma.h>+ c1 D! O0 a- @
$ b8 m/ K' d9 d6 w- #undef EDMA3_DEBUG2 |, w: h/ G6 t" E
- /*#define EDMA3_DEBUG*/' E' y2 u _* G0 W) Y
- + e5 g' e' p" {$ V9 t: l6 j
- #ifdef EDMA3_DEBUG
8 L, e6 L( G j L, | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& x D# c' g& v0 q" P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). S" J% f& A" T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 y R! B9 E$ ` |2 e! c0 f7 x# _ - #else# Z, Q5 `5 u# t, [
- #define DMA_PRINTK( x... )$ [- L9 e4 t9 O" R# g; E& W
- #define DMA_FN_IN
: ~% {. m/ k1 I: T - #define DMA_FN_OUT! X; E5 i* Q, T7 {* w# P5 E: T3 O
- #endif8 }- ]6 S N! b" k3 I
- # H3 O( w d; g3 o. h, G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 y- F ~' @1 O. n- [7 L+ J* {$ A
- #define STATIC_SHIFT 3$ v2 C- {- \6 l+ i* w: q* m
- #define TCINTEN_SHIFT 20! H) k# ~6 v: b0 k( Q, j* I
- #define ITCINTEN_SHIFT 21
6 K. s7 ]5 M/ J' S) { - #define TCCHEN_SHIFT 22
, p, |- J# L+ c% r, ~* N/ A) P9 i/ k - #define ITCCHEN_SHIFT 23
+ o9 ~3 m# F t5 L& z8 K
2 l! {/ r* n/ [- static volatile int irqraised1 = 0;. t- L$ V$ q' c3 w" z- i, Q7 j
- static volatile int irqraised2 = 0;$ V. ~( U; L$ q L3 [
- , X5 G: k1 }6 Y% ~/ x+ H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 [5 o) E) b9 [3 X- u5 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ K0 Y6 M0 r3 c8 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# r0 l$ |3 _# N+ k3 z- l - # v9 p; T v, ^% {
- dma_addr_t dmaphyssrc1 = 0;
! G: a* K$ s7 n& U2 w. G5 k! |9 a - dma_addr_t dmaphyssrc2 = 0;$ a) B0 [( l- W Q, [! r
- dma_addr_t dmaphysdest1 = 0;1 `. T( z8 c$ V6 [! g l
- dma_addr_t dmaphysdest2 = 0;
3 m+ P' I0 \/ v% s) U8 g - 6 `6 S; r2 Y9 _9 L
- char *dmabufsrc1 = NULL;
+ t/ R- K6 r# e% u% B- A1 H - char *dmabufsrc2 = NULL;% S, I0 `5 h/ U3 B+ ?
- char *dmabufdest1 = NULL; n7 E& C( v8 o3 P. w$ w
- char *dmabufdest2 = NULL;, u; i+ ]7 Z5 z# I
- - P0 ]8 T& Y. _/ N
- static int acnt = 512; F: P, B1 Q& X% K& O0 w& D
- static int bcnt = 8;5 d9 U+ B! Z% v3 w! x5 k
- static int ccnt = 8;. s* E: E3 S+ x; u& G" B
- 7 d- d2 L B4 y: o
- module_param(acnt, int, S_IRUGO);9 t+ O6 V2 k1 g% Q
- module_param(bcnt, int, S_IRUGO);
, M% A* u6 u6 `& g% t" M+ W - module_param(ccnt, int, S_IRUGO);
复制代码
4 g* ]- U g6 j) B- n t
# E7 W; q# }6 t& l# C5 p; z9 ^6 q" E 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 c7 s4 {3 i2 a' H) F) m; V& i- V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 h& Z: { D7 X0 `4 }9 Z0 v9 s& Y! A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; ^& H- d+ V0 y# d! O9 P! v6 R6 ]. M, v0 X
* E; u- p7 x( L! x5 n- M |
|