|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; p' J$ H @. l9 j6 J! o- [code]EDMA sample test application
/ F, \8 p8 j: U - /*& b: Y# m8 e" E' [4 ^4 I
- * edma_test.c9 M+ C3 ^+ F G( a
- *; C# }' `1 B+ a# O/ \/ T* d
- * brief EDMA3 Test Application
& n" K& Y: F( W0 p* V ? - *) {$ L' @3 s/ K. w% k
- * This file contains EDMA3 Test code./ M, W7 m+ \; ~# z9 P
- *
# W1 `2 b! g# O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 U# [2 V, f% z4 U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 w) _5 a9 Z7 O; e; Z - * TO CHANGE.
) A) K7 F8 f' ]- l+ x1 x - *- Y6 q) o; V) k1 q3 G) s2 E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) H/ o( r0 G e- O
- *1 |( {- K& N5 W n5 u, `
- * This program is free software; you can redistribute it and/or8 j3 X9 L$ n& H4 G
- * modify it under the terms of the GNU General Public License as9 c2 m' j2 z5 H9 s. h S9 M
- * published by the Free Software Foundation version 2.( D* d: Z: [/ [) J. d0 @
- *
( j' q$ {! \/ B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 q! N! s/ a, E! G - * kind, whether express or implied; without even the implied warranty9 r! P# v/ l9 X! J! H1 u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; Y' i: d' h7 | - * GNU General Public License for more details.+ \' A0 }# t# H* ]
- */
$ ?7 @. k: x0 ]$ x. U
3 J7 ~ R* K5 Z" ^- #include <linux/module.h>0 R( ` I2 l7 T. d Z, ~# U" W
- #include <linux/init.h>
* e C9 A5 J3 Q2 z - #include <linux/errno.h>
3 l: `/ W4 \: d7 f. j% d2 ^ - #include <linux/types.h>- E# o+ t" u! C1 b9 Q- G9 h! b
- #include <linux/interrupt.h>9 m# |0 B6 m/ a+ a6 Z( ^
- #include <asm/io.h>
, [/ ^: V" E) T0 w8 s; ]6 X+ V - #include <linux/moduleparam.h>! M2 K, w; Q5 t& a! C
- #include <linux/sysctl.h>
8 T- F. v, t! F) @ - #include <linux/mm.h>
- `' y' a7 _( G6 i$ K- o - #include <linux/dma-mapping.h>
' }0 b4 G& P$ v, ~7 M - 1 M1 @# _$ N4 s# O& n
- #include <mach/memory.h>8 r3 ^; |' t+ M! l" m+ G
- #include <mach/hardware.h>
* F% X, I0 f, e: b5 w - #include <mach/irqs.h>* o8 K9 A: n, r& G
- #include <asm/hardware/edma.h>) ^, d2 O; J; {+ c9 f
6 @9 m4 y8 q+ D; ?% |- #undef EDMA3_DEBUG/ p' c# p1 k, I+ {( C8 A3 R
- /*#define EDMA3_DEBUG*/
- w( ^& W; z/ v
, j/ k2 ^: C% \9 i- y# E3 R- #ifdef EDMA3_DEBUG+ v G; R3 Q; @& [, F6 E3 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. L: N$ P& j( X- A7 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 R, E: v) [; r9 D: i E5 e7 l; ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* y3 t5 C( S% J2 e - #else8 I8 u" z* [9 y$ F
- #define DMA_PRINTK( x... )( v$ O* b5 K8 q) h' o
- #define DMA_FN_IN% {- Y3 ~* [, d7 J: B% N# Z
- #define DMA_FN_OUT
3 g9 V0 o7 j9 z$ ?! Q! C" ? - #endif
$ q2 h. L" L# m0 `
) Y( f8 j8 y% e3 B! w5 K ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) G' W% D7 x6 a - #define STATIC_SHIFT 3* G5 J! ~7 a, r
- #define TCINTEN_SHIFT 20
5 d) s6 g: ?/ u0 l3 T5 t - #define ITCINTEN_SHIFT 21
* R& R, L) y( {: Y+ u& B5 Y - #define TCCHEN_SHIFT 22
) x" F% q" C' }$ c - #define ITCCHEN_SHIFT 23
& `9 v; U U8 [4 j! q6 E" C0 h! X
! D0 K/ E# O' D) g! d& N' S6 x; ?- static volatile int irqraised1 = 0;; f1 s7 G7 a) ]$ G
- static volatile int irqraised2 = 0;
7 s1 X8 S( A8 w2 a, {7 G
. g( R; I3 D8 A/ y% q3 V% @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( X/ \& {/ _3 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ e. }) s) b2 r* T8 r9 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# t# D9 x$ p1 o k
- 1 s7 T5 Q+ Z6 @( g6 u8 {
- dma_addr_t dmaphyssrc1 = 0;
* s" w8 h8 f% i E$ h - dma_addr_t dmaphyssrc2 = 0;' C t1 r) u$ s; P& o
- dma_addr_t dmaphysdest1 = 0;1 P3 G% X" P! {9 H0 i3 q0 R
- dma_addr_t dmaphysdest2 = 0;
( p E8 r) V6 I" h% T! k. F; l
) y G/ W; J. {- char *dmabufsrc1 = NULL;
9 ~1 f4 A6 [) h$ e - char *dmabufsrc2 = NULL;
5 w* b6 m' U8 c" x! l - char *dmabufdest1 = NULL;
7 t5 l- F" N! M& h - char *dmabufdest2 = NULL;" y: c8 Q. C( ]. d
1 o4 l$ I$ I% b6 G# N! q5 r- static int acnt = 512;7 @9 T b, J, |& m \) ~
- static int bcnt = 8;
; p( v7 l O7 Y" g, P( R8 b/ }# a - static int ccnt = 8;9 ?5 n: V2 Z2 u2 }4 R
2 e6 i" X, U8 A6 e/ [+ G; W- module_param(acnt, int, S_IRUGO);5 P6 u( S# f. d5 v. d+ j4 {' k4 C
- module_param(bcnt, int, S_IRUGO);
0 Z; i: X. V, m& I2 ~ - module_param(ccnt, int, S_IRUGO);
复制代码 0 n x) @9 ?7 O/ ^' _- p0 W2 R
4 C& f: @ c! u. E! C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 L# {/ I; K1 n1 e: V( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. V$ I }8 K6 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 Q1 ]* a: g# N4 A) N M5 B, |4 G& P9 T/ R) J
, T, }+ X- w% L& `* `
|
|