|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* I9 ^; u7 h8 h( D0 V) I6 _- [code]EDMA sample test application K5 g3 k% `# _; n1 |- V% P" A! `
- /*/ L1 z- P, u/ ~% m
- * edma_test.c6 P5 s1 t: x7 J# Z( h! e' X A' R
- *9 s; H! _8 X8 U* _3 l" _ a+ o
- * brief EDMA3 Test Application
% Q5 ~7 B$ M; q; ]. i3 t - *. a( T" j$ l! I; p) g
- * This file contains EDMA3 Test code./ x: O: d4 P( X( N$ \
- *
, S1 f7 c1 r( F0 N6 P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. o8 {5 J9 W2 x% D5 d {& J8 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 u# ?% L. P9 ]4 J - * TO CHANGE.; {% Z; x0 K9 T: H N! S& Q
- *6 f& K0 `+ ^0 Q, Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 h, V& |/ I3 X1 c
- *( P( t, @% z( c# N8 F( }
- * This program is free software; you can redistribute it and/or
# ]; M. B3 a6 X6 c - * modify it under the terms of the GNU General Public License as
1 k2 V! [! h& z( M8 ]- F; a* j - * published by the Free Software Foundation version 2.
1 s: Q$ d: o2 I - *' F' R5 C% z1 ^$ S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 g+ s1 Q- |6 j - * kind, whether express or implied; without even the implied warranty
$ L! ?4 L0 }4 k# ~1 C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% v/ V ^3 B$ ~/ W8 x! k& f0 Y - * GNU General Public License for more details.
; a0 Q5 ^' K5 u2 y; x - */
% p* G9 I) w1 V7 K
4 z3 z+ B0 i) u' Z- #include <linux/module.h>
) _0 u3 V& h4 |4 ~* P8 k4 G/ ` - #include <linux/init.h>( ~+ X) v- W: a, u7 Y, Q8 f6 {
- #include <linux/errno.h>' d% t1 W- x W1 ?* c- t% ?
- #include <linux/types.h>% R3 h0 H \) A* C: N/ Q
- #include <linux/interrupt.h>" x5 z1 ~! K G% L5 H- Y- f. A: T
- #include <asm/io.h>" t: X4 _# J( X: s0 m8 D
- #include <linux/moduleparam.h>1 f$ A$ a4 ^# q- x. s
- #include <linux/sysctl.h>
# g/ @ i& c) ?+ Y/ ?4 w - #include <linux/mm.h>
% P$ O6 g+ G2 p" }: S) c) ? - #include <linux/dma-mapping.h>
8 X8 W" H; {+ j b5 i" f# \ - / ~, j. k: z. V, U( Y; \
- #include <mach/memory.h>
, }1 ]+ H7 V6 d' [ - #include <mach/hardware.h>
9 g* v1 M' r D8 N% i0 W s - #include <mach/irqs.h>
% \* O0 U/ N. ~# c- L4 h7 v0 Z- z6 ]9 } - #include <asm/hardware/edma.h>
1 c& ~9 l3 T! {+ O; [ u. k - : G' E: d0 d* u' O# L2 r
- #undef EDMA3_DEBUG1 d& q. N5 R# {1 I9 s3 K
- /*#define EDMA3_DEBUG*/' X8 h3 a+ G9 G b% q* D( D
1 G4 r( ^4 r8 R" K/ `2 \% A7 R- #ifdef EDMA3_DEBUG& f' L3 \- i. T: h4 P$ C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' r% a3 ^8 t2 @/ X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! _% F' V' j+ [' x7 [% R7 e6 }! x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ u% \* u0 E! D+ Z
- #else, c' O% w; X- L6 m
- #define DMA_PRINTK( x... )* z1 ^0 R! g+ G+ v
- #define DMA_FN_IN
$ y9 T7 a) X7 ?/ U% i& I1 a- X' L - #define DMA_FN_OUT7 Z: n: ?1 U; U7 ~" ^. ?1 _
- #endif
+ C( r& p, k8 r, J' W; O4 [ - , O! v) a' X2 n/ w8 ]' N/ }1 X1 T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, l5 {5 c$ ^! y" y* X+ ^% C; g) k - #define STATIC_SHIFT 3
6 n6 P0 _, ^ e& p - #define TCINTEN_SHIFT 20& S b2 [1 t: B" n
- #define ITCINTEN_SHIFT 213 B! r$ u1 \1 C8 j
- #define TCCHEN_SHIFT 226 Y$ `% b; Z T+ j1 w. h% |' X% Y
- #define ITCCHEN_SHIFT 23
6 w+ x2 _1 b: `/ A2 D F* w
* J! d, G, [9 _0 t- static volatile int irqraised1 = 0;( ?9 |7 j9 n2 U5 d
- static volatile int irqraised2 = 0;
! |/ N" s; w0 ]% F1 Y+ r' {! e
% ?5 H3 z7 A- ?& T" M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! t8 h: R' b8 w/ C4 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# w1 b' G7 l% P6 F/ g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 r& [0 D0 w9 c8 A3 t; w" C: r* e
. b2 H3 B# [9 c- dma_addr_t dmaphyssrc1 = 0;$ L1 U5 p- }/ V
- dma_addr_t dmaphyssrc2 = 0;# l" V2 ` V0 f1 r. V
- dma_addr_t dmaphysdest1 = 0;
3 n" \1 J8 P9 S, C: @ - dma_addr_t dmaphysdest2 = 0;- _, x+ ]3 L) F# M3 K
. i) T' M+ p4 n" u6 I3 a' D- D- char *dmabufsrc1 = NULL;
* _$ x" p7 u- r" w% k) l5 U - char *dmabufsrc2 = NULL;
9 D+ q B' z' H3 P% m - char *dmabufdest1 = NULL;
$ N0 i5 G8 d9 m0 O- {& u - char *dmabufdest2 = NULL;
3 L$ N x; @7 k - # V8 P x* P* y
- static int acnt = 512;0 a1 m# z' l5 C2 F
- static int bcnt = 8;- W) w1 R$ @( P3 a' Z
- static int ccnt = 8;
" o* G V0 m9 I' t+ ]: k! P4 f1 c
3 Z' b& n+ ]) u5 }4 z5 X- module_param(acnt, int, S_IRUGO);* l; o0 v/ Q4 z, V6 ]
- module_param(bcnt, int, S_IRUGO);
: h8 Q+ r, V' ?9 m+ K& I+ I/ Q - module_param(ccnt, int, S_IRUGO);
复制代码
+ S/ k0 V3 ]" Q. a! Z! a
! B$ }9 ]$ k d" l v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 ` J3 _' f/ B' M4 G' h l/ L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 M. c& M+ X7 v K: y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' ]+ T3 \: j. g# a
6 Q9 W5 g4 ~) Q! X5 ~! N
3 Q* E) m# i a# o2 k$ B |
|