|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : K, d" B# n3 `8 ?# o% C
- [code]EDMA sample test application
# E. A } N; o' D2 I0 w, o - /*
' ~5 [# o- P- i% d2 a - * edma_test.c+ r6 |/ r5 K; d4 _# i1 T
- *
& O9 H& p" A9 m. B' u8 v" p - * brief EDMA3 Test Application! T4 |5 M) K! Y
- *( Z2 l& C; p) m ~9 O" U* S: T
- * This file contains EDMA3 Test code.
% T1 ^ G6 _4 O* W% |' h" F8 r - *4 e, ]: n$ L9 F J- }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 A) S2 Y( z- z; M3 z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 B# {( T2 I& ^
- * TO CHANGE.! b( n' R# g# _! a* s' s2 j5 \ }
- *
9 l; u6 F) n2 ~3 g, n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. D, s& q4 t9 D' i- ~$ o4 ^
- *
6 W; L0 R# e( h ~ - * This program is free software; you can redistribute it and/or; |% C% H1 T: r+ z) J
- * modify it under the terms of the GNU General Public License as: k, u3 t) ?- t0 f$ }- R9 ^, r3 H
- * published by the Free Software Foundation version 2.
7 t s# `2 e( \& i2 K* V3 g2 I9 m - *$ X& V: C" U& Z' M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) T1 Z2 }1 M3 z0 B
- * kind, whether express or implied; without even the implied warranty) M% ?; Q8 w% P- y1 y! R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 m8 `% i1 |! Y% r7 ]$ T- _; P - * GNU General Public License for more details.9 O5 F" E9 t x( m8 T
- */
# v' C* g/ f, z, s# Q - : D* s1 i8 r5 g P/ x
- #include <linux/module.h>
6 Y" t" {5 `" v/ P# s5 J% [ - #include <linux/init.h>, l6 E9 M" z* k5 m
- #include <linux/errno.h>
& p6 W" s6 F0 l6 G' S6 g - #include <linux/types.h>
6 \( o( b7 X! j, P2 W& w - #include <linux/interrupt.h>$ }! Z0 _ u& ?1 H
- #include <asm/io.h>
" G: M$ [6 h3 K9 O0 }. ~* ?) V - #include <linux/moduleparam.h>0 X1 o+ X b C
- #include <linux/sysctl.h>9 ^/ B2 X. G3 S9 U- f6 Q! f% k" U
- #include <linux/mm.h>& v* S, A% V4 M/ y
- #include <linux/dma-mapping.h>( g5 d: s& Q4 i5 N. G5 Z
- _) u% b8 _6 z4 O- #include <mach/memory.h>
; F0 `: G! o8 s+ k K - #include <mach/hardware.h>
* q" P% p5 m5 s' W9 d - #include <mach/irqs.h>% S# `# r0 |: m+ ]3 B, ?
- #include <asm/hardware/edma.h>2 a) ]* o. O0 g, h4 ]6 ~; A
- & [( h9 K$ E' V
- #undef EDMA3_DEBUG
) H0 x. e6 {% f' \% H/ M - /*#define EDMA3_DEBUG*/& h9 w$ w R. w6 D
2 |# C# }7 ?2 r2 ~. O. V" F- #ifdef EDMA3_DEBUG% J! [$ m" B' [1 w- z* n9 E% s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 m. ~1 n: A7 J5 V# J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- C0 F1 F6 C9 I; `0 E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 ~8 q; L- D2 i: N% B - #else5 C A8 m0 m# E9 |8 E; K
- #define DMA_PRINTK( x... )
2 N$ o# A$ W1 {. T! Y b - #define DMA_FN_IN
( u- ~& |4 s4 f1 y - #define DMA_FN_OUT
- y8 _" r5 V0 E - #endif1 |3 Z p& R* s! y
8 c: f& L# X) N* m: N# ?2 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: r5 K8 x9 ^9 X5 _! a9 S - #define STATIC_SHIFT 3* w- x$ l* f5 w# ]9 o, z
- #define TCINTEN_SHIFT 20
~& Z( K, p" ]8 G8 e - #define ITCINTEN_SHIFT 21
: e) P! s$ s) `; ~ b4 N! \ - #define TCCHEN_SHIFT 22
3 Q4 n: P2 }5 `4 P- L" E& v7 g - #define ITCCHEN_SHIFT 23/ [0 ?) y9 I- x7 X! p
- # M% ?) A& a, }* k" _+ z
- static volatile int irqraised1 = 0;/ Y& I! p" i+ J/ D+ i a n
- static volatile int irqraised2 = 0;
: {0 E, g+ c7 Y$ Y+ a2 N2 g - . U, T; ~) e" u, S: t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 X b! @) [2 e1 E0 o# l) u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ]/ [1 Z, N9 ]1 M/ Q* c& l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G- y+ ]1 ^: J( Z6 M
- " U; R" g4 X2 F- J; j
- dma_addr_t dmaphyssrc1 = 0;
5 Q8 I% R, [) m% | - dma_addr_t dmaphyssrc2 = 0;
5 ]0 x& W0 W" v" Q# f, j - dma_addr_t dmaphysdest1 = 0;! c" v3 W: h" _' @: v2 j" w3 Z( O
- dma_addr_t dmaphysdest2 = 0;
, n5 n: \3 v0 K! I6 n& @" `9 ~# p7 T. l - : _) o/ Z9 ?* q `" B, ~- z
- char *dmabufsrc1 = NULL;
9 w! c: B( W' Y, ?. [/ \0 F - char *dmabufsrc2 = NULL;
2 K/ G0 _+ `2 l4 j5 L2 N' t - char *dmabufdest1 = NULL;
+ E6 b' h8 y1 ]6 P: ^) f - char *dmabufdest2 = NULL;
3 C2 Z. \) t, W9 m; O1 F& u. F - + O6 t! b) _4 ^" Z
- static int acnt = 512;7 V! R; R# a- g6 n- H7 J: c( r
- static int bcnt = 8;
# [) [+ m- P8 K- o" c' E - static int ccnt = 8;
- j" m/ h- Y3 H" v - 0 V7 L* z: `5 [- t4 v4 n
- module_param(acnt, int, S_IRUGO);* H% o2 ~/ ?* r
- module_param(bcnt, int, S_IRUGO);
9 t5 s1 R- M* `% j1 D5 N - module_param(ccnt, int, S_IRUGO);
复制代码
) ?6 p# x! _3 a, h# E b
4 S8 Y h; w) o# J, p6 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ I( S7 @/ [9 @2 }3 o: Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 |% f1 n+ C2 k5 x; P& q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ k W8 u" C& u. X r& s, B( W. v+ w9 u
8 j1 K, R, ~- Q* Q4 H" k
|
|