|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 g; j/ |8 e# {3 K- R' G/ S* T
- [code]EDMA sample test application
) {+ z; M0 o* b3 n4 @ - /*
$ u; U& r1 S7 q) F - * edma_test.c
: A0 A1 w( G. S% v! T - *
F4 P' ?6 S1 y - * brief EDMA3 Test Application5 W' ^8 F7 o! s- t% f* V: P- i
- *7 w8 N1 i0 g& d/ R* d
- * This file contains EDMA3 Test code.! ]3 c7 O. b2 e
- *
6 ^' P g$ Z* Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, I& p! I# R' n! r o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 F2 L# F$ B* R' G% q; G& j, J3 e6 k4 g - * TO CHANGE.
5 n6 k4 y; ?- K& J+ [5 G0 }6 ? - *$ i* p8 P; f4 T1 i1 T2 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 H2 t! o# m( L7 C - *' h9 W2 I' k/ l, A
- * This program is free software; you can redistribute it and/or
& n- H% G. g( a, J5 @1 I0 D - * modify it under the terms of the GNU General Public License as, {% B; g2 A) F
- * published by the Free Software Foundation version 2.
$ K% K. m& U8 l. ]. `3 p - *2 R$ S( \% y Y8 a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 ~' p( I0 X% N( Z x4 i5 d6 p - * kind, whether express or implied; without even the implied warranty2 a/ H4 O' z; X% k. z6 H0 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 E! U; M- n' m
- * GNU General Public License for more details.
; H0 I0 N, u; R# F, R2 |) e - */6 ]1 B; e5 t2 j% F5 u5 }1 T
- 2 w- \! `" Y0 ?, [/ [
- #include <linux/module.h>
f2 E, p8 C/ V( D5 L - #include <linux/init.h>
3 P7 E z! [: G - #include <linux/errno.h>
9 t7 Q) z! R! U3 e0 u# Y; G - #include <linux/types.h>
2 N0 K# f# j; ?* B& x6 z3 H3 `; s. w - #include <linux/interrupt.h>8 ^4 i9 M4 t+ w5 @0 i( j X
- #include <asm/io.h>
" ] p' g x! V) o* P/ x - #include <linux/moduleparam.h>
; o! ~+ i. ^ F+ Z - #include <linux/sysctl.h>
+ z( N! D* h. B7 w% b! h - #include <linux/mm.h>0 A" H" b$ Q* T
- #include <linux/dma-mapping.h>
8 Z+ B# J2 Z6 b( o
; P N, {$ X+ U- #include <mach/memory.h>
8 ?$ T/ \" U# H2 G% P# m- u5 E - #include <mach/hardware.h>+ i9 P% X. u& t& w& f# o1 F
- #include <mach/irqs.h>3 ?4 h; p- J9 h6 h% b
- #include <asm/hardware/edma.h>
. K! q% [3 D9 O# z7 ^7 T
% @0 F/ k$ G- r* |, C0 E( D& ]- #undef EDMA3_DEBUG1 M9 U6 D% j& x. b. S6 F
- /*#define EDMA3_DEBUG*/
3 ~6 k4 p1 h8 d z( l; }
) A5 k- q' `6 p a: s @- #ifdef EDMA3_DEBUG; _7 p0 A9 O2 l* ^0 K, E( t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# D+ _9 C6 V, Y1 V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 q! l) X5 j1 u7 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, A; D5 z2 J; W- C; u - #else
' H6 `; x: q, ? - #define DMA_PRINTK( x... )
. [( T! j |: U% Q! Y. H: E - #define DMA_FN_IN
# [3 x m1 ]+ V5 ?+ @% y7 U - #define DMA_FN_OUT
) Z+ Z+ |& Y* ]4 L& ^% V - #endif: W% h) h& E1 _- s
- 1 o/ G- Y! G0 H9 d2 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 W: `: b/ C5 }& j+ ~6 S; T
- #define STATIC_SHIFT 3- E' k7 O: K+ v7 \
- #define TCINTEN_SHIFT 205 R4 r k) O4 f
- #define ITCINTEN_SHIFT 21 M- u$ P5 j" `+ L
- #define TCCHEN_SHIFT 22
7 U& m# c6 s2 y - #define ITCCHEN_SHIFT 235 }6 \7 B* W. V E$ X& @
- 9 J1 F) |3 q2 a1 ?# O, L! o# e6 R
- static volatile int irqraised1 = 0;
, w" b$ h( u5 K; w9 J8 d - static volatile int irqraised2 = 0;4 g0 _0 I& V: y& B) S- u# Z
4 h/ V% H4 r& k* X- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! C# o4 U0 x6 C3 A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& F9 [( K0 V. P( o, s1 { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& j7 \# ?0 P' F1 k
: ]' d0 {( x4 t1 l1 t! _) v- dma_addr_t dmaphyssrc1 = 0;
9 t/ t. l' Y% ~" H9 F - dma_addr_t dmaphyssrc2 = 0;
) G! ]; h* ^+ s - dma_addr_t dmaphysdest1 = 0;5 J* I* O, r# l& q: v9 p; ^
- dma_addr_t dmaphysdest2 = 0;
+ g$ _) B R8 o7 X' o& I+ G - 4 r$ m5 o" g$ S( M# |
- char *dmabufsrc1 = NULL;2 C2 [2 O& L( c+ u8 D1 _ Z5 P# v8 x# a
- char *dmabufsrc2 = NULL;
, u" |9 ?- i9 U: J7 B( X - char *dmabufdest1 = NULL;
9 _* }# U7 [: m, S7 ` - char *dmabufdest2 = NULL;
6 r% W3 ]% v' g. k1 m1 D8 l
/ x4 U( r l2 ^$ f P- static int acnt = 512;! i9 I! a' Y/ L5 w
- static int bcnt = 8;
}) q' ~7 {+ j: _8 y- r+ R - static int ccnt = 8;
. e7 ]# J2 v7 o9 p3 q, Z) A/ q" B; n - % Y6 }, K3 ~1 W7 x% ^: [2 T
- module_param(acnt, int, S_IRUGO);
5 b+ H. u9 D/ j$ j7 e2 y+ t - module_param(bcnt, int, S_IRUGO);3 d+ Q% B% y% C2 }+ U! C
- module_param(ccnt, int, S_IRUGO);
复制代码 4 ?( C! H; {- J) E1 |. ^( `
, F' U+ c+ p3 C1 ~7 N. A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) c$ ^5 W. E4 v% k+ k% w y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 I# O! s+ B+ c5 @2 A
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- U5 j U8 _2 P) [; ? B* R4 K4 M& p& m# G1 n
7 m. G) Z1 g2 U- B; f `' b& J$ C2 E |
|