|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & ?+ _5 A6 }/ ^5 ]& ~; e
- [code]EDMA sample test application
# }1 d) j0 J- q* O$ v - /*
$ Y6 e% q% K1 Z; V - * edma_test.c
% p+ {, U1 O; y( E - *
5 J. [7 Q" W' y1 ~* v& F+ V - * brief EDMA3 Test Application' l% T" \7 T7 D- J6 A, e
- *2 m% g! h- u" j5 D" b' _9 W9 z
- * This file contains EDMA3 Test code.
" \. G4 z; d$ k( u* R( J - *
/ Q+ L4 y v- y/ N9 D+ u$ @! R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE g3 l' o3 B( r' u4 v" I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 ~ j" f& w# j( ]4 m - * TO CHANGE.6 w$ T1 M& r$ ^5 a
- *! R% S& F3 ?, U1 J" G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; Z$ ^2 c' }! m6 b' T
- *" [+ ?. z/ u& l. ?( W! r( t
- * This program is free software; you can redistribute it and/or
* j% V5 x `3 t5 M* N3 u - * modify it under the terms of the GNU General Public License as- G7 I- R- ~4 l8 G8 J' I
- * published by the Free Software Foundation version 2.
! w' \& X [% w. g - *
9 N0 J1 u4 G7 T, T- [) R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- l* t. x. \* O" \6 y# e6 ~+ ?) m
- * kind, whether express or implied; without even the implied warranty
$ j, ?4 W; f+ }9 m v' i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, V) S7 B% ?5 G
- * GNU General Public License for more details.1 x" v- E* A8 f5 x2 U; L
- */
+ z: C! x% p5 _5 t+ l
}8 X* S& Q V1 C/ C; S7 X* B9 x- #include <linux/module.h>
6 V. s; ^! Y. i2 d& q2 w) g - #include <linux/init.h>
) p" ?- l6 ]; |1 n3 B5 K - #include <linux/errno.h>
' s( w) m- Y9 T, o - #include <linux/types.h>/ B3 s- O1 f( O7 G
- #include <linux/interrupt.h>
8 F i2 ^$ ^$ R8 }/ R - #include <asm/io.h>2 W8 M# c' [: w' U
- #include <linux/moduleparam.h>6 w& H* f4 ~' A% |* B! e
- #include <linux/sysctl.h>
3 `7 i+ y: i6 c! w& A5 ]/ p; A - #include <linux/mm.h>/ N, r4 M) l3 `- Q4 B, R! |' ~
- #include <linux/dma-mapping.h>
4 Y, n% A6 [! X* P- h$ ^9 T - 0 `$ {+ _7 w6 `0 |" a
- #include <mach/memory.h>
% U% f& I! i. G# T - #include <mach/hardware.h>0 X5 R- W; w1 Z
- #include <mach/irqs.h>9 D" N+ _( _$ J$ v5 V* e& b. y- W
- #include <asm/hardware/edma.h> V4 X: [* f0 E8 D. t: s2 z
- / Y1 F, {4 E8 z
- #undef EDMA3_DEBUG
+ f2 o, B& K! r! v3 i - /*#define EDMA3_DEBUG*/; s4 F/ r4 z1 J3 s
# U8 P9 ?: L: f8 Y% O7 o4 w- #ifdef EDMA3_DEBUG/ N2 S" r/ C' j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 I9 h/ S" o$ C( L1 S1 c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 H! f' A2 C6 z+ r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ]6 q; j6 I# a% N
- #else$ L' C1 T& W- h) o5 A7 `
- #define DMA_PRINTK( x... )) z9 @7 u7 _( y3 F
- #define DMA_FN_IN" e: M8 \8 j. E
- #define DMA_FN_OUT% T8 R* h. V" ?& |- j+ {& b$ S* N
- #endif% e1 ]# ?* b: [0 T: V- r5 k
- 7 ~0 k, ~$ @+ e8 P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 x5 N2 Y0 c- b- s6 s/ H
- #define STATIC_SHIFT 3
, F' D0 l! ]' f# a# X! r - #define TCINTEN_SHIFT 20
; D5 i) {( I9 b. c5 q - #define ITCINTEN_SHIFT 21
% R$ m1 d0 f4 @& t7 Q: p - #define TCCHEN_SHIFT 224 Q+ K# `$ F5 w' [
- #define ITCCHEN_SHIFT 23% n- H% b1 b- l: q) H# U; \" I
- ! u+ x' y8 Q5 x/ R4 C0 J4 ?
- static volatile int irqraised1 = 0;
9 S5 O5 q ^, d8 X - static volatile int irqraised2 = 0;- `4 r/ k5 e3 h- U4 k
- , v6 I) R9 R' Z$ `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p, m% c: j6 l2 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u' Y9 r7 y; O; ~, c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* G6 M" ]4 ]7 x( I
- # }% Q D7 j. R7 z
- dma_addr_t dmaphyssrc1 = 0;
0 T G" R9 Y- S1 L' O - dma_addr_t dmaphyssrc2 = 0;
% ^0 y1 [( V |& K - dma_addr_t dmaphysdest1 = 0;
' q+ g8 x$ E) _' n+ U - dma_addr_t dmaphysdest2 = 0;
* W4 D% x5 }6 Q5 r - . ?- v; }* t: \/ G, P
- char *dmabufsrc1 = NULL;
+ H% Q: C' @4 S m" ?0 Q3 | - char *dmabufsrc2 = NULL;: L# @/ h( x5 G( ?
- char *dmabufdest1 = NULL;4 ~+ E5 n% O8 T% E; F P1 w
- char *dmabufdest2 = NULL;
2 R- b: C1 O+ u2 i
0 m6 H1 [1 w$ Y4 C5 z! Y: K/ l- static int acnt = 512;
/ k+ R* @/ i9 k, w - static int bcnt = 8;( w+ ~% J0 S3 B( G$ H. b
- static int ccnt = 8;
) P% Y+ p7 a' R: B
, b7 b' R+ f. P2 L) v1 U- module_param(acnt, int, S_IRUGO);7 K4 Y; z; t( Y: x
- module_param(bcnt, int, S_IRUGO);' u" }3 J0 X9 ]3 P- \ s% w% F% C- ]
- module_param(ccnt, int, S_IRUGO);
复制代码
3 e! p+ r. k0 u6 J7 y, I9 P) a& ]) b" a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ B8 E/ g- t5 L4 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" {+ I9 w! t8 k, Q2 J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" `" N1 W( G$ w( d4 O# t- p! ~, T0 H- h2 |
, F( a' U) E) p+ K |
|