|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' b& s" b! J1 g4 Q% `
- [code]EDMA sample test application- i. S% @' R, F
- /*
8 ]4 Y7 [( u1 e) b" l7 S - * edma_test.c9 N! T# M u& X
- *
& L5 ^1 Y$ i, b& M - * brief EDMA3 Test Application- Z8 T2 c9 J/ S! L* q7 @ G; {
- *- C5 `+ p1 _* q% F; |0 d5 C
- * This file contains EDMA3 Test code.
2 T* Q9 s* {6 w7 C7 C - *
. B% X5 `8 j6 q u2 k' ^! ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" S! z. Y' [; g+ |/ K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 P( `, s" l# D* e0 i9 I - * TO CHANGE.
' g9 \5 P0 t* A' I - *
$ [; w' H2 D" M, t: G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' | O8 x$ A; e' m( _) z- F - *2 l8 J u" F3 ^. s# J( X1 o
- * This program is free software; you can redistribute it and/or
' V3 f, I @) q6 a3 s' F+ l4 z% N - * modify it under the terms of the GNU General Public License as
2 h) S5 _$ u9 J5 K9 C K - * published by the Free Software Foundation version 2.7 J3 R! c' L3 v1 y2 I4 f) |
- *5 Y U1 d& D: M( V" ]4 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any v- X7 B" t/ g$ @$ ^
- * kind, whether express or implied; without even the implied warranty2 N8 d- p# F5 Y z. B7 |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 N5 M, R- A7 y6 h - * GNU General Public License for more details.
7 }* `6 V) ?* G7 A$ i - */2 O9 @1 @7 U3 R D, R! I; Q% E
8 @* a/ g: F* s2 T- #include <linux/module.h>+ P# d) Q% ]+ ~, \! O. w
- #include <linux/init.h>
" F% ~1 ]. l* a. e; a8 O+ c w - #include <linux/errno.h>
& [5 j; T* `2 X: c8 D9 }# i - #include <linux/types.h>" g F+ O3 k R! o, o. }
- #include <linux/interrupt.h>
, d5 z3 f' [ i* u+ j' d - #include <asm/io.h>) O' e a& I M/ z/ y9 z5 n5 W
- #include <linux/moduleparam.h>, h5 o9 R; f6 v; C0 L$ Q
- #include <linux/sysctl.h>
f+ l$ Y8 D* { - #include <linux/mm.h>
, z. t% W. U& I* T' ? - #include <linux/dma-mapping.h>" h- T0 s% y0 i8 @" L
& [1 K' }7 g3 w8 u- W- #include <mach/memory.h>' V/ u3 d1 u/ Z" n
- #include <mach/hardware.h>
- t5 B. l2 X- O* r/ k5 z& X; I - #include <mach/irqs.h>
! c& O4 x+ b: [5 Q3 q - #include <asm/hardware/edma.h>
0 n0 T* _0 \% E( Y) ^2 c - . J6 g, S- \$ v2 v5 v ?& [
- #undef EDMA3_DEBUG
, Q A ]7 ~6 @; D" Y4 A - /*#define EDMA3_DEBUG*/. h) v, T9 f8 x& v, F
1 H2 p, i8 u4 a& S3 \- #ifdef EDMA3_DEBUG0 W; c' F; w. B9 D7 n/ v
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) b4 N3 @* _$ O" F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 y* t) Z& d# ~ f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 D5 u& X. k- D- u - #else
( ^) W6 w+ b" L5 ?0 P8 [/ I - #define DMA_PRINTK( x... )
) o% g2 d" ?6 [4 v: q' L - #define DMA_FN_IN
- ?6 @+ h( S; a# Q. A' b - #define DMA_FN_OUT6 j5 y; d# u& t! T7 g D
- #endif
' o- D4 z8 i4 ~) H. R- `1 Q& B - " n% q+ z# f- z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 I+ H4 M7 I# F; N0 z
- #define STATIC_SHIFT 3
2 P- Q$ }( r0 S - #define TCINTEN_SHIFT 20% ^3 V. r) ~& f( ^: s% M# o
- #define ITCINTEN_SHIFT 21# G+ G" @$ F, J
- #define TCCHEN_SHIFT 22
6 G; q! d1 A; @& K2 E* C - #define ITCCHEN_SHIFT 23* w" o4 B! [4 [ f9 @+ Y$ @ y& z N& d
# H3 S, j( ]2 ]# R# E1 P7 y- static volatile int irqraised1 = 0;' X$ @( s% n" c8 i9 r; w! p. A& f2 r
- static volatile int irqraised2 = 0;
4 e6 b, N- f5 k. g
]+ a5 `- l4 q# ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# I9 C W& X9 u q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. T) c) G9 |+ h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 L* i2 v0 Q. ]5 c4 w9 A
- * K5 i7 b4 ?! T9 K3 w9 Y& U
- dma_addr_t dmaphyssrc1 = 0; }/ `* p ]$ l2 z* T6 _2 U8 c- w j
- dma_addr_t dmaphyssrc2 = 0;+ o( E# }! N# A9 S/ S. W- u$ N
- dma_addr_t dmaphysdest1 = 0;! _% x0 X2 b2 ^% A" e
- dma_addr_t dmaphysdest2 = 0;: o Q; E; n& d5 S! y
- + J8 e% z+ ?4 @ A. a, B0 Q) t
- char *dmabufsrc1 = NULL;6 M2 {" Z' ^- I9 M/ w" w
- char *dmabufsrc2 = NULL;& R0 W4 S# x# }6 W. B8 }; R
- char *dmabufdest1 = NULL;3 g: d3 t; p3 S. _2 h
- char *dmabufdest2 = NULL;
: M- U+ ?/ j+ g5 q - 1 O4 i% p, e; V+ y: f
- static int acnt = 512;- G9 t+ G2 J! u- i: F w
- static int bcnt = 8;! h) W# _( Q4 ?$ w% K* s
- static int ccnt = 8;
: j2 H! F6 W2 J4 u
$ |) v. W6 b: d$ {/ Z- module_param(acnt, int, S_IRUGO); ^. x' d B) ?# E3 C% o: r
- module_param(bcnt, int, S_IRUGO);
% Z7 d* ?) D' q! V/ C - module_param(ccnt, int, S_IRUGO);
复制代码
6 i g! ^; t6 T. Q8 G; ]5 C6 S8 n2 e% A0 f& O8 }! q" Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 e. s" F/ {) f1 T ~( p$ @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 ~4 M, l4 P8 l9 Z$ L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: p- G: @: _: Y# |7 q: m0 [) L. R- \
d: n! C/ {2 `3 X1 r
/ U6 ]5 }, k2 g/ Z |
|