|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ o) M8 \- a4 L; b- [code]EDMA sample test application$ s) J0 Y' \9 c# n
- /*) B" S( @& h& _' b
- * edma_test.c2 H) x& N) v7 _- x
- *" j6 ^# o7 }2 K, ?: d! C
- * brief EDMA3 Test Application# I2 ?4 P" w2 f3 r( F
- *
; K# B: a& c' o8 v - * This file contains EDMA3 Test code.4 B* o5 J v& [( y3 i
- *
5 L3 o9 e# o6 S7 h/ N, b( |; h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# ]7 X8 c8 H5 n" L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 S# j9 z. K$ W( G$ R$ D" O
- * TO CHANGE.
' Q! X0 o E. H! _- c I, x' \ - *
& {. T" H9 q+ e8 H# L7 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" @- k. k; O9 {# b8 }' S0 O - * h+ G- ^; ]# O9 D3 f% n& h
- * This program is free software; you can redistribute it and/or7 g5 O2 u+ w. H! s. z/ ~3 q& D9 u
- * modify it under the terms of the GNU General Public License as
5 \" Z8 x5 D U5 [( e - * published by the Free Software Foundation version 2.
j. N5 r7 R4 l+ S3 r - *" r" F5 l r; n( L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" B7 b5 d4 @ a' \7 f& |" Q
- * kind, whether express or implied; without even the implied warranty
" @. M+ y6 ^2 q" r; ~# F- m* x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ X* p) D- v% u3 W. [, j
- * GNU General Public License for more details.
' d$ }! S9 ?4 _6 E8 _ - */
2 ^5 P% s! }1 k! u- { - 2 R) Z+ I6 ~+ s) @; }
- #include <linux/module.h>2 c0 ~2 ]1 A5 T) @6 R: |3 X$ v' J
- #include <linux/init.h>
6 j; p% I9 k& A - #include <linux/errno.h>6 o: E7 n3 W! s5 n9 i
- #include <linux/types.h>: c. X: k) F! |8 j4 Q% b- t
- #include <linux/interrupt.h>9 n7 c. d5 G6 I! }" s
- #include <asm/io.h>2 n- H* z, j$ T& U
- #include <linux/moduleparam.h>( Z& l9 n& @$ H2 L+ ?# w5 o, }; J
- #include <linux/sysctl.h>
! A% L3 B4 [4 Y6 V - #include <linux/mm.h>
L9 y6 E7 {' G7 J - #include <linux/dma-mapping.h> d K4 O$ ?' I; g/ w% g
* N3 E* B! q. B5 n7 W) b- #include <mach/memory.h>
: u: m: {* r- I9 h M - #include <mach/hardware.h># [9 N' c& C/ Q6 F
- #include <mach/irqs.h> Q5 p+ n0 q) Q/ H
- #include <asm/hardware/edma.h>
# W* P- t b9 C! T" O& @9 r
3 }0 \9 G0 Y/ a8 O. }2 f7 u/ E* z. g- #undef EDMA3_DEBUG
' h9 n1 j2 L) X4 |2 _1 A2 | - /*#define EDMA3_DEBUG*/+ _8 [ q% j# C5 E
- 5 ~& X7 c3 [2 |# Z% q( _! A9 M' ~
- #ifdef EDMA3_DEBUG6 e8 ]" D' } {' l; l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
l0 k1 ?6 D+ c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ^* t4 ?" |- _$ k U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 F5 _ C1 U9 w) a) {5 D
- #else
) n$ t" f3 Z/ \- W2 T - #define DMA_PRINTK( x... )
& @2 D& j9 n+ q7 `! ?1 Y/ K - #define DMA_FN_IN
. p( J) y; c; F' w - #define DMA_FN_OUT
7 m7 M5 b5 F; P" H - #endif& |5 N0 Q# o/ N" U
( @4 z- g/ k5 a7 H; B/ p- b/ r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- e! o' G" j0 D6 {9 s - #define STATIC_SHIFT 3
; a3 Y& N, p* y" y( v - #define TCINTEN_SHIFT 201 K: F3 ^+ [/ y0 L0 @
- #define ITCINTEN_SHIFT 21
& F! x% b3 a8 n7 u - #define TCCHEN_SHIFT 227 N1 m; N6 O; n
- #define ITCCHEN_SHIFT 23
- x& A/ H+ f6 o( y# ]) H - & ]- {1 z3 s5 N4 \
- static volatile int irqraised1 = 0;
& j7 [5 K& e2 v% }/ t - static volatile int irqraised2 = 0;
# ?, O& k5 `2 D. w% P - " z& V1 Q: G# u: X, |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: u% i, o) y5 r+ Z: }& j/ | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; x. z+ m2 f* n" ^% U& f& y1 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; j) _% z& b' h+ V- e - 5 Y2 W9 t) ^! u7 c( C! d! |6 L
- dma_addr_t dmaphyssrc1 = 0;
/ F% y8 }: p* `7 H0 T" w - dma_addr_t dmaphyssrc2 = 0;) ^3 F m1 D+ Q2 u+ \" U
- dma_addr_t dmaphysdest1 = 0;
5 v/ l) g. r/ ~ - dma_addr_t dmaphysdest2 = 0;
+ J# w0 ~, Z! G- M; T& ?
& i4 Z, ^2 f/ \- char *dmabufsrc1 = NULL;( t2 W- ]% n) b" l" f& t
- char *dmabufsrc2 = NULL;
5 l& k! a9 S- p8 q - char *dmabufdest1 = NULL;
# g% _. A8 B! F2 _) _ - char *dmabufdest2 = NULL;6 r& ^5 g P) S
- 8 q- i" r* J& v% W3 ?4 M" A
- static int acnt = 512;
& m* \$ w& b$ O. d - static int bcnt = 8;% K/ n$ j) J% a& S+ ^$ N4 P" L$ [
- static int ccnt = 8;. u6 u7 @3 \: Z' @
- 7 j# V5 b: l7 d1 g
- module_param(acnt, int, S_IRUGO);8 C$ V& O! L, c- n! _( \
- module_param(bcnt, int, S_IRUGO);' o# Z/ x, b/ o+ ]$ y) _
- module_param(ccnt, int, S_IRUGO);
复制代码 * L. K3 W+ M) |0 W# {4 p i( G8 c
' s- w" ^5 v1 l0 \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" O/ Y! \5 }! P" }8 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ o, d3 O7 O i4 c( e3 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 k( w1 P0 a9 e. d2 h7 i7 B
7 V' L& v0 [3 D4 _4 d2 C! m5 E6 ?9 T
|
|