|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 a1 k' E$ W- j' c
- [code]EDMA sample test application; l1 c: z6 }% g2 l ~2 q6 f! } A
- /*$ {8 i3 W% j, t D4 F
- * edma_test.c
; P2 N' w5 n9 {0 U - *+ k3 F- b, b' ~1 |
- * brief EDMA3 Test Application/ a7 R& k5 f9 T; I
- *
l% c! q* \' s* k* w: I- f - * This file contains EDMA3 Test code.( R/ T7 s' ^, s6 I3 S
- *& o4 ^6 W0 ]! Y* |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% {4 d# t4 w$ b4 ^9 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ h2 v$ h2 F, ~+ p/ E m2 o2 Z - * TO CHANGE.9 ?; U: s+ v" R) L( g
- *5 J( A3 \/ \! Q' @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 W+ L- O2 X' F' o" ^$ b( \1 a
- *" E. x# |4 n8 S# Y `- r
- * This program is free software; you can redistribute it and/or# O9 S: ?6 L) I1 h) Q
- * modify it under the terms of the GNU General Public License as
2 O. m$ f9 v' z& o8 G: K - * published by the Free Software Foundation version 2.% Z4 t+ u6 }4 ]
- ** E/ D0 U; i7 S* x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 l7 p7 E" B$ {/ l5 S1 p - * kind, whether express or implied; without even the implied warranty
9 t: `9 q# W9 \$ e' a6 Z+ }& x2 d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- G1 [0 a8 _$ ]* c M4 J0 {3 E
- * GNU General Public License for more details.
* f9 r; @/ b3 a9 H& L - */5 I: }" w" @+ p G! [, R
8 `" f1 f0 j' G" q7 q$ H1 F. u- #include <linux/module.h>
8 G8 N# I; v5 a# ^ K - #include <linux/init.h>
8 B1 @. B- \/ w! U% ` - #include <linux/errno.h>
E: A9 d" K6 }; h4 @" U Z - #include <linux/types.h>
6 k& Q" _, O# j+ u0 a9 s - #include <linux/interrupt.h>/ {0 ?( k2 g. _" D2 I1 R. z6 a
- #include <asm/io.h>
4 p# Q, `5 d# }. K+ i: A2 D - #include <linux/moduleparam.h>
) k4 G) y9 c% I! Z# C4 { - #include <linux/sysctl.h>5 U. C' v# @: ]1 h" w
- #include <linux/mm.h>
7 t. r, ]* B. o% ^& V! P& Y7 h - #include <linux/dma-mapping.h>
* ` R+ \' ^% F+ a$ g5 U
2 c+ ]( A+ C3 N8 W' a* {( ^; d" Q+ g" v- #include <mach/memory.h>/ ^# \4 |% X/ b. y1 h; A( M
- #include <mach/hardware.h>1 s) Q- Y$ [$ q: `3 @ b& K! u! c
- #include <mach/irqs.h>6 s# K6 v7 J, D9 p
- #include <asm/hardware/edma.h># p: M8 i: J' M$ r7 ^
5 K/ N9 t- ~9 n! n% N- #undef EDMA3_DEBUG6 \ |* {0 T) w. W. c
- /*#define EDMA3_DEBUG*/' ?0 ~* H! Y l& S
- / v Z& b$ j, `) m) }7 ^# s
- #ifdef EDMA3_DEBUG
1 f3 W3 e8 T1 m! s5 o$ K6 _5 E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* W) H' E4 Q* J% d- o. f' T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# D" c- O, C3 m% A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! W& `6 ]& \) B - #else
# b5 B4 Q/ R/ M) w( n) D/ ` - #define DMA_PRINTK( x... ), j' s! T4 L3 B2 {, g+ a
- #define DMA_FN_IN) F( M& m8 M$ X6 y. N
- #define DMA_FN_OUT% @7 o3 k/ A5 ]: Q2 {/ C/ u4 m
- #endif
I1 P# r: y4 b$ T - ) _+ Q) T$ h: H# ~; I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, @/ E2 u' [# n' h0 k, B - #define STATIC_SHIFT 36 l- E( |' M+ n! B; B
- #define TCINTEN_SHIFT 20' S. L R3 F: a ~) E6 t
- #define ITCINTEN_SHIFT 21
% } y% @, x' [ c5 ~ - #define TCCHEN_SHIFT 22
# I0 I( e. a/ K3 J1 P7 Z - #define ITCCHEN_SHIFT 237 w* k( F+ w U# ]
) K+ l1 a8 S& U3 u- static volatile int irqraised1 = 0;
# ^/ k& f* m# y - static volatile int irqraised2 = 0; W' S3 d$ g# g) l* m( L- @ J
2 O' z; Y' w; P' {" e0 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 U& k" t, t9 q L, m" R+ r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ D) J, l( R4 j - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 x |' f2 v& L5 t4 G7 w
1 ?# x) D; b) x- dma_addr_t dmaphyssrc1 = 0;4 L6 i- }& M1 J! K
- dma_addr_t dmaphyssrc2 = 0;
, E% [! D# \5 |3 t' C4 g" \. y - dma_addr_t dmaphysdest1 = 0;
7 q, \# ~# n7 a" h: L. q8 z, @9 Q1 l; O - dma_addr_t dmaphysdest2 = 0;( B) q# G v- u+ S
- 6 s- f! [5 N" C
- char *dmabufsrc1 = NULL;$ c5 z* F; Z; N4 L
- char *dmabufsrc2 = NULL;% a& k* W- y/ O2 m" q
- char *dmabufdest1 = NULL;
; K) u+ r1 m4 `3 A$ ?5 E - char *dmabufdest2 = NULL;0 A P$ \- m( w2 z# ^5 e
! n- O6 r _) z+ q5 z7 |- static int acnt = 512;, V5 w/ V* `1 J4 e; B5 A6 v
- static int bcnt = 8;
4 l1 d+ b7 M9 n9 j; A* C - static int ccnt = 8;
s+ W* G( L' x) w- K* }- X4 S - 7 R, ?* w+ v# v/ M% ]
- module_param(acnt, int, S_IRUGO);
5 ~1 |: r+ V) I - module_param(bcnt, int, S_IRUGO);
/ g& b' F. k1 H, H" r! s( |$ M - module_param(ccnt, int, S_IRUGO);
复制代码 * i& M4 ^: Y# i% v* N
6 S- Q2 d% z1 ]8 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 u9 e/ ?& H" ^" F+ a" p0 |; J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: ?& n3 \: W/ N& `* h7 U3 m
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" f; W# B6 ]9 F) }
; E* f& y& m" o
* z5 r' H( q& V5 B# u |
|