|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , E" y) Y+ u6 _. X: Z3 r) D
- [code]EDMA sample test application- O c' K& M- v1 n- B. r, D; g+ @
- /*
1 N2 Y; @+ A( c1 B - * edma_test.c
& Y0 A8 w3 I0 q& ?! w2 J, f& t - *; q; v# F5 D, |! B0 l1 |
- * brief EDMA3 Test Application) f' ~9 z- `) i: m d* B6 X: {
- *8 T# W- P& i- E1 k3 d) L
- * This file contains EDMA3 Test code.
0 p I+ o, w( I6 C* u5 m - ** D( x. [& Z8 b' v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) q N" C" L; h9 a6 W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* j: O# a3 b% j+ j9 Q. P7 I - * TO CHANGE.; Y1 ], `1 ?" _- P
- *
, c/ @" Q' H7 ~' D4 @! A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% {& l4 D) y7 ]1 K& [3 ~& Q" W; b - *
, {; r3 b7 R/ V- z+ g - * This program is free software; you can redistribute it and/or# R1 H" a' W7 M0 C
- * modify it under the terms of the GNU General Public License as
2 f9 h1 g* p% g% ? - * published by the Free Software Foundation version 2.
5 R% \ V& x @7 a* Q% d - *2 A% j( b, H7 }1 K, x2 l) i/ C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' h+ \7 X2 p/ N. i' C% e9 X' n - * kind, whether express or implied; without even the implied warranty
8 u) M& }2 ]! M: o$ u" A) z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# N# U2 l! n6 T
- * GNU General Public License for more details. E0 Q8 p# [9 o! L
- */- Q1 T% ?& x5 E7 e5 s; `! d
- 9 ?: t0 @/ a8 V) w
- #include <linux/module.h>
{9 G" e. E6 \; O4 [& d - #include <linux/init.h>
! u M) X' z, p+ l. j7 |( e - #include <linux/errno.h>
2 ~* R W* U8 w+ e: q5 @; Q' e - #include <linux/types.h>2 |3 D7 c- z- e/ r( b5 `9 `& z! T p# h
- #include <linux/interrupt.h>: `: e' O% A# H) q' j
- #include <asm/io.h>+ N$ _' d! e0 q5 I2 W
- #include <linux/moduleparam.h>0 E) l2 O3 ]/ g8 l) H
- #include <linux/sysctl.h>
+ F9 G2 y5 T# f9 W' N - #include <linux/mm.h>/ u. ^9 C3 y, w4 N
- #include <linux/dma-mapping.h>
- W* Q" e5 ^2 Q% M& f - - \( K V# O3 U! i
- #include <mach/memory.h>* ]0 s1 J- w! u, b# [- d
- #include <mach/hardware.h>
# s3 ~$ X1 I$ k - #include <mach/irqs.h>
6 N$ K: n1 [; L: Z - #include <asm/hardware/edma.h>
! Y P1 u& v' m( b! R
9 ~- i, M% ?9 S" I. y* f- #undef EDMA3_DEBUG
0 E7 k# ^; c' X" W - /*#define EDMA3_DEBUG*/
0 H2 B3 O8 G8 ~; ^5 G6 ]
# ^+ x) R2 I# `1 d0 V- #ifdef EDMA3_DEBUG
. g& N) C0 h7 @ I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ J) z! H0 x* v$ ^! T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" _9 r% A, T. z: p' g# Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' @+ v5 q$ [$ J m" V+ i! x5 `
- #else" p0 I9 H8 J* V% U, G, z; d4 W- f
- #define DMA_PRINTK( x... ) Q: m% A" c! f/ `' m
- #define DMA_FN_IN
: X: Z0 ~" M7 x# c - #define DMA_FN_OUT
* x; f- u3 G3 v9 ^6 a, `3 ~ - #endif
& [% M+ O! @' }& y+ [4 \1 K( s - ; o/ ]! E) E# |% e# f4 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 F( S4 C. ]% m1 }) S; x# P - #define STATIC_SHIFT 3. n6 u- g: E; a8 K6 I$ I
- #define TCINTEN_SHIFT 20
8 g/ Q5 o3 n" g O' {2 @4 f9 s - #define ITCINTEN_SHIFT 21
$ T7 R9 r6 Q7 Q6 A: R1 g6 L - #define TCCHEN_SHIFT 22
& M" p7 \5 X; M5 o - #define ITCCHEN_SHIFT 231 u+ A2 S9 t- P4 d
) c" s. O! W6 Z Y- static volatile int irqraised1 = 0;0 F+ A+ \# E" @( v: w- b& ^
- static volatile int irqraised2 = 0;
, _) C! ]( o/ N
1 g* y& g! G9 X' `* _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ~9 F$ h! b; C4 A4 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^ [6 j! G# W; V, v; n6 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 F C2 C3 M! v. \' w0 x
7 r r8 q( E( E; }3 W+ d- dma_addr_t dmaphyssrc1 = 0;3 y0 I- {) ]. A% }& }$ U5 B
- dma_addr_t dmaphyssrc2 = 0;
. [# b( x& v3 [; y - dma_addr_t dmaphysdest1 = 0;
2 _! R+ x& l: Q - dma_addr_t dmaphysdest2 = 0;
: u% O: H+ Z6 U: [
* ^; z6 E& A( y+ ^- j% z$ F- A6 T- char *dmabufsrc1 = NULL;) b9 \& z( _" ]8 R
- char *dmabufsrc2 = NULL;/ H3 _* C3 P* ?/ E E) l
- char *dmabufdest1 = NULL;6 X- w1 U, Z0 @8 ?* D1 ^2 x/ ~
- char *dmabufdest2 = NULL;
/ c9 g6 c, I' r( t - . t }2 u5 G6 C7 ]8 S9 s
- static int acnt = 512;
2 W/ v( W! }! C) D - static int bcnt = 8;$ ~+ K# C7 E5 G% [1 T; ^
- static int ccnt = 8;
9 j& _0 L" L/ m! z) k - * f5 k" h; G3 |, J2 U
- module_param(acnt, int, S_IRUGO);
0 Z8 L4 X2 @8 w6 ^- U* Q2 U/ [ - module_param(bcnt, int, S_IRUGO);- t: r' s- e: ^
- module_param(ccnt, int, S_IRUGO);
复制代码 % m: O4 R( A' Y n- {/ r, K6 Q
7 x: L! s U4 F# u$ g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" f: V( `6 n9 z/ c1 farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 A) ~( G7 k0 L1 p0 ]0 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ j7 E# t% R7 W2 M( R) M0 l
2 A9 e9 Y m1 e1 s
5 H, P5 x# R9 q* \ |
|