|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: y+ [6 K! S0 F$ g& O/ \# Q- X( A \- [code]EDMA sample test application
% z' ^1 i7 N1 Q* T" @6 C - /*6 Y u- I- X0 x: E
- * edma_test.c
4 H6 ]" I" w9 Y8 P" q - *3 E( B- R6 s- l8 Z7 [+ E
- * brief EDMA3 Test Application D8 N( e2 _2 {4 x9 V- K0 k" c
- *. [. w/ }& W- u4 |7 D1 i
- * This file contains EDMA3 Test code.
4 P0 c( W$ B) A9 r1 S8 S - *
( F% O0 f6 b* g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 [" |1 [% _. R6 q. V+ d, n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) f' \1 i) s3 f$ Q2 ]( g4 [ - * TO CHANGE.1 Q4 b& l* b# D1 _6 q ~2 \
- *
4 o2 [$ f' Y7 ?" P3 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 G/ w2 l( m1 I5 P S- B - *5 W" X u R* c3 _) D6 \
- * This program is free software; you can redistribute it and/or. K, u4 J- W7 f; I8 n' P7 E
- * modify it under the terms of the GNU General Public License as
5 o! B9 ]* D+ M - * published by the Free Software Foundation version 2.
; f# W; O4 g- ^1 B - *
( s' I4 o4 }9 L0 J! C - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% H7 `% n0 ^# |. _ - * kind, whether express or implied; without even the implied warranty, Y" X7 Q6 f0 N# c8 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 _* K8 T- @& h4 e& C1 D6 S - * GNU General Public License for more details.
4 W9 @( v$ g% Z! r" a! t" C" [ - */
- ]: \; [& t4 H! B+ p% V4 h4 X
6 O/ j8 B. _: C+ u U- #include <linux/module.h>3 \, I/ ^7 p5 e+ W4 b; m- F9 X
- #include <linux/init.h>
% T: J+ c3 \7 R5 z5 _; P1 V - #include <linux/errno.h>5 M! i6 k- P: N1 z
- #include <linux/types.h>! J# w* X7 B u+ o9 ~% q$ i
- #include <linux/interrupt.h>
' Z8 A$ ?: ^5 n0 L - #include <asm/io.h>
" g' U# o/ w: J; [ - #include <linux/moduleparam.h>
0 `; t7 d h1 F; o/ R# Y( j6 A - #include <linux/sysctl.h>2 U: |# [3 T5 e- f4 o
- #include <linux/mm.h>7 s! d' s, }8 W9 c* c( C" @
- #include <linux/dma-mapping.h>! D/ n" k6 A s0 Q
- # v0 d0 ?0 T" d: j2 f
- #include <mach/memory.h>5 D: p: P- b8 b* b
- #include <mach/hardware.h>! e# X$ K! A m$ l" q- B! F( n
- #include <mach/irqs.h>
1 S; s8 v7 p7 c- k3 ?7 o - #include <asm/hardware/edma.h>
" w. |" `5 |9 X$ r: I
9 U, W. ?* E6 Z ~- T* L- #undef EDMA3_DEBUG
/ c' m3 c) G) q, y - /*#define EDMA3_DEBUG*/
# N( E" p H7 x9 M3 {
0 I& L i, A! [& I- #ifdef EDMA3_DEBUG- K, J# x4 |3 U+ I' ^6 }3 I& Y2 I4 }; @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* v& } u* H' m3 r. I! [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
e# b$ \& A% g. X7 u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& ~/ J1 y" [, B
- #else
7 A4 h+ Y5 V! V% r" l6 B - #define DMA_PRINTK( x... )
`8 z/ O7 ~* L' v5 d" o& o - #define DMA_FN_IN
8 G4 k$ t2 _, v9 w0 R - #define DMA_FN_OUT
9 @" T( f l a - #endif
! t/ J( ~# V- b5 ` - + q( V8 ?8 r4 A% e# y- _5 A) m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 @ R. X# p; R4 Y; n0 V7 E
- #define STATIC_SHIFT 33 A3 Q' L; p. ]3 w$ K
- #define TCINTEN_SHIFT 20
1 H$ @7 Q5 ^' d7 Y - #define ITCINTEN_SHIFT 21
* B% j" j" X8 E3 o- J3 t6 u - #define TCCHEN_SHIFT 22' T7 D: K. H; o U# J) U9 [' q
- #define ITCCHEN_SHIFT 23# l' ]6 R8 m3 t/ u2 w
- 8 ~6 p, J( B N+ Q8 }
- static volatile int irqraised1 = 0; L4 s( V6 t& N$ m+ J( o/ @, l- j
- static volatile int irqraised2 = 0;3 D! K5 U9 v8 ?/ w* R( ]! M \
- * @# x' Y; Q% F+ O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 K" a8 S, D' p/ t E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' d5 w4 ^9 O1 f& H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- v7 {6 }0 l& O, E% E |3 S
- 6 ]* g2 G6 r2 P7 E9 `: q4 g
- dma_addr_t dmaphyssrc1 = 0;
/ b1 U0 r+ G( {7 v+ i; u0 W - dma_addr_t dmaphyssrc2 = 0;2 E; y! j# c4 q& u
- dma_addr_t dmaphysdest1 = 0;
- X, f! k; K9 h+ H6 G - dma_addr_t dmaphysdest2 = 0;4 G0 F% p+ ~; q& ^: R* q
- 7 b$ ~. \6 @* g- p, y# b2 M7 i; |
- char *dmabufsrc1 = NULL;. K, P' @1 N$ V5 p9 X5 D# i
- char *dmabufsrc2 = NULL;
$ d% r* i9 v% c7 o" k1 V+ R& Y - char *dmabufdest1 = NULL;
' S3 l2 A+ E: M5 T% I - char *dmabufdest2 = NULL;$ @ [$ s2 B& _# j5 J
4 f: [( U+ j* V" p; S/ G o- static int acnt = 512;
3 k" A) J3 Y6 p2 S0 S) D) B# E0 C - static int bcnt = 8;
7 I1 w8 e+ a" Z% Z* Z - static int ccnt = 8;' h, q$ `0 M* n& y- G9 T1 B z- R
- 1 O% E( h( ^- G. z8 Z" L
- module_param(acnt, int, S_IRUGO);- r+ M; K0 M* _
- module_param(bcnt, int, S_IRUGO);
! O- c9 H" n; c - module_param(ccnt, int, S_IRUGO);
复制代码 ) m- C+ j; a+ O O
% d" |5 w) I' \
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 N; A/ m# K. L9 ]* Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) B# ^3 A) k& e7 ]9 f1 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ Y9 s; x. E* u4 y: c" e+ }) N5 [% P0 H' T5 \2 [; l$ o! Q8 J& A: O
3 y3 O/ y/ m$ N0 q
|
|