|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * ~& N* a1 N' K/ I( n
- [code]EDMA sample test application
/ A/ Z" y- Q' {2 ?2 a* R - /*1 G g7 P6 _& [! F1 d
- * edma_test.c
! c1 e" A' D. c - ** a2 G0 [1 ]" B* N! B& c
- * brief EDMA3 Test Application
! W9 }! `; a7 y* y - *$ W5 G5 k) T( \/ x
- * This file contains EDMA3 Test code.
. D2 S, r% v) y5 Z% G ~( R$ I% k- J - *( d( [& o. L% K/ I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: B" e) P% m5 E% _& p& F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# _* l4 L3 Z% E) O
- * TO CHANGE.
/ p9 K# _# K; e( j$ L7 t* Z - *5 N6 D5 p( K7 }6 S Y; D8 a' F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; K4 ?) K1 Q5 T l9 \3 k - *6 R. p0 L8 G9 Y4 u$ r
- * This program is free software; you can redistribute it and/or! v* x3 }# ]' }5 f, x
- * modify it under the terms of the GNU General Public License as a/ ~# M: e Z% I
- * published by the Free Software Foundation version 2.
. m# ]: {' x- v$ N. c* @2 f) | - *
2 \( O: ]' [% r4 e6 v# F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any ] B/ X1 M/ l
- * kind, whether express or implied; without even the implied warranty
2 Y) ^$ J. ?: O2 O! H( n5 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: J) D6 ?4 z$ y - * GNU General Public License for more details.
0 U+ C4 _* s' l, N3 Q' E - */: |1 u3 ^; u8 m$ r. Y
- ! p) D3 J; X+ h: P, v
- #include <linux/module.h>
, l$ B- M/ q K: L - #include <linux/init.h>; m* C( f7 {# `+ j! f
- #include <linux/errno.h>1 @- u6 m$ `8 r9 ~
- #include <linux/types.h>
3 }. ~& G# p ^ - #include <linux/interrupt.h>; h) {- L0 C5 `9 Q! v0 z
- #include <asm/io.h>
# z) r ]2 t2 i+ S- P% F - #include <linux/moduleparam.h>9 ] h# g1 u" P0 r4 `
- #include <linux/sysctl.h>% N$ ? W) d2 G" d1 w4 H/ ]5 @6 E
- #include <linux/mm.h>" k! x1 b- m3 H
- #include <linux/dma-mapping.h>7 s, i2 T# [. q0 @4 |
- 8 l' X9 `1 ~: j+ m# m! s/ K
- #include <mach/memory.h>
1 z; c6 G2 i8 L @ - #include <mach/hardware.h>
( H6 `3 d Y. S- w" p$ f+ X - #include <mach/irqs.h>: a1 L1 ?; `5 m3 h+ V* z9 H
- #include <asm/hardware/edma.h>& ^: f- ~2 k9 r& @9 y: I6 v* X
) @; z" j# K2 e5 L) {; T; |- #undef EDMA3_DEBUG7 q$ ?2 P3 A3 m3 e n3 _
- /*#define EDMA3_DEBUG*/
' Z* f0 w a! N: J/ F% g - 4 I# N2 a1 D8 M
- #ifdef EDMA3_DEBUG
1 X, q. L/ I( p# h+ O5 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- z& h6 S+ [# u) H& L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ z, w. ]* i) t/ ^* t* _! J- Y3 \6 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). z9 M ~0 E p( z' F
- #else2 E+ e. y4 Y. [
- #define DMA_PRINTK( x... )
4 G# E3 P2 K' a, L$ ]" [0 @! T/ l4 b - #define DMA_FN_IN
! V ^$ @0 ?. P3 r7 N/ c - #define DMA_FN_OUT
9 N1 S' Y7 ?2 |* ~ - #endif
* f, l$ o W6 F( V8 n) {1 R! M - * j+ Y% _" h& R1 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 B) A* l+ _+ D ?
- #define STATIC_SHIFT 39 D: ~3 }7 q' i/ t" V/ p6 [! X
- #define TCINTEN_SHIFT 206 F/ ~' B6 j0 b
- #define ITCINTEN_SHIFT 21
: m& ~' O* {; p) Q+ q8 B - #define TCCHEN_SHIFT 224 w" B1 D* G' N7 n" a$ C
- #define ITCCHEN_SHIFT 23
/ I0 y: u. i& b* {+ O - ; ^/ U& U0 l+ c p6 L# L
- static volatile int irqraised1 = 0;" `8 y, y; i; @; }+ q) m
- static volatile int irqraised2 = 0;
6 Z' O# k: b- u/ [$ W - ' r7 w H& n( f5 c: z/ F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) Q9 X9 q$ T: o1 R/ {& i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 {! Z: }( P# q. Q3 `7 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 b2 L) E! [9 y+ i
3 K- l" `4 N ?4 `( b- q/ U- dma_addr_t dmaphyssrc1 = 0;
9 Z8 k. F& t1 I" o' g - dma_addr_t dmaphyssrc2 = 0;
* q/ v: b( t" y$ ?( x - dma_addr_t dmaphysdest1 = 0;
7 g5 I% q6 ?- Q# f; b7 {" ? - dma_addr_t dmaphysdest2 = 0;
0 I+ b( n2 A7 [* t7 W- a1 H
) d {, U/ o8 b. n, E9 l) r7 t- char *dmabufsrc1 = NULL;
7 I" C1 Z; r0 _3 I7 R! C" } - char *dmabufsrc2 = NULL;% A& I0 R$ a# W0 B y
- char *dmabufdest1 = NULL;* V; Q' K8 I' X. l( I3 W! `- |8 n6 r% o
- char *dmabufdest2 = NULL;* W7 U5 P/ `, H" f7 E$ V
- ' l9 f- i9 o% d4 v: e! r, J, [4 z
- static int acnt = 512;& b; i1 P* J+ B' {
- static int bcnt = 8;
# |1 ]/ q" f) W& K - static int ccnt = 8;
% \& h ~# L! F( k9 u( S# `% o# m
* }9 u3 u1 n8 [* q- module_param(acnt, int, S_IRUGO);
1 P2 w! G2 {) X2 V - module_param(bcnt, int, S_IRUGO);
/ G* {/ n" d* E1 ^$ n4 r/ s - module_param(ccnt, int, S_IRUGO);
复制代码 - c ? M G1 [- p7 V$ Y
$ A5 h" p' F8 q& G+ a# G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# q1 h5 [& `! ?1 ^" y- B/ s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* ?! x1 B K- a9 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 |' p# M% Q W5 }' o, f" ]
- g% T7 U$ s) w# v6 G5 }7 ^& s3 Q, R: T. ^% p) V) t+ W
|
|