|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 E7 _4 S# D$ i t& U7 Z# Y7 @! S) V
- [code]EDMA sample test application3 b" N) J* V' ~( u0 Q4 F
- /*+ H6 ^7 k) S% `' J: H+ j/ h
- * edma_test.c
3 p. h3 I' N, [8 E: I2 Y - *+ `$ H0 K7 n2 \4 s" p& k1 j# Y' Z& T
- * brief EDMA3 Test Application. J( B, V2 y4 j; }0 I# T! e
- *
; z+ y: G6 Y, H$ d - * This file contains EDMA3 Test code.
" U2 D9 ]0 J$ a# }5 h - *' J5 e+ T2 f2 e- E4 u* b" C, l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& w7 K% ~" ~& t: O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 C6 b2 X" F: E
- * TO CHANGE.
. V- Y9 [' O/ i5 N- I6 M7 i - *! w' @- e* H/ X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 y6 v) ~& i; L/ [
- *
, M/ g0 y' e. j5 i. W- F( K9 U - * This program is free software; you can redistribute it and/or
1 U8 k+ K2 s6 }. a* \. }8 h - * modify it under the terms of the GNU General Public License as
" E- l) g- U# D' | - * published by the Free Software Foundation version 2.
. A9 g# Q2 O' k6 [& f - *$ w% o. S* h5 t2 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; f/ L* j6 W6 A - * kind, whether express or implied; without even the implied warranty) k% a/ p( F% R/ b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! A& N @" e- c - * GNU General Public License for more details.% j8 b, x7 G% B
- */0 L+ C5 e# I, N% J
- - A3 q" |# B; o$ l& Q3 N/ R
- #include <linux/module.h>4 Z" a0 |$ R6 r) r
- #include <linux/init.h>) x8 w" A9 d" x* G; j! {. ]# D4 q
- #include <linux/errno.h>5 I9 W* V2 F$ k
- #include <linux/types.h>
" P9 M4 }9 a9 t3 y' Q - #include <linux/interrupt.h>! z5 v6 z1 L) E* w" U
- #include <asm/io.h>
) Q0 Z$ C; W5 w1 @* y6 \% ] - #include <linux/moduleparam.h>8 D/ }. K; @% Z7 v3 d
- #include <linux/sysctl.h>
# a4 p. N, K4 a% A. s - #include <linux/mm.h>
( K2 E3 }2 ?( b: G9 v - #include <linux/dma-mapping.h>6 O$ {$ ?4 z# O- e* J4 R4 Z+ X# {
- , e( _- ]+ R5 s! K! m
- #include <mach/memory.h>
2 y; m- v, z( ?8 X2 Y - #include <mach/hardware.h>
/ I% C& X" W& f+ I q1 ]3 [6 z - #include <mach/irqs.h>
7 s# P. N8 Z( }, w h; [ - #include <asm/hardware/edma.h> p& u! R( L: g9 o7 g
- 4 ~0 c* }/ M8 k+ y6 z7 l
- #undef EDMA3_DEBUG+ [2 ^( r" \" h0 e$ S
- /*#define EDMA3_DEBUG*/1 K: u6 V5 i/ I+ r( z( A
7 r' x3 h+ R, S- #ifdef EDMA3_DEBUG
B( J3 P4 K4 E8 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# [- i- G) b. I4 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: ^0 ?2 H3 \- y( h6 J- ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ k. _) B) T! v: C/ u& \; F3 k - #else
( {: Y$ B; _ r - #define DMA_PRINTK( x... )# l: {" c" e2 h3 g
- #define DMA_FN_IN
% Q+ }' L* U) P3 A9 _: v; T - #define DMA_FN_OUT' K$ P) p5 I% b3 t! @$ [
- #endif! l4 w: V5 n% B4 [
- - B( M6 [, `' e' d5 v* ?+ B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- u; A6 d3 |3 c# [$ P! H
- #define STATIC_SHIFT 3
4 t: ]6 O5 L5 `9 H - #define TCINTEN_SHIFT 20) U( j- i( I$ F, ~- C0 N
- #define ITCINTEN_SHIFT 21
5 e( S [3 Y' T' C - #define TCCHEN_SHIFT 22
" C, s! b; p5 _3 _' o7 T& D6 x6 Y - #define ITCCHEN_SHIFT 23
) j0 s) O- c+ t, B( b1 N8 S
0 [- a/ k( \9 F3 Y6 j- static volatile int irqraised1 = 0;: g$ I" {) }9 r) `6 Q/ y
- static volatile int irqraised2 = 0;
6 N# o7 k' E- K% E, ^
# W+ i& u4 W5 R, V* S6 C& y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: c" E% P5 q( S7 ^+ [# R: f+ V2 Z. ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 T* a# l6 Y, ~3 ~+ [3 O- o' `$ x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 i3 w$ ~% G3 S6 M% e/ x5 B2 b - 4 R) q" P9 J/ d& _& M0 t
- dma_addr_t dmaphyssrc1 = 0;
/ [0 L6 o( j9 B) V/ y3 }1 N - dma_addr_t dmaphyssrc2 = 0;8 G |& k7 ], r1 Y7 ]
- dma_addr_t dmaphysdest1 = 0;
5 R$ K# d6 {7 x: R; v& y+ X - dma_addr_t dmaphysdest2 = 0;
+ e, @; ^ K/ |7 g/ T: H; Z& o - ) A$ D, S( c' p
- char *dmabufsrc1 = NULL;
, n$ z7 Z/ v" P5 S E3 p - char *dmabufsrc2 = NULL;
: A4 W' B/ y: W- ~ - char *dmabufdest1 = NULL;
4 `# y! @, ~/ J, Q+ o - char *dmabufdest2 = NULL;) F' S+ m1 I+ I- V% i
- 1 w) C0 [% N+ `, k
- static int acnt = 512;7 ]( t% W/ f3 l: J
- static int bcnt = 8;% m. c, m- @. @' M* E* A3 T
- static int ccnt = 8;: z& D9 d1 S9 d7 U
3 @) V; k; y7 V/ ^' V9 }- module_param(acnt, int, S_IRUGO);
L, {5 w6 |1 V- F, s5 g - module_param(bcnt, int, S_IRUGO);
* ^4 c( b! q! M+ [ t - module_param(ccnt, int, S_IRUGO);
复制代码 ; P- @8 S' Z. a+ }: s% v3 _6 K
3 | f* I+ d. ?/ ~0 B3 d1 I
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; I5 l+ K! k' Qarm-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 ` c- E9 K7 g1 q i5 a# F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. r2 K3 v# M! F5 \1 S0 V1 j: t
2 `8 B* f/ I5 Y% V; q3 x3 k" T7 F( r3 O
4 i$ k$ D4 X* J |
|