|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* f# l" Y" d! e7 v. ?- [code]EDMA sample test application0 C/ p9 C! {7 i& g
- /*
& D4 F9 n; g; g - * edma_test.c% y8 U6 A C6 U8 I% H
- *2 X n4 v' t* W* k( c! A L
- * brief EDMA3 Test Application
+ r6 O- a8 m, i" z- _/ V- Z5 L5 n - *5 n2 V; H% [" w7 s$ E
- * This file contains EDMA3 Test code.
; H6 U* Y7 m U R. C$ Y7 m - *% B5 o! H" m0 d& M) M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% H9 V, l, N% l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! k$ C$ m8 h( d) ?1 P
- * TO CHANGE.2 S+ d% y+ X' x: W9 R
- *
' v' X' G' I) W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ^' n6 B. S- Q+ o2 M" N1 d
- *
+ S( d- F: k& `3 m3 c - * This program is free software; you can redistribute it and/or# e# E/ l! s2 K: e/ c- {
- * modify it under the terms of the GNU General Public License as/ T0 l$ x" W0 H+ t% ~. n( m
- * published by the Free Software Foundation version 2.3 Y" U3 f; ?( w# G+ L3 S! X' T
- *+ N" a3 z$ v9 C; D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 S4 r, L* ^& O/ k I G - * kind, whether express or implied; without even the implied warranty8 G9 g0 L2 @6 @2 \( w8 X% v1 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 M5 r4 {, g4 F# l - * GNU General Public License for more details.* n d; u8 k! U; g) ^# g
- */
8 Y* B; o- p" C. V; Q9 ~
) s3 U" B, V- I9 s" m2 y! S4 b; x- #include <linux/module.h>
$ a' i0 k/ Q- X# v7 W - #include <linux/init.h>
% C& S7 K ~! I' g- l" Z( b - #include <linux/errno.h>1 |! D- E6 Y( M s I" i1 _8 T8 W
- #include <linux/types.h>$ b( y! G4 e: S$ o# ]& t, s( f
- #include <linux/interrupt.h>7 K6 H8 r8 y3 J/ [" V. X) `
- #include <asm/io.h>
! B( \, A& e- z# ?5 c - #include <linux/moduleparam.h>
: h5 |* v) H7 m0 R7 `8 D - #include <linux/sysctl.h>/ ~2 L7 u9 T* U; ^8 z
- #include <linux/mm.h>: f% z9 z& r I
- #include <linux/dma-mapping.h>
( m! ?4 [7 C" K- k
1 i/ e B% F; W. _7 b' ]- #include <mach/memory.h>7 R/ R M: ]0 t1 }6 {
- #include <mach/hardware.h>
# C$ \$ r. }1 h+ d1 ~( @ - #include <mach/irqs.h>
5 P) f0 J: y4 j. f; T - #include <asm/hardware/edma.h>2 ]2 i/ N) W1 f4 M" {' o4 A
- 1 z$ s; I; B E: x3 S% u$ Y# y9 H2 ?. U
- #undef EDMA3_DEBUG
8 e* f. H3 k: } - /*#define EDMA3_DEBUG*/
# R% ^. M+ n+ S2 m3 C. _9 h/ j
+ c) ?& V' i9 I! \2 }) \. v- #ifdef EDMA3_DEBUG( o: b/ X. H( `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" E! Y% P8 k* U6 a, T& N4 o# [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 {5 j! p) S R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# v6 X' Y3 C+ ` - #else+ K! L( g0 N* C* k
- #define DMA_PRINTK( x... )
2 M1 ~' e1 E3 y, i. }; x - #define DMA_FN_IN q+ R) i. o) y- m& p
- #define DMA_FN_OUT& n& }" \: }' Y
- #endif# h/ S7 v3 Q- b1 d
- 5 F% Z' l2 } j+ c" V7 W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). z3 ]# d; f5 R3 Y+ |
- #define STATIC_SHIFT 3
6 o# r: j4 K7 D - #define TCINTEN_SHIFT 20
/ ~) O: \8 H3 v3 i' S2 v - #define ITCINTEN_SHIFT 218 h8 @& U' X5 ]3 S& C' U5 O
- #define TCCHEN_SHIFT 22# G6 V4 k$ a5 o0 _0 G7 Z
- #define ITCCHEN_SHIFT 23; q) I: K: c& j, Y
; D- k! ~" k& R- static volatile int irqraised1 = 0;
4 }. e% ^& E; f: }! P! M1 [ - static volatile int irqraised2 = 0;6 q, j5 _; e, y4 B/ g
- ) o. E; W& N+ l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 [$ N& Q) o" Z R9 Y* f# A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 M* S/ o( x7 Q: o# m m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: l) P/ B2 s* S
. y' i5 n+ G! ]/ E- dma_addr_t dmaphyssrc1 = 0;
! Q: h1 |* U: q8 t3 a- c: ]& K( X$ A( E' F - dma_addr_t dmaphyssrc2 = 0;; w2 E# g2 |( @5 Q' G5 l1 S( C' L
- dma_addr_t dmaphysdest1 = 0;
0 g0 \/ ]# }- O7 f M - dma_addr_t dmaphysdest2 = 0;
; ?. g% B8 x$ Y3 t+ z - ) L4 f& [6 {3 @: j( L
- char *dmabufsrc1 = NULL;
* C" m. g) ^7 Q# } - char *dmabufsrc2 = NULL;1 k$ Y1 V3 n7 |9 M
- char *dmabufdest1 = NULL;6 T1 B9 H% }" I1 Y' N
- char *dmabufdest2 = NULL;9 ` w8 k. d" E. P3 E
) m0 N/ Y, Z* F- static int acnt = 512;1 b `/ ?, j3 @
- static int bcnt = 8;( o0 Q i; v" P0 L. l
- static int ccnt = 8;
# Q: W3 S4 H; T" b& w7 j( U+ x
' S. u, V1 S" ?8 N- module_param(acnt, int, S_IRUGO);0 e5 U: E2 {# q$ O# x
- module_param(bcnt, int, S_IRUGO);0 ]; i' S. Z ~- l; l
- module_param(ccnt, int, S_IRUGO);
复制代码 1 C- O) `( c F5 l* r( B( Q: X! C( T
2 G. @7 O. W+ Y: o0 M. Z3 k& u3 T5 A- h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! q2 G5 z: N, _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ^+ H7 M8 {! w, \1 u8 x& _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( I1 S3 @8 {, H
* r! x: z, p; z2 n! O; R6 Y6 c/ J! F) Z2 ?
|
|