|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; [ O2 m# w' a7 E# ^# N( C
- [code]EDMA sample test application
! n# N: \- A3 } - /*
. v" n, I' j4 g) G8 ^' T$ b& _ - * edma_test.c
% u! @+ ^: F' r& @% Y - *! R0 o8 ^6 A8 d5 ~
- * brief EDMA3 Test Application
7 H# f- o) `& ^6 z2 ` - *9 [5 e9 L0 y* z
- * This file contains EDMA3 Test code.6 y# S* y/ [+ @% `' ?
- *2 y0 A$ N1 {- ?7 L1 k2 L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' U5 i) ~. ^+ r( c( W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: J, N' t8 x V/ `& W$ n/ q
- * TO CHANGE.
4 H9 R. y Y9 B, B - *$ H7 f! B3 v; M9 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- j7 K! D R! K+ M3 q4 N: m - *. r* a9 ~: F6 w) t9 n
- * This program is free software; you can redistribute it and/or
% ?: U v/ z6 k2 O9 ~ - * modify it under the terms of the GNU General Public License as
# F5 r. K, A( l: Z5 t5 \, u; B4 K - * published by the Free Software Foundation version 2.
. Z- E4 m/ \8 W+ T5 v/ H6 r - *
. |8 u+ z; ~1 U4 }) n# l( G, u9 Z- z5 j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! N- _. l! J" D g8 a( ]# C) K
- * kind, whether express or implied; without even the implied warranty
1 N5 J8 i# T6 R8 Q) { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! p3 F+ d9 W- `0 D! u# T' F
- * GNU General Public License for more details.0 U9 r7 J8 a# |$ a
- */1 @6 [7 P% ^% n3 I$ [1 W3 I
- # Y) X0 f2 H$ n5 F& \$ M& y
- #include <linux/module.h>+ Y. D! O B0 t1 S
- #include <linux/init.h>, z ]) a' r' O* y
- #include <linux/errno.h>; b8 s* r8 S* x" P$ m- Z0 s
- #include <linux/types.h>/ i! k- C, o. S/ p* j7 o' r' Y
- #include <linux/interrupt.h>! o1 e" W. t) k% H4 h% W( y
- #include <asm/io.h>
* s$ q8 H! ~% J - #include <linux/moduleparam.h>
4 N( e! a6 j0 r9 G/ _* i" j- j - #include <linux/sysctl.h>
4 a% [& w d9 M6 [ - #include <linux/mm.h>
8 v4 x; k% ]3 T7 C3 D - #include <linux/dma-mapping.h>+ w' V) T/ Q% m4 ^7 A- _1 t
+ w& m7 Y5 c: P- #include <mach/memory.h>
+ ^9 |! e( u% e - #include <mach/hardware.h>
" @- ]0 f x& ~ - #include <mach/irqs.h>2 N; [; R4 J0 A/ k6 V. d
- #include <asm/hardware/edma.h>
2 y4 W0 N* i& Y - : T5 o$ p) s6 ?! N
- #undef EDMA3_DEBUG
: Y1 h/ f" X n, N; c$ O - /*#define EDMA3_DEBUG*/% p( [: U; C0 J
$ Z8 R. Z% l, k* |# E- #ifdef EDMA3_DEBUG
' Z& m E$ j; O- P% W' b1 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- U9 y0 b* N# b' D5 i* s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 @2 Q$ M3 R1 F- r8 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) Z2 k( O7 Z5 G! `7 z
- #else
' f. b Y2 i. |6 W1 P3 O5 K |$ V - #define DMA_PRINTK( x... )
# T7 Z& M: D4 F( d/ V: M9 h - #define DMA_FN_IN
6 V9 H6 \/ u P: u" c, N1 i+ ~ - #define DMA_FN_OUT( V6 ~) o- P2 X# G* Y* P
- #endif; I: s, a: H* ^& C' Q
- % ~2 B, Q+ M' w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- _% G% Q- O& w6 ~+ g - #define STATIC_SHIFT 3) x/ D% P! T0 s; A1 c8 X2 l
- #define TCINTEN_SHIFT 20
2 T# y" g9 K- v5 [$ O0 | - #define ITCINTEN_SHIFT 213 B" ~; r. X# ~+ `) H/ b
- #define TCCHEN_SHIFT 22
) f" j f7 X6 q! V( J3 E - #define ITCCHEN_SHIFT 23
( u. N- }9 f, m* u
* c [- p: e3 C/ J! J, {- static volatile int irqraised1 = 0;0 @9 M+ p3 m$ n- a
- static volatile int irqraised2 = 0;' p+ V& {. i1 c/ \
& ^) o$ X4 w! l5 k1 i' n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ]3 @/ S j. j" i7 s: |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 z) D" q/ p( p4 c5 }( k& z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ~, V9 r, c0 X; N
6 x3 A* E, {+ `' m: J* ^. H- dma_addr_t dmaphyssrc1 = 0;
# z, _& z5 P! |* ?/ W( f! o - dma_addr_t dmaphyssrc2 = 0;$ U h+ D; ]. n1 c* ~+ |' J
- dma_addr_t dmaphysdest1 = 0;8 w" i/ b% @3 P9 e
- dma_addr_t dmaphysdest2 = 0;# q- @& `7 ]+ u% ?5 q2 E
- # Y8 v* E9 ?+ `# [1 l" [# N. {# k
- char *dmabufsrc1 = NULL;
3 ]" n) \! Q, J: ] - char *dmabufsrc2 = NULL;
" X, `0 ]( Q# p9 F - char *dmabufdest1 = NULL;6 g7 Y- z1 }. s
- char *dmabufdest2 = NULL;+ Q8 N9 ]. ]9 [
- U: o# K' j5 i0 p1 S5 @2 h- static int acnt = 512;
g. S' W1 `8 S: F - static int bcnt = 8;6 Q u; p B3 t+ j- p2 m
- static int ccnt = 8;
$ G: a, `3 z0 A' c$ S5 w - ( T" f, t; o- ?, G
- module_param(acnt, int, S_IRUGO);
, l/ T* i* d( Q- R. V$ Z - module_param(bcnt, int, S_IRUGO);! c, q; c" g# @1 t' K
- module_param(ccnt, int, S_IRUGO);
复制代码
- ]& j2 E- }) O( l! I9 ^4 t& r, i$ c) F2 J. h3 y8 a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 K0 j9 Q; r# J. a9 H4 X! ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Q8 L. y% f2 [. s2 ~. W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 w! P3 Z; v0 P% p' ]- \- v: s
: v0 [5 O0 b. |& z/ M
" X$ A9 h* ?" @ j |
|