|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( B: e( G5 b; i1 N5 N0 f+ C& `; p- [code]EDMA sample test application
; l4 f, S& H0 ?4 v) ~7 A& H - /*
# R9 G. \4 {% ]* T0 ?1 e! O# E - * edma_test.c
. H9 v+ W8 R. u1 _/ l% s - *& L2 X- U/ D( H: A* @$ y! T3 ^" e
- * brief EDMA3 Test Application
$ Q# s$ b- \4 y& A - *
2 K$ a, f% W& o6 [ - * This file contains EDMA3 Test code." K2 Y: d+ P3 O& _$ m2 H2 s# T
- *
2 d/ L0 W( J. N! n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 f6 `- O i L3 a/ M, B1 y& D4 _; s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 {4 C! _0 V* _- b( i( l+ G$ E
- * TO CHANGE. |! W+ Y/ x* {/ p4 b0 |
- ** r# x9 N) l$ i- k+ P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- F3 @+ X8 a9 F$ `( }' M+ P8 V
- *6 R) q0 ]+ Z T, [8 m
- * This program is free software; you can redistribute it and/or; W, R! T& P" m+ Y# c6 W* W2 L* H
- * modify it under the terms of the GNU General Public License as9 ~& ?2 Z p M
- * published by the Free Software Foundation version 2.
1 ~% l. [% F( [" k$ G$ V. o - *
5 Z: a$ Q# S" J8 x0 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 f. a: h$ S" L, o: v
- * kind, whether express or implied; without even the implied warranty( g" A' |& E3 x5 T% B+ F* T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ B; D# w' |! c
- * GNU General Public License for more details.) G9 a( a3 u2 T: ^3 m$ P( q
- */3 _ |8 w% I& n* R/ y9 L* p2 y6 L
- * F# w9 i* p( R
- #include <linux/module.h>0 X0 j: C) e5 b8 e
- #include <linux/init.h>
V+ ?0 j$ T2 Q J' u0 A - #include <linux/errno.h>6 X9 n7 R" d: i* f) T
- #include <linux/types.h>
' |7 P" ~; t4 P* y - #include <linux/interrupt.h>( r/ g$ s" G& v0 p
- #include <asm/io.h>
# V6 `% h7 ~0 E7 g* z - #include <linux/moduleparam.h>
8 _7 E# b, n* ~ F' K; R; [: n - #include <linux/sysctl.h>! Z8 E2 J* J! I6 g/ I
- #include <linux/mm.h>
* h) K: e- u( H2 o0 v" c - #include <linux/dma-mapping.h>
) k8 E1 j( }! H0 z! a z% V- `
8 _, w& S: r/ w5 d: j# E- Q" _/ `- #include <mach/memory.h>
7 q- y- v1 x1 @# A2 O - #include <mach/hardware.h>
) T5 B; y3 D' R/ Y5 z - #include <mach/irqs.h>
+ P, g. E4 d4 U8 w: D% q+ e - #include <asm/hardware/edma.h>
* D+ {% i% R) T# X& `7 s+ K' N
. @( l1 i1 R/ |# s- #undef EDMA3_DEBUG4 e8 ]9 q& L2 a2 w
- /*#define EDMA3_DEBUG*/( m( a% E$ b+ A! y
- X' ~: f- v U; j
- #ifdef EDMA3_DEBUG V a$ i. f& J' W" b( t* k+ {) d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ `/ E& Q. k1 @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ e) ] Z3 o& O/ T9 U" J( ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 _. K* t- G3 [1 o% Q4 h$ r6 x - #else
$ p$ i8 }& {" R, |/ q. y( f - #define DMA_PRINTK( x... )1 P* |* G+ @3 i
- #define DMA_FN_IN; o2 D/ |' o: }- I6 g/ C4 g4 q
- #define DMA_FN_OUT
# A4 [4 T( Q+ o1 z- t4 Z3 }$ s - #endif
$ i0 E: D- U T& v/ p - ' s/ [4 U- ^2 o
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% {; M: z: ?2 h x) g; w
- #define STATIC_SHIFT 3, `, g; g0 Z( d
- #define TCINTEN_SHIFT 20
+ g; j" S5 T0 N: Z - #define ITCINTEN_SHIFT 21
( i2 ]3 u# A% @+ G - #define TCCHEN_SHIFT 224 t* n( H2 p. r- S
- #define ITCCHEN_SHIFT 23
( u3 T4 h2 C7 T - 3 ?$ w ?) U0 V7 h; b4 [) S
- static volatile int irqraised1 = 0;
! J Z0 ]2 l" u, g E - static volatile int irqraised2 = 0;
% X$ x5 C* m7 T" S - ; q# Q; S( b! l& A' p& _. `1 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 k! V! @" y o% Y4 S( Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 }# W( }- E7 n& D& { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. J7 w* k2 U; H1 X! ?
+ H9 u+ Y) a3 x. k8 Q B- dma_addr_t dmaphyssrc1 = 0;
4 W* _% Q/ H3 @# ~# j" N6 I - dma_addr_t dmaphyssrc2 = 0;" i/ p# d5 W. n* T
- dma_addr_t dmaphysdest1 = 0;
6 U3 b0 S- E: N0 y, U - dma_addr_t dmaphysdest2 = 0;
! q+ N# c7 J. k, O9 z& ]
7 ~+ Z$ s( w& _2 v. C- char *dmabufsrc1 = NULL;# \' k7 ?5 C1 H, e L4 W; p
- char *dmabufsrc2 = NULL;! f& a. H# ?) L# z+ ^# F9 M5 q; o3 }
- char *dmabufdest1 = NULL;
: P$ ?1 x! u8 e$ T# }. m - char *dmabufdest2 = NULL;
! Q# C+ ~- F- ]* l7 P - # r1 P+ B% o" d$ b! j
- static int acnt = 512;$ r$ b4 a$ A% c6 |
- static int bcnt = 8;
2 L; z q/ b, @% @ - static int ccnt = 8;! |' o" B$ j, X* V/ ~% X
" a; c4 P9 M6 ^: V: L4 A! }- module_param(acnt, int, S_IRUGO);
0 S Q8 c* f ~' B, T( X" W* N: \ - module_param(bcnt, int, S_IRUGO);
2 Z' T, u: L/ A0 h" h j: j - module_param(ccnt, int, S_IRUGO);
复制代码 % ?* Z. |5 h" J
+ R* l, @. m$ W8 `* }3 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 S3 @/ A! A3 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
F+ ?+ p& r+ ~: R2 I8 ^9 O7 x; h. r& Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& [# N- a4 { U; Y I
\% U8 R- t8 m! x. c( C$ v4 q8 _( ]8 b* r
|
|