|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) x# J' O& }3 Y9 l9 i0 O z
- [code]EDMA sample test application
4 {( t* K) V! j - /*; K: p# T1 v& e w* h1 j
- * edma_test.c. Z" E5 s" j6 H" ]
- *( h i$ y3 L3 l" i' c
- * brief EDMA3 Test Application
3 U7 O$ ]" v/ k1 l- I; t$ X, a K - *2 k: U9 h" L$ k. U6 {2 ]
- * This file contains EDMA3 Test code.+ Y- Z5 f: Y$ y( G3 E
- *9 W9 ~! H+ y: H- H. L4 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! C( l$ x. o: X, {7 e$ [) h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT A1 [+ `" @( j# s- e* c
- * TO CHANGE.0 u7 |6 y0 F# G: o4 f$ ?
- *! p* {8 x, {- Q6 j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; c, C! q& L2 ?& U8 X" a - *
7 b9 I1 J' N2 ^5 d$ k - * This program is free software; you can redistribute it and/or
6 T: o% ^! y% M X/ y; x - * modify it under the terms of the GNU General Public License as# o' n! s0 T. z$ r8 q
- * published by the Free Software Foundation version 2.
# J6 ]4 N* g0 D# t2 P - *
, ]% [! d, `" s1 _9 \ V. R - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 R. Y. h( S7 p5 B$ J+ C0 ? - * kind, whether express or implied; without even the implied warranty, e# s9 X+ \2 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* {& h8 Y6 P6 E+ I1 P% c - * GNU General Public License for more details.
: o+ D+ q! c( ^1 b2 q - */. h+ @8 C5 ~0 ^& C, R. P5 R5 Z
- , W9 b( X9 n! e& H8 @
- #include <linux/module.h># l- p. i4 M; P! }9 u
- #include <linux/init.h>
: [2 d: {& s- C% O( u - #include <linux/errno.h>* M2 Y) Q: o/ u- B6 g' N
- #include <linux/types.h>
0 S) g( E$ m0 | - #include <linux/interrupt.h>
1 x% Q4 {: G+ H5 T) g3 R' l8 d8 A+ V - #include <asm/io.h>. V9 F u# n; ?- _4 C2 M D6 T; |# X
- #include <linux/moduleparam.h>7 \. D" J% u9 G. W! j4 f, J
- #include <linux/sysctl.h>
1 t. p, w; y! d8 Z2 U - #include <linux/mm.h>
( @& f7 `' n3 |) ^ - #include <linux/dma-mapping.h>
! s( {0 i3 p( C% }: ] - ; z7 A5 Q4 }: r0 g$ Y0 P
- #include <mach/memory.h>
1 O! W) O$ Y2 h/ o1 F+ ?; E4 m. s - #include <mach/hardware.h>
8 w( Z$ @* R2 e! e - #include <mach/irqs.h>6 x3 `5 h6 k6 ], v! r5 X2 c1 m
- #include <asm/hardware/edma.h>6 E( f1 l4 ?8 b/ x; j9 z3 [
- $ ~0 a; }; T, ?& |
- #undef EDMA3_DEBUG
3 W. w' m" s: N: o! w - /*#define EDMA3_DEBUG*/9 n8 P9 }4 c- j' c0 S ^$ \
- 8 g$ h$ H! {5 b& ~) v
- #ifdef EDMA3_DEBUG) z9 }, Y. D7 a$ o* D/ g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 b$ L2 M% N, k' n& E# B
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ n F' o6 `; W& d0 x5 O3 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* o8 s, w. \% z8 i0 o4 }; q
- #else
Z9 I) {3 H- b, F- a/ w - #define DMA_PRINTK( x... )
' E8 O0 F) S% a! J - #define DMA_FN_IN t- l7 U9 w/ I" ]' p6 \
- #define DMA_FN_OUT: p* q& L ?( @/ m# W
- #endif
) x) I' m% b" V, W( l
1 K- ^7 ?+ t- `+ S8 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 {: h" f4 K0 `5 U9 H
- #define STATIC_SHIFT 3- _# p* U9 o# O) D1 u
- #define TCINTEN_SHIFT 202 }$ f J8 k J6 L9 h, p
- #define ITCINTEN_SHIFT 21
( d# M( `4 T+ q8 o5 g+ D3 h" j - #define TCCHEN_SHIFT 22" Y4 o# C3 k- h( Q' S
- #define ITCCHEN_SHIFT 23' u3 q- c3 k& [5 `; w. u1 q- H
; @& k4 N, ~) A- static volatile int irqraised1 = 0;2 p3 A3 {7 j; @
- static volatile int irqraised2 = 0;
; u0 x! J) }+ U* C - : a/ u: i7 \( S7 K( {5 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, s/ S% `/ x# @! W. }7 O- h) w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 T* m3 T9 ^0 \, F' M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s4 T% |7 E @: e. \* C' a
- 7 }/ B2 S. x! t2 V- s( ~0 r
- dma_addr_t dmaphyssrc1 = 0;% ~! _7 Q3 ~) ^- h8 S4 A; |
- dma_addr_t dmaphyssrc2 = 0;' m' w" d; M) Z1 @8 ^5 H) [
- dma_addr_t dmaphysdest1 = 0; |, f6 }* J# l; ~& k
- dma_addr_t dmaphysdest2 = 0; Y% c, q3 e5 M/ ^
- ( M" m( P: z8 Z8 T4 d) f( t1 [
- char *dmabufsrc1 = NULL;
' b8 L. h8 b6 B4 N+ G% Y2 f - char *dmabufsrc2 = NULL;6 l0 O- q/ L3 K. B% B2 O
- char *dmabufdest1 = NULL;
0 C9 b* ~7 F$ `- | - char *dmabufdest2 = NULL;
$ R5 J$ j# p$ O* f4 T1 r/ e
. n8 F4 Y. H& _) ?# w ?: t x- static int acnt = 512;1 Z. ]2 d4 k7 i* [; U
- static int bcnt = 8;) {; w3 h1 U' R o1 c. k) a
- static int ccnt = 8;
o) L$ J4 y% c% ?
8 S4 F1 }, e' ~& ]0 O* s/ j- module_param(acnt, int, S_IRUGO);( Y# ^" E" G5 f# A& c; C& O
- module_param(bcnt, int, S_IRUGO);8 F3 _- A/ {/ j8 c
- module_param(ccnt, int, S_IRUGO);
复制代码
: ~6 \0 W! S: E0 L' k2 L i* s* z* Q- E- q+ l
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 z2 S! v7 K/ t. T# O( e. V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; P" {- r/ u% _ E: {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# d! W2 A" n2 Q" S% V. r) x, F U6 w: l5 Z8 S" f) g' W
0 Q3 {9 ^. O' S/ ~! t
|
|