|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 X) z/ W4 E$ n- i
- [code]EDMA sample test application; c |7 w) c; D
- /*
9 F* W; V! W6 o3 e% L# ^ - * edma_test.c
: J7 I4 J/ ^9 z2 D# U - *% ]' [# V# x# n+ {3 A% b- A
- * brief EDMA3 Test Application
! a# e% V! F8 w# \4 r7 v5 v - *; Z, q1 E; [% T) G9 T6 t p7 o. ~3 N) c
- * This file contains EDMA3 Test code.
* Y! R6 n' R' Z& J/ k - *
2 ~; c% Q# \, J; W+ L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) c/ c, J0 \' b/ _- r# K4 p% e/ l8 y0 h - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ p7 E8 b& j; P+ N, Z% ^ - * TO CHANGE.
& @) ^! V; G1 M% Y/ U - *( _5 _' l0 A* k7 l- E% w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 O3 c2 n# T5 ]- W. w: n t
- *
4 K3 [# W2 F: b9 D4 b - * This program is free software; you can redistribute it and/or7 z |; k$ u$ E/ e' t2 B5 a
- * modify it under the terms of the GNU General Public License as
3 B0 Z3 f' V- p3 `' h! t - * published by the Free Software Foundation version 2.
8 a$ u3 a/ g D - *
- b( `( I$ B( ~% A! r! X7 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* U3 _4 f' ^! m4 y
- * kind, whether express or implied; without even the implied warranty' X7 H" ]- s# w( ?9 }/ p o( l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: Z9 \% l# B- z; p, m) k - * GNU General Public License for more details.8 J) Z4 ?# ]& n6 z2 `, L* V$ e
- */; S% i' r. h$ ]( q$ a
- }6 S- p y. b+ U6 D- w
- #include <linux/module.h>
: k! G* _# b/ T7 w( q* O t8 a - #include <linux/init.h>' ^4 ~% ^3 @( ]* }( \( T) \6 M% B
- #include <linux/errno.h>7 P( p% Y3 p/ q
- #include <linux/types.h>) m; R: Z4 H9 C1 [9 n; n
- #include <linux/interrupt.h>+ v# P5 F! P& y9 }
- #include <asm/io.h>$ a4 C3 P. n: ], r3 n( i
- #include <linux/moduleparam.h>
% x" s5 C) i( X3 r - #include <linux/sysctl.h>7 a+ A2 e" D0 Q' @! i
- #include <linux/mm.h>
. S9 N) s, J. D1 R% O1 i& v( F - #include <linux/dma-mapping.h>
" p i+ p0 T& t8 K! s, g - z: t8 d; @7 \* y
- #include <mach/memory.h>4 \% S: ~7 t( t' e( E, r
- #include <mach/hardware.h>2 J$ ~8 I! S& ~5 `
- #include <mach/irqs.h># V0 }- u6 Z3 x7 G, w: ]0 \, a
- #include <asm/hardware/edma.h>
' {3 L" b6 `- }7 N$ O7 Y - 1 F/ U' s; [1 K: R, _3 M
- #undef EDMA3_DEBUG
4 B5 ?9 g7 j2 M( n7 K - /*#define EDMA3_DEBUG*/
g* L# D3 s) \8 t" v
/ W5 V7 e3 W+ b" @7 y6 I# e4 m- #ifdef EDMA3_DEBUG6 }. H( p* N, {, t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ D# n1 u7 C8 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 c V* d" ~0 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% \" O9 r$ D; p' B% Y& C8 i' ~1 _
- #else* v& o" X- F3 f/ c+ O* p T% y) j
- #define DMA_PRINTK( x... )
4 _2 l1 z/ u. b7 Z - #define DMA_FN_IN' n, T. y N' z9 [3 t; k. v
- #define DMA_FN_OUT
" Z% D2 B% m* R& I+ v A+ Z! e; w - #endif5 j+ i) A! `( Q( A& ~0 b a
- - j' P7 a( S" D" Z O+ B2 a# I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- k! \/ X6 s# j% Z: x
- #define STATIC_SHIFT 3
% g% w9 S p S' O' V- S! P0 C3 {" S - #define TCINTEN_SHIFT 20
/ E9 ?1 t! v# l2 j/ `/ L$ J1 W - #define ITCINTEN_SHIFT 210 i& u/ p, r6 B; L7 C8 y$ t
- #define TCCHEN_SHIFT 22
% V, O9 K" Y0 |2 k I; T - #define ITCCHEN_SHIFT 23
+ j' r+ [6 V/ v, Q - ; j* Z$ ?2 H; X7 A+ N
- static volatile int irqraised1 = 0;
, s+ X/ J. Z! ~3 b0 u3 S - static volatile int irqraised2 = 0;
5 j9 l9 `5 ?6 C W) i$ t' ^/ u- d: d - + M! S) l! ]8 P% k& t- G& y: E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% a0 F; o/ I( m3 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 k+ W$ b7 e/ }/ }+ D4 H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 @" {5 o5 X0 U
}+ F; @( Y+ x5 u- dma_addr_t dmaphyssrc1 = 0;) D% A: J0 ?# E5 M* c
- dma_addr_t dmaphyssrc2 = 0;
) x" W) M5 l3 h% m: R+ f, T - dma_addr_t dmaphysdest1 = 0;
: T$ f, M h7 m+ `4 ~' F - dma_addr_t dmaphysdest2 = 0;
4 k5 M. a3 f, J
) I; [8 p8 ?; t/ a S- char *dmabufsrc1 = NULL;
7 U% l' Y0 s: e* Z( t, A: Q, B - char *dmabufsrc2 = NULL;
( W, @+ x, B4 e7 e" x! n/ x9 v - char *dmabufdest1 = NULL;% f0 b8 E% P/ i. Z4 S
- char *dmabufdest2 = NULL;) Z7 Q0 V( O0 ~ f0 T+ s
( I1 N$ L7 @) a7 N' g6 f- static int acnt = 512;
. k& D, m/ j5 M" F, t" [ - static int bcnt = 8;; P2 I% u) H1 m3 _ v
- static int ccnt = 8;
" T" q2 q Q4 t6 ?, ~ - 3 P; ? B1 f* T
- module_param(acnt, int, S_IRUGO);" P- [( w" Y- I4 q. P% C. \3 t
- module_param(bcnt, int, S_IRUGO);+ v3 N5 P; g: S8 p
- module_param(ccnt, int, S_IRUGO);
复制代码
) \' Y+ @2 Y/ n/ `% c2 u" v1 Y1 j( j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ p0 w1 J- c0 S6 k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 J6 l2 \, D& x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 V6 {) O& D" g% i% E
5 x& Z, ? ?5 C, V" `* n
; W% r6 t; e, O9 k: F, x4 @ |
|