|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + J+ H% o ]6 @
- [code]EDMA sample test application0 ~; C2 A3 f7 a# D/ n$ H) C! @5 U4 T* p
- /*
9 _8 l; u$ M+ v! M) E; O, [ - * edma_test.c
: Y( n7 ~+ z3 m4 `# j - *: A+ w5 ]% ?& H% U2 m& ^1 i
- * brief EDMA3 Test Application \; I" H3 `: ?) n8 a' x
- *
7 D X* p( s7 L/ V, {' D - * This file contains EDMA3 Test code.
; g& X P# @, M+ @/ [, y* _/ ] - *
) ~( F) }. d0 r5 Q3 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ Y- D6 ~3 P, K) [* y+ b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o4 F& }: s0 E6 Q# K
- * TO CHANGE./ R, ?4 n4 n6 V0 j
- *
" p% E8 G" z( Z' M$ s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# t1 y ?3 Y4 r+ I( d - *
F D8 p: `8 y; t - * This program is free software; you can redistribute it and/or+ B4 Y1 I, u- G
- * modify it under the terms of the GNU General Public License as
. A* O; T2 ?8 C' ]! }1 O. z7 g - * published by the Free Software Foundation version 2.
* i/ z8 K# r8 ^6 Q, d - *
. |$ D% b8 A' [# j# k v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% }* H; Y9 f' D( W - * kind, whether express or implied; without even the implied warranty
5 Q) ?" ], I' V- n9 u" d I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ?2 X# ]& R. F1 j2 |+ i1 L# | - * GNU General Public License for more details.0 N& Z0 u; t$ B7 v" }
- */
4 B1 W% N1 g+ o/ e5 v) q0 z
/ E4 f# S( V# T3 X9 g" |+ G& C- #include <linux/module.h>$ C2 {, G2 |4 E& A5 m6 ^5 d
- #include <linux/init.h>
9 p( ^5 t2 t0 B6 J- | - #include <linux/errno.h>* d7 O, Z" U. o
- #include <linux/types.h>% t( p0 E) G* G9 N
- #include <linux/interrupt.h>$ p, E; O; M4 K/ d
- #include <asm/io.h>& k F3 d! p/ t- N$ `8 n7 k
- #include <linux/moduleparam.h>
B) W2 q5 m3 z) M0 N - #include <linux/sysctl.h>2 m8 M6 i- j* y; y, q
- #include <linux/mm.h>9 Q# e2 ~1 t9 h0 {8 V" u1 V+ t4 F
- #include <linux/dma-mapping.h>6 Q7 [- R, G: z6 ], a
- 6 A- @& c) @- M# ~+ ?3 _
- #include <mach/memory.h>0 a6 n7 |4 i) g+ ^
- #include <mach/hardware.h> Y' j% c% G2 N- R) c
- #include <mach/irqs.h>
1 ~8 }$ Z4 `+ A2 F7 k* X - #include <asm/hardware/edma.h>6 d. [" F6 G0 q/ F
- + n2 P7 M* T% Z6 U5 ?
- #undef EDMA3_DEBUG
3 z$ C7 r! d+ O4 |1 R1 O) O - /*#define EDMA3_DEBUG*/1 \3 Y8 P& F0 X3 @% m& B1 I
- + u0 {2 x0 k; ?+ N
- #ifdef EDMA3_DEBUG0 j# N& B0 V6 d6 h; q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- I: }6 c$ I8 f% ^/ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 s3 {' |9 O: s+ N* ?2 e. z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ] }8 ` F3 E
- #else
0 Z( V8 z$ a4 R8 r1 n& G8 c - #define DMA_PRINTK( x... )
5 a8 c W1 `: k6 S$ ?8 S [# i( A - #define DMA_FN_IN
2 V- g) \9 y! r, z' X - #define DMA_FN_OUT: n x. K: y/ l
- #endif( ^ x2 |3 R7 ?
9 Z* U( [+ p+ k0 o: x$ X) r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! U4 a E; x0 C! R - #define STATIC_SHIFT 3( ?: ^- e* h; N* z0 Y2 `( K: ]
- #define TCINTEN_SHIFT 20
' @ o; W9 |& F- X" \ H - #define ITCINTEN_SHIFT 21: f8 ^* f# |( B6 B# k# t0 Q/ I, T
- #define TCCHEN_SHIFT 22# Z( T8 t" @- b! {5 _
- #define ITCCHEN_SHIFT 232 R4 Y6 @7 Q8 s
- + Z0 P& P; B$ o7 Q
- static volatile int irqraised1 = 0;3 z+ | j# Z7 B
- static volatile int irqraised2 = 0;' a% ^& l* m3 h. ^; U p
- 7 S3 G' K- q$ w0 z/ B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 |6 `& x0 k, n3 ^3 U8 q p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" l' ~6 Y2 b' _% l+ L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D2 A1 t2 a L. A$ @; l: v. b
1 K! U! d( k, J- dma_addr_t dmaphyssrc1 = 0;- _0 c9 E% |: e, u- F% k3 A) o
- dma_addr_t dmaphyssrc2 = 0;
* x' F& y9 z3 \2 M3 G% _" k - dma_addr_t dmaphysdest1 = 0;$ v% P" V7 O- Q, r
- dma_addr_t dmaphysdest2 = 0;
. [7 L- C4 z% l3 |3 V4 M2 z0 y! M
2 s- T6 z. a# w( d- char *dmabufsrc1 = NULL;* f, C4 f0 m( b% b$ y
- char *dmabufsrc2 = NULL;
7 `$ d$ E X; `& l. x4 w& U E - char *dmabufdest1 = NULL;& ]' y S! t0 U
- char *dmabufdest2 = NULL;1 \6 `( A6 D) ^
- / l& D9 u9 R" `! x( ?: c) a
- static int acnt = 512;
* _- f' \, V9 O - static int bcnt = 8;
0 s7 E' U2 N+ J+ b" d - static int ccnt = 8;
1 X( i! h: ^' ?* q& c, J5 u* X3 o - ! W" l8 l* D# x2 Y
- module_param(acnt, int, S_IRUGO);/ V" y; T/ i* Y9 A7 k* N
- module_param(bcnt, int, S_IRUGO);
% v/ u0 b) D5 J0 `, n" Z - module_param(ccnt, int, S_IRUGO);
复制代码 - @4 A" G, L, T. o. u! c
1 d) ^" L5 v W( d: i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ]) H5 l1 z& A: ]2 U# Warm-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+ @1 S; @$ r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' i5 V; j2 \% G2 O9 D3 E, l$ D) D6 V+ i4 H4 d! n) p
$ h# G7 D( I) H+ ` |
|