|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& {4 N" T# s; D- E% {' G0 y- [code]EDMA sample test application
2 R; \* Q( }" S* I- q - /*
7 E) j! v: p( H, w - * edma_test.c
/ l/ _4 h: D2 X9 [& q) ]6 H6 { - *
6 }; ?8 k4 \; S - * brief EDMA3 Test Application. h4 R; B3 k# z, C
- *9 j, d: {$ ]3 [0 [
- * This file contains EDMA3 Test code.
( |5 \2 o. |/ m" d& x - *5 ^# _7 f2 v4 X; Z N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Q* f+ c; C: {5 k# F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 w! C1 h/ K- e0 _# F9 l" j - * TO CHANGE.
) G. R6 L& S3 b# Y - *, U* a5 t4 u. i, ?
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- J8 H: U' M. z* d$ P7 \& T
- *$ ]+ g# x5 j& ?
- * This program is free software; you can redistribute it and/or$ {$ V5 p- l+ o1 [7 L" q* e
- * modify it under the terms of the GNU General Public License as% H' e# n: b0 q. N, E
- * published by the Free Software Foundation version 2.9 Q5 z; ~. q% K# g/ o
- *4 ^+ q' Z2 ^5 w* h, f1 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. _) C) t* d0 c( x, a) ]' @
- * kind, whether express or implied; without even the implied warranty
0 |. Y3 l6 x+ V. f2 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. Y0 p) y, S' J& C - * GNU General Public License for more details.
# J" t! k! S+ x9 R - */
; k& ?/ S& a \; S+ V) o6 i - $ _' O# v8 o5 i+ ~1 A6 n9 H( g
- #include <linux/module.h>( _2 P0 `+ V9 E2 Q" U
- #include <linux/init.h>5 t: \: |8 P& q5 S; n- G) R' d
- #include <linux/errno.h>
7 P7 W" Q. Y4 S - #include <linux/types.h># A5 w, }5 s2 c1 Z
- #include <linux/interrupt.h>* `5 o- X$ Y1 G% I, f& l
- #include <asm/io.h>& t W& {7 p! ^ a
- #include <linux/moduleparam.h>1 E; v% J: p! {2 j- \7 l
- #include <linux/sysctl.h>% o7 x+ a& R$ W
- #include <linux/mm.h>
^7 @* ^2 u- G' O& j - #include <linux/dma-mapping.h>
( C6 N' Y- z( u0 U( I4 `" n# y - 5 K4 y, C1 A" w
- #include <mach/memory.h> h1 G) j$ J- ~* X
- #include <mach/hardware.h>0 N4 l" G* ]1 D% ]. V
- #include <mach/irqs.h>
: N5 S' @, v+ Q0 Z+ ~( g" o - #include <asm/hardware/edma.h>1 V- D: W% n8 V# e( X9 m
: G) E4 R+ v% F6 L+ A- #undef EDMA3_DEBUG
/ b( ]4 H t7 L( j; }+ G - /*#define EDMA3_DEBUG*/
$ W8 K$ z/ p: Y$ \8 _0 f
) Y% s- V6 V% K8 p. T- #ifdef EDMA3_DEBUG
7 K/ n: Y0 E' ?1 q( ?/ h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- B4 O) `" {& ]5 r- C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% M0 M' m \! c( s+ n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ~0 a" B5 f) R9 i8 P T
- #else# k; [) I! M* m; g" I/ D
- #define DMA_PRINTK( x... )
4 |6 a1 \4 U7 F% d& v - #define DMA_FN_IN7 X! u! k4 d1 Y
- #define DMA_FN_OUT/ k: @) w8 M+ p+ D( y) L
- #endif9 W+ _0 B" y1 J U+ f# m' ?2 w
- ' f( l5 }! @& l8 B4 v6 B+ n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# l+ O7 E& B, i8 v0 H' x
- #define STATIC_SHIFT 3
* }. Z7 m9 E- v8 o# H - #define TCINTEN_SHIFT 20) H$ J$ b# C' T4 j" u9 T
- #define ITCINTEN_SHIFT 21
# G* m: m9 i7 N9 [( d - #define TCCHEN_SHIFT 224 v1 N f. l! _0 a8 V% a1 j9 p
- #define ITCCHEN_SHIFT 23* ]. M: D6 |! f5 O4 f* I f
- 1 I1 f; W; V | L
- static volatile int irqraised1 = 0;
% l! R0 N1 G& @" j3 R - static volatile int irqraised2 = 0;) }" x C4 z5 W8 a
- # q/ x$ F8 _# d; C2 X' N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& p( X& [5 _ h! Y. H* k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
O l" `- }/ T$ |& u8 _+ F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ M5 j9 J9 z/ o( g4 Z. g - + k5 S% U9 [( Q: Y' a4 O
- dma_addr_t dmaphyssrc1 = 0;% q# b' y0 ] @5 H4 c
- dma_addr_t dmaphyssrc2 = 0;+ V- I& D: b6 G
- dma_addr_t dmaphysdest1 = 0;" j$ X. I- L' m5 \
- dma_addr_t dmaphysdest2 = 0;; \. `" |# s' h, u; E$ J( T
- ) a0 b4 n& i6 B/ u
- char *dmabufsrc1 = NULL;
2 Z6 f. \3 f- ~' m+ ^ - char *dmabufsrc2 = NULL;1 ^9 ]6 S/ f; ~- S
- char *dmabufdest1 = NULL;/ t" N7 I" C& d' U' ?
- char *dmabufdest2 = NULL;
9 ^- T# a3 `/ T, d% K
4 G) P6 K1 T5 b5 l- static int acnt = 512;5 m% I7 ^: a9 c
- static int bcnt = 8;: s) d$ S. M6 a5 l" M
- static int ccnt = 8;
% o9 k. ~" ^% d7 ~" Q9 @/ `
, G1 U# K2 w' T- module_param(acnt, int, S_IRUGO);
) [" [# G3 t1 F* w' |9 h* P - module_param(bcnt, int, S_IRUGO);; k, \5 f' i& O. y
- module_param(ccnt, int, S_IRUGO);
复制代码 v' ^( V+ [* }" F
8 s# U+ r' S4 U. }0 U" N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 E9 O# a2 w. _( P5 `# y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 B* R2 L* y+ f* i) ^/ @) f( e8 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# y+ N8 C! L7 ~; P& `. G. S0 {; `1 ~/ x$ F
/ @4 r5 g: P, Y$ a6 E) Z |
|