|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( M p9 R% R$ U- [code]EDMA sample test application$ f6 @9 J* H3 q1 Z; M
- /*
" s* [/ W2 ?5 m" H - * edma_test.c
& O! O Y1 r* P5 X% F. p8 d) M" l - *3 N/ y# O0 H2 R
- * brief EDMA3 Test Application$ E( J9 b8 J8 F# Z
- *' c7 W4 k6 ^/ e5 m* v" V2 s
- * This file contains EDMA3 Test code.4 ], Z- B% z7 q) L& j k9 z
- *
, Z& G' r, X; P$ M9 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- }5 E1 ~. h; ~" q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' j" ?" o5 ~2 @/ [% m
- * TO CHANGE." t, s! S% k9 G9 j# K. K- ~" @: f* l
- *, i- b+ f% Q3 L; J% f0 V7 Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- G. `% ^, r; ?& e3 H) D0 v7 G
- *& Z$ b" k* Q6 \
- * This program is free software; you can redistribute it and/or
8 E$ ]9 j9 ?* }1 L# C - * modify it under the terms of the GNU General Public License as
1 t! A& d3 s' k; ^$ Q3 f - * published by the Free Software Foundation version 2.% L4 m) z3 }3 t4 j, @" q# S) P& [; _
- *
0 Y( p: {( C8 _6 j+ f2 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ j$ p" }! _; w2 r0 U. ]- _
- * kind, whether express or implied; without even the implied warranty
7 b# l5 b1 o( y8 b4 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ F4 ^( V6 Y' b% V6 E: h - * GNU General Public License for more details." Y T3 N: f$ [1 X, s7 ^8 Y
- */
6 z+ b6 D: W% b5 \
( e; U7 F* G; @9 F" H1 L. [1 E- #include <linux/module.h>
, ]/ Q+ d! O( P - #include <linux/init.h>$ z. Y I9 u+ ^* G; d
- #include <linux/errno.h>
+ J7 }$ o6 ?# Y* J j( @: V* K - #include <linux/types.h>
% T1 y8 o b6 F5 s, l3 R - #include <linux/interrupt.h> X9 p: ]" M! Q5 W7 r: z2 j
- #include <asm/io.h> N5 T8 w" a# I( X" m* {6 p
- #include <linux/moduleparam.h>& i/ e: D5 `- d' i
- #include <linux/sysctl.h>* }6 x+ o( n. O% v4 P; O. y7 G
- #include <linux/mm.h>6 `$ l8 d# a4 C& t1 g' O& K6 A4 U: \9 ]
- #include <linux/dma-mapping.h>
' X' z* Z" D9 K4 l8 }
7 V: H6 s* _2 c i" q) r/ p8 Y0 T- #include <mach/memory.h>+ E; U( A5 W# r6 J, D& D9 n
- #include <mach/hardware.h>3 L B. H G$ `3 z: I/ c. ?
- #include <mach/irqs.h>
7 Y+ B# a" \8 z" X' w! q7 Q7 H - #include <asm/hardware/edma.h>6 G5 w; M! ]# e3 J7 a8 f# q/ O3 i
- 9 m6 K' W! P( R
- #undef EDMA3_DEBUG
2 E/ Z/ t3 N5 T5 O6 Q/ { - /*#define EDMA3_DEBUG*/0 |: [+ m9 F% X0 O7 ^
. {3 `/ l" B. z! }" n' q" N- #ifdef EDMA3_DEBUG7 T4 j5 F* g/ P& k8 H1 Y/ T- _- r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, u. a- H( _$ H( u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ~( V: M o% E8 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# C+ P/ V/ z1 j9 c; g" b, [ - #else, l- `- p! a+ P
- #define DMA_PRINTK( x... ). }& B# i) K0 g
- #define DMA_FN_IN
. _7 E8 m3 P% l3 m - #define DMA_FN_OUT0 v6 C2 I( e2 Z, T! _) U
- #endif; v1 ^+ E- B9 K( O6 N7 b6 u0 w8 n
- ! X/ d; T% t5 O$ d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% p+ J1 z, A7 e& I - #define STATIC_SHIFT 3
2 L# i( t. w3 t2 a5 `& h% s - #define TCINTEN_SHIFT 20
3 j$ r! j/ Z1 w2 ^, P. _ - #define ITCINTEN_SHIFT 21
2 I r" |# k9 v( j - #define TCCHEN_SHIFT 22
6 E' r" X! _: O. l+ e - #define ITCCHEN_SHIFT 23# H, N) s4 i+ f
9 r" j7 F( B' K( X! f6 C- static volatile int irqraised1 = 0;7 G ^ U7 T/ X; y& i
- static volatile int irqraised2 = 0;8 k- i- b/ j- q$ w- H# A8 F
* N5 R; R& E- D! G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- i z( C1 `& W( y0 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ T7 T+ \3 U1 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: h" \% b# U) ?2 c
" I( r! }- n6 O5 y4 m: d4 ]# e P- dma_addr_t dmaphyssrc1 = 0;
! q* N, Q/ q" H1 O S1 D - dma_addr_t dmaphyssrc2 = 0;% O* V) ^% E- W3 W$ k( m
- dma_addr_t dmaphysdest1 = 0;
4 ~' m8 @, Z5 J2 x - dma_addr_t dmaphysdest2 = 0;7 t% ?* S8 ?% u; i
- |5 ~9 c; n, _: I* X, U5 w6 L- char *dmabufsrc1 = NULL;
3 F: [4 N. N$ ?" W& d# x8 g - char *dmabufsrc2 = NULL;5 n0 D% ?5 B2 ^
- char *dmabufdest1 = NULL;. v8 E. ^: }4 [/ _
- char *dmabufdest2 = NULL;
* ?; S5 m+ y2 h
( G) B; E; b. N$ f- static int acnt = 512;. p$ L2 F" ?6 S6 C
- static int bcnt = 8;
; d6 k* N0 ?5 Y% T4 j/ X - static int ccnt = 8;
2 |- x$ u% u9 K. |( {* N v
' z: a; N. F) l- E1 O- module_param(acnt, int, S_IRUGO);
, ?' \" X7 j* I, V* C6 J - module_param(bcnt, int, S_IRUGO);% J$ O9 a' P3 x7 @( O) I1 G
- module_param(ccnt, int, S_IRUGO);
复制代码
; Y, x h) k6 R/ m# S+ W0 ?9 \( R7 r" `$ @2 V2 w; i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 f; \0 F0 o+ Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, T H1 L l! Z8 r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% C0 B1 [0 O/ A& b' f2 @
$ F& P! v$ F. q9 o J7 i) X
/ C7 u: y% P: Z1 K% m! @9 I |
|