|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 U, W/ P$ R) k0 |7 |- [code]EDMA sample test application4 t. |- c9 W$ F# I R' p% k
- /*
4 l- ^- s; i* v$ I& y/ G x - * edma_test.c8 v5 j. {, ]" n( m7 ]+ H
- *
9 r9 x% S! Q# ]$ C9 f' C - * brief EDMA3 Test Application" V# S- `8 f( O# c) d0 @
- *; e/ g) ?" A: ` n" n
- * This file contains EDMA3 Test code.
6 Y& C* C- ~/ J) {$ t! v5 \ - *
8 G* b0 l m$ Q: }% J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& e& j& F, r3 ]2 s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" i$ a- L0 y" \: F5 X) L# } - * TO CHANGE.
2 \5 w2 I0 @4 M - *
; J- J5 m% I; q3 J, p% T$ W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ w0 p3 h" D9 m% p/ v4 r2 g, m& [ - *7 R2 Z( c2 O! S: H. M3 ^* ?9 L
- * This program is free software; you can redistribute it and/or
: v2 m7 n8 H6 f9 M/ e" ] - * modify it under the terms of the GNU General Public License as) H, F: e: | p# g
- * published by the Free Software Foundation version 2.( ]+ t& l. B3 k2 l! W7 }& c
- *' w w, k u: l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 H) d( ~! D$ A3 Q - * kind, whether express or implied; without even the implied warranty! x2 T; J3 g* h! m! [% _8 p* U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 i8 m" D$ h p1 v
- * GNU General Public License for more details.- U! d# ]% U1 r) Z4 f6 D5 ^, G
- */
9 s X C0 |9 y# L
/ Q7 C) B0 o" i9 @- #include <linux/module.h>
: P* n4 H1 S, E. T - #include <linux/init.h>
- j R0 {. u! A - #include <linux/errno.h>
/ S# r2 c) M8 j3 t - #include <linux/types.h>! P. F) }- \* W3 z
- #include <linux/interrupt.h>" y7 C0 x" j1 a5 Y' |
- #include <asm/io.h>
9 f9 p( T w' s1 o( n - #include <linux/moduleparam.h>
9 N' P" b$ r2 q! x) Y- ^+ F - #include <linux/sysctl.h>5 q0 M7 P2 G2 t" U* Q0 o* r
- #include <linux/mm.h>! ]% p# F4 O0 r7 f9 _
- #include <linux/dma-mapping.h>
6 t/ @/ C. V+ D% \ - # l. p2 l$ J( v) `
- #include <mach/memory.h>+ [6 O: E& B( q0 L
- #include <mach/hardware.h>
( U, Q# z) x! n. C0 j. \ - #include <mach/irqs.h>
5 k- Z: y2 K* E% s" _* n# N. |6 i - #include <asm/hardware/edma.h>) N/ p# |8 c) @1 c: _
' A" ]9 p+ P5 O! y$ N g! C- #undef EDMA3_DEBUG
' o @& f2 q/ S. v. }1 N/ T+ o" r - /*#define EDMA3_DEBUG*/6 d3 U# B1 e. k1 o; P. B
- - g7 f! D; c. l' V
- #ifdef EDMA3_DEBUG
) @+ G& J* x5 Q: O9 T9 s. L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 X1 Q% Z5 L+ J- v, k& {1 ^/ r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 w- j; h% c0 l' G0 h) [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% X- j0 R6 _# |/ Z5 o" B/ w, [ - #else2 H `( }, B1 N( }
- #define DMA_PRINTK( x... )% p# ?" [" j4 Z+ O5 o3 N
- #define DMA_FN_IN T1 F9 U5 I! k3 \. X1 c9 x5 w% e$ \
- #define DMA_FN_OUT
8 ]# o! ^) Z% k - #endif5 [. x P% O4 D$ Q* e& d' M6 N& [
# b/ d7 F" Q+ [2 B0 ]& b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* D% q! b* `, i8 u5 L* G7 Z* E - #define STATIC_SHIFT 30 o3 ^; e8 W1 y7 Z; f$ L: _4 B# Q
- #define TCINTEN_SHIFT 206 o7 O& X4 a7 ~6 `
- #define ITCINTEN_SHIFT 213 h* L, ]3 X" _( V" z
- #define TCCHEN_SHIFT 22
9 _; x. w5 H, h! y - #define ITCCHEN_SHIFT 23
: ~' a& }) T7 M7 t7 R$ E - , P' c' b U4 b
- static volatile int irqraised1 = 0;- I7 n: D- r4 s+ O0 U
- static volatile int irqraised2 = 0;: A, u+ |% w& `& q' C8 ]: _5 c
- ) }" n6 u6 Y' A( n. U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y8 L& K ~) B. y4 I0 {" c# }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ]2 c% Z( E/ u& U& V7 b6 [# C7 E* _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 u7 t& q7 l! T& V
0 t( z, U# H( u+ I- dma_addr_t dmaphyssrc1 = 0;
- S& ~( W6 k7 b - dma_addr_t dmaphyssrc2 = 0;
% o2 T( q0 G$ n! }/ h - dma_addr_t dmaphysdest1 = 0;
0 b+ H! o0 V' o6 I+ ^' J - dma_addr_t dmaphysdest2 = 0;. J3 e3 r& s3 M6 ]
9 B& N4 R# [, |) P! `6 [3 B5 a- char *dmabufsrc1 = NULL;
$ p. l; l, p+ k: j4 l* u% d - char *dmabufsrc2 = NULL;
8 [2 S: ^5 x: d' g& Z# T - char *dmabufdest1 = NULL;
4 t& }* b5 E% ?- `+ T( _3 r- | - char *dmabufdest2 = NULL;
2 B+ @3 z% @# J2 D5 `2 |
: |( M* i& x/ A9 q, Z+ Q' T9 k- static int acnt = 512;
# L3 N) [! i2 r# W - static int bcnt = 8;" D; `" m0 E5 O- q, \+ H7 |# M
- static int ccnt = 8;" y0 j7 ]* S R i7 ^6 V, V. R
- * }2 ^) z: C; ?5 z) a: W) a
- module_param(acnt, int, S_IRUGO);. Q- Z3 U4 L# W7 I3 I
- module_param(bcnt, int, S_IRUGO);
2 V! i. V* q3 b# m - module_param(ccnt, int, S_IRUGO);
复制代码
" ]' G, n* m* J+ l/ R' H- |8 c' t' d0 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y' W8 b8 M+ ~
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 v3 u. z. b6 I i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 |2 A- y$ B1 j
; Y d- k/ {% g7 ?
+ f5 A0 `3 d8 F: g |
|