|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & _6 v2 y' M. A1 K! P4 P- G8 \
- [code]EDMA sample test application5 D0 p4 W" _' c# c
- /*' _2 }& B0 d5 f
- * edma_test.c
- u4 w& C9 x6 s3 f; T - *2 h! z) i) Q, O( k: c
- * brief EDMA3 Test Application Q- f' Q z' a5 ~3 k9 e+ _" j
- *
( v% j' O- _( v- K - * This file contains EDMA3 Test code.
J+ Y! r, {' w: |( [9 y E - *
( x$ y& k/ D/ @& d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 d. v* g: U# ^$ ?; s3 g$ q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 W! e% p! b' b
- * TO CHANGE.7 W: b& [$ @$ X6 q/ d, G- u
- *
& k2 s+ [. l/ {; i8 h% _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& \, |8 v1 D# D4 B0 G" O
- *
% p$ Z: {# u9 I* }* i+ c( V% L - * This program is free software; you can redistribute it and/or
" {4 C2 L3 A: N3 M - * modify it under the terms of the GNU General Public License as S9 l6 ]/ t/ x; [/ Z
- * published by the Free Software Foundation version 2.
2 J3 Z: s- W8 m, X' w - *; ~& C1 q! G+ z9 Q( B) }5 D. J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; g( ^( r" T1 d: Q% p
- * kind, whether express or implied; without even the implied warranty
7 q/ C& {' I8 N2 y* f! l - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- J5 }5 Y( V" g9 W0 l! `2 r
- * GNU General Public License for more details.
/ u% K8 @. F* Y, a - */+ o4 J/ p9 n) h$ j8 v) ~, ~
+ |- ]; V0 P# K( ^ `* w- #include <linux/module.h>
- {" j% @) [4 E( K: A! L5 A0 A - #include <linux/init.h>+ b, V% o: z# V8 w0 \* H4 s% O
- #include <linux/errno.h>
, E* z+ E0 v) J8 W+ ] - #include <linux/types.h>
. a x, h$ O& ~, u6 u/ d" D - #include <linux/interrupt.h>2 a4 ~5 y# v% e
- #include <asm/io.h>
3 y* d" w4 E! m- |* H9 s8 _ - #include <linux/moduleparam.h>1 Y& Q3 A, x$ s. d5 T! J$ s
- #include <linux/sysctl.h>1 V6 p6 y- S* p" l7 w; H; T
- #include <linux/mm.h>3 Q/ R9 _' J1 ?" G- \- n* \$ e
- #include <linux/dma-mapping.h>
) Y. i) ~# p* Z2 G |
7 G' f8 \2 p1 v- #include <mach/memory.h>2 [4 O3 f8 F; v) b
- #include <mach/hardware.h>
% ^3 J0 Q' I+ D' ] b - #include <mach/irqs.h>
: w E- r: g2 F - #include <asm/hardware/edma.h>5 U5 H* m( s! U! R
. m+ l+ E! u, y- #undef EDMA3_DEBUG1 ?0 ~5 J+ p) u# m3 R2 M2 T
- /*#define EDMA3_DEBUG*/
! E4 h2 C+ X7 Q2 f }9 H% V( ^ z
/ p" c6 u! V& p' I3 C- #ifdef EDMA3_DEBUG
8 Y; a9 {* d7 R' H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* N" }1 Q* O" K. G9 f0 P7 e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); P7 U* ?& z: [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 c# U' L1 ~( L! ~8 O$ G - #else, n+ p! M! n4 |& ~
- #define DMA_PRINTK( x... )
1 W \0 s! [) t' m# B/ o0 i2 w/ D6 i - #define DMA_FN_IN
# j. t6 ~) b! ]6 k' @9 L$ b/ X8 Z - #define DMA_FN_OUT% b5 ~9 O0 {" t* g! L
- #endif
% p+ W: A& K6 K - . }/ Z m! v: X0 I4 g+ Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& J3 S, T: r! \/ q - #define STATIC_SHIFT 3; ^: o3 r0 c: ?# U$ r! q" b
- #define TCINTEN_SHIFT 208 C# P" H* n8 n7 k
- #define ITCINTEN_SHIFT 21: e+ d1 f$ ^5 @5 J. i+ Y
- #define TCCHEN_SHIFT 22
4 _/ I! O/ P- ^- B9 m6 x - #define ITCCHEN_SHIFT 23% {" @' z0 b* b% A" J; V
+ U! `" Q' s" o, l& L! r- static volatile int irqraised1 = 0;
) s) a1 R$ ~6 _8 P* N - static volatile int irqraised2 = 0;
& W6 p/ d+ e6 Q* v# i - - p, H! e5 ?- F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. R' d9 l6 I4 \5 `8 _' l+ h. x8 j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 j- ^; P. N; c( c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 C# X( y9 `) U9 K& C% K5 k7 \ - , j4 F7 N' h8 k* R, j Q
- dma_addr_t dmaphyssrc1 = 0;
% ^8 ]+ {! b' w: B9 ]; E y' I/ ` - dma_addr_t dmaphyssrc2 = 0;& T) w+ d0 k% P' u4 Q
- dma_addr_t dmaphysdest1 = 0;
5 { K& }" o7 a5 e* H - dma_addr_t dmaphysdest2 = 0;
0 ~7 I9 F. k# G- B - 6 b2 v$ J/ {% t6 B& K
- char *dmabufsrc1 = NULL;5 h( q, P+ s6 E3 d5 E0 g
- char *dmabufsrc2 = NULL;
0 n7 T8 l& _' Q - char *dmabufdest1 = NULL;
; Z% i1 w3 V g; U$ z9 ~; G - char *dmabufdest2 = NULL;
3 I& s; P7 f1 e. _* n - " j: H) c* t, ]$ K6 d; z; H% {
- static int acnt = 512;
9 r: \6 J8 w& f8 T1 u - static int bcnt = 8;
8 o$ D* |* B1 b- V" T( J3 W4 m: u - static int ccnt = 8;
& m1 h5 i6 w1 q W - 5 V7 X" X2 O5 c: ^, o4 ^' A
- module_param(acnt, int, S_IRUGO);8 z/ f: B! y7 t/ H6 L H
- module_param(bcnt, int, S_IRUGO);
" S) L: n; i6 i: K+ @2 ]1 `" U2 } g - module_param(ccnt, int, S_IRUGO);
复制代码
& S3 G2 e' O$ p- u8 S f4 M: U7 x+ J4 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 y9 K. {3 I$ p; F4 m: _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 P% Q0 J4 Z e$ \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- e6 p- ^# Z+ Q! \4 d
+ E% E0 m7 i- z% x1 T; U
+ }2 \8 {( I- B: n& w4 i& J! k5 Y |
|