|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; L u8 a3 m8 H$ ~) f- [code]EDMA sample test application
4 K! Y" H2 X* x& G; ~" q - /*
. I+ R' T' v# F7 r# w% y - * edma_test.c" E. A( ?4 m7 w) Y+ B
- *& o2 d! y: R- {7 [* k- U# M
- * brief EDMA3 Test Application
+ T9 B1 Q& Y; ?( V0 F5 K% M - ** n: k# B0 F. P8 H
- * This file contains EDMA3 Test code.
4 h J4 `+ x- s5 ~( p2 x - *' g% E' b5 `1 ]! |% A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' u! L; ?5 K9 f0 Q* h; G' G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 D6 {# {$ I4 j- @
- * TO CHANGE.$ o; K3 g3 x, G, X3 r6 D
- *
' d# \% a7 Y" Z2 f$ A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 p4 Z: w) W0 y. R* X
- *
% I! |- E4 j0 o- B6 f9 D( ] - * This program is free software; you can redistribute it and/or
5 M T7 @! P9 f5 W2 R - * modify it under the terms of the GNU General Public License as
1 [& v5 k! E' V0 n# M" F% q - * published by the Free Software Foundation version 2.8 y; N2 i& I2 e# M) k3 M7 n Z
- *# ^: f: H9 @: ^2 }0 i0 Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ s. v) o! n6 }# R4 a g
- * kind, whether express or implied; without even the implied warranty
3 ?7 j; d+ L- q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: @, P8 B* p" ^* e - * GNU General Public License for more details.
: u% r7 q: ~2 x) Y5 x3 U. Y - */
; \0 h8 \0 G) e6 k& r% a+ Y9 T$ \ - 0 N, a$ h. G2 F' S- C( N
- #include <linux/module.h>
( h. L7 K( k$ H* J, h - #include <linux/init.h>, J @* @; }# n
- #include <linux/errno.h># r/ ]; Z$ s* R; m
- #include <linux/types.h>
5 b0 d# `: r; }. N0 W" I - #include <linux/interrupt.h>% Q* [% _6 Z: U, g7 q3 N; h( _
- #include <asm/io.h>
/ _% g1 W( k" |* w2 }$ {5 S - #include <linux/moduleparam.h>
1 K3 G$ X K J1 P - #include <linux/sysctl.h>
! z0 a. h8 A% S9 |$ e4 J" j% j& ? - #include <linux/mm.h>
8 l9 i' J) u' D0 E: X - #include <linux/dma-mapping.h>( r7 F" q W2 [# l5 Q- s
- * j/ N# X% W' S/ c$ H7 K5 O
- #include <mach/memory.h>
/ s b! Y7 |& o( Z' U2 m - #include <mach/hardware.h>: _% c3 z# a' D9 r% [# X
- #include <mach/irqs.h>
* B4 I, M( W! I! ~, K - #include <asm/hardware/edma.h>
0 F, q+ G4 v$ g( l
; V0 x' O8 \; B6 l- #undef EDMA3_DEBUG- m: h7 p0 l7 j" r3 y6 Z
- /*#define EDMA3_DEBUG*/
$ [$ P7 a0 @; R - $ ~9 h% M$ ?* O. {5 B$ u" ~* Z6 Z# |, M
- #ifdef EDMA3_DEBUG
3 x q; B* K$ j8 a! D/ C) V5 X9 F& w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ b- }+ w6 R h8 x% k9 I( y, m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 b. G. f5 \" h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! c& I8 {; B0 G' X - #else
6 [% y, C$ k$ {- s$ @9 h% D' u" f - #define DMA_PRINTK( x... )9 x7 n& Z* s% w$ o' s$ _+ S
- #define DMA_FN_IN
+ ^. x! p1 O# S5 ~& w - #define DMA_FN_OUT
, D& ]0 D* m; R6 n - #endif
5 F* g8 z h1 [3 F; d - ) G( N$ Q! s( d( K) y1 }6 w. h' l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# Q% N, }, j9 ~' t9 N - #define STATIC_SHIFT 3
6 _; M+ S( T! | - #define TCINTEN_SHIFT 200 x" ^6 I! o1 ]$ o
- #define ITCINTEN_SHIFT 21
% t. B0 u2 _ a - #define TCCHEN_SHIFT 22
, w' |; z: G( t" L8 q U - #define ITCCHEN_SHIFT 23
% _9 e8 l+ C5 l- S9 k) b/ m4 Y6 g% g - 6 D. c% O1 q3 f* L
- static volatile int irqraised1 = 0;
; R+ e; }0 T8 ]+ B8 M( I - static volatile int irqraised2 = 0;) S/ }4 D+ a7 ]. ^# v) B
- 5 v6 M5 e4 F; ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) s$ S8 t2 R# r' E+ A7 n5 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 o$ o, ^. A( z7 K/ K. k" n - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, ~6 K x/ o) }/ A4 g$ Q0 n' {
! S4 ^9 a1 u# t( a- dma_addr_t dmaphyssrc1 = 0;
2 q* O/ w; r$ h1 |6 M - dma_addr_t dmaphyssrc2 = 0;
+ h2 P. z" `" w V( p& u - dma_addr_t dmaphysdest1 = 0;$ Q, y" U1 O k6 |1 N
- dma_addr_t dmaphysdest2 = 0;# c2 @' U( _! }, [; w7 y
. E. u; m: p& }6 V: B2 E- char *dmabufsrc1 = NULL;# I. a. s; O3 m& [% j
- char *dmabufsrc2 = NULL;$ {! w7 Y) E8 G% ?" z
- char *dmabufdest1 = NULL;4 w. C- h2 g. s: ~3 a* z! \. l; E
- char *dmabufdest2 = NULL;( y( d8 O5 P' l Z9 G. r
, D5 Y* C! r8 I0 _' m3 L! X% T$ p/ p- static int acnt = 512;
; C. {' G+ f& R - static int bcnt = 8;% M$ C, P# I4 z1 C
- static int ccnt = 8;1 M, U/ w. s1 E2 h* p
5 p. ?8 g) A4 o' Z- module_param(acnt, int, S_IRUGO);' m; C) V2 w9 {8 A0 [; D
- module_param(bcnt, int, S_IRUGO);9 ~2 ]# |. u: A2 ]3 g& N3 N
- module_param(ccnt, int, S_IRUGO);
复制代码 8 @/ i0 u o7 D" a4 P' V
1 M' X( B- m- V- r5 g7 m, C5 ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# v {* B) S5 d" ]3 [6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& j5 Y& t! B0 K& u3 [ u3 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 [' d- |) N( D p/ c! Z# z8 H3 @% J0 B, y0 ?
3 ?* l, q6 p7 K# [# m2 `- g |
|