|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : T3 N3 J' W- K! u
- [code]EDMA sample test application- P0 [; U% I0 h0 x
- /** C' e2 Z. Z& s' z$ d0 T) y
- * edma_test.c
0 [( ]$ L# V$ s4 o. A9 ~& J) D& D7 r - *
( I4 t6 }+ i. L% I/ e1 | - * brief EDMA3 Test Application5 m6 F1 f- K8 T4 s& u$ `* O' R5 Q
- *& |( I+ O7 S! p" V
- * This file contains EDMA3 Test code.
% Y! M0 z8 f; S6 y% ] |. F - *
+ c: v( h9 w1 e% L& z& A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" ~! h- L: m6 r: y" P2 Q, T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ S: I4 {$ \% E8 q1 ]2 \# E1 h - * TO CHANGE.. y. B! S- L7 N2 u
- *" `' ]; F6 x( |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 G$ H" J. n) c) v* v
- *
6 N8 {: f% F; V1 F+ R1 | - * This program is free software; you can redistribute it and/or: E& B7 E4 `4 l" Z! N' k
- * modify it under the terms of the GNU General Public License as8 i& l: w* H) C9 K' ^' R: v% \
- * published by the Free Software Foundation version 2.
( R5 D/ G8 [$ ? - *
7 z( O, M* r5 v/ G' V# V& B1 E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: d5 `4 f- W& a# a& _0 f% D/ z! G - * kind, whether express or implied; without even the implied warranty
/ w! E8 N: q) y' g- i+ Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! F3 L# m7 c0 D4 ]5 n. {0 Y2 Y& b' J, T - * GNU General Public License for more details.
8 v X4 F$ [9 ?1 d/ @2 U- C - */
6 n/ L) N: p9 b* K1 c - # S2 {+ E+ l& D' G+ E. V
- #include <linux/module.h>' R3 i0 ?# ^1 V# H8 c
- #include <linux/init.h>& \/ |3 O$ D9 G7 Y7 h" d6 A3 d
- #include <linux/errno.h>
6 R- V- \* Q* p- J( _2 g - #include <linux/types.h>6 X: ~& d2 B7 p4 ]# E5 k
- #include <linux/interrupt.h>
+ u1 t/ O- _2 D E8 ^: o% b" ^ - #include <asm/io.h>
& I: S4 X; {# ?9 L! o - #include <linux/moduleparam.h>
7 f3 P: k! F8 z - #include <linux/sysctl.h>
2 m, d# _- l, X6 {+ L. g' v - #include <linux/mm.h>
/ F* k& c4 S4 N' m - #include <linux/dma-mapping.h>
! N. m, c/ p3 ? - . Z! j, t* U4 T/ }3 k
- #include <mach/memory.h>
0 M$ i1 q% _) t5 }! Z, f# q- ] - #include <mach/hardware.h>/ }5 o1 F y* Q. k7 ?% u' I" D9 l
- #include <mach/irqs.h>
) z6 b7 k$ ^/ E; [6 ~ - #include <asm/hardware/edma.h>0 C' B8 A' O" n3 w" x- y
9 C& K5 G6 g& B0 r% W' h- #undef EDMA3_DEBUG+ c4 f' H* g( V$ r2 r! |7 |
- /*#define EDMA3_DEBUG*/3 O- c' Y/ L2 t4 B
) n2 i# ?1 S, G7 b; t- #ifdef EDMA3_DEBUG v M# {2 {( {- m2 q$ Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ j) l" ?, J0 U- e% H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' y& S' T7 j3 y5 H D. X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& p6 m( l- u9 ?. l9 ^! n9 P# a - #else/ ]+ n8 U" s' C# I. U' s& s
- #define DMA_PRINTK( x... )
0 h Y9 R" h# |4 Y) x9 z* Q - #define DMA_FN_IN
% q. I4 w @1 ?. F - #define DMA_FN_OUT
9 q6 ^" g; Z! F6 L/ n% n - #endif
% ~& ^6 G" X2 r! w' _. T9 K - ! ]/ H) g6 S5 {; N% D _& R4 ~8 X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 a6 Z; Y S6 \5 T - #define STATIC_SHIFT 3
5 M) X+ q8 r% Q8 d4 C! [2 v - #define TCINTEN_SHIFT 20
& W$ O0 k% f# `! F - #define ITCINTEN_SHIFT 21; c+ Y. l' u; G2 Z7 |2 o W
- #define TCCHEN_SHIFT 22
9 l6 w, h4 Q9 h# Q - #define ITCCHEN_SHIFT 23
) i! y: ?1 R/ R* b4 ~& j
' s) i( f4 r8 u+ o* z- static volatile int irqraised1 = 0;. {8 V$ E7 R8 s# Z1 J9 F
- static volatile int irqraised2 = 0;
1 C# z9 ]' b5 X4 o( \ - 2 v$ N# L7 Y3 i/ J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# G9 M* E& N% j& g9 D+ l- N( j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# q* l3 D5 h& J4 i/ ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 P" i1 h) {3 _+ f! m/ m4 `5 v - ! R/ J7 }( i1 o0 }
- dma_addr_t dmaphyssrc1 = 0;: M2 J: k" z4 _+ w: h
- dma_addr_t dmaphyssrc2 = 0;
/ j: I2 s+ n* g! O7 h7 @; W# p - dma_addr_t dmaphysdest1 = 0;- b! j; K/ z; R" ~: [. Z8 g0 t4 _; H
- dma_addr_t dmaphysdest2 = 0;0 h- g" ?0 l+ A
- 1 ~5 h: g; p" ^4 s9 i
- char *dmabufsrc1 = NULL;3 a' P2 f' N) b& k# W+ ?
- char *dmabufsrc2 = NULL;
$ S9 s8 o+ t$ y$ O/ d - char *dmabufdest1 = NULL;
0 r3 M& H1 F& v2 T8 o - char *dmabufdest2 = NULL;
+ l& N' j O0 d/ R b: E* |3 U6 ^
7 |/ C' v: h2 ^ f8 M; p- static int acnt = 512;
: p; c6 i3 {1 w4 S - static int bcnt = 8;' |& Y# x3 d/ I) J" p! O
- static int ccnt = 8;
Q. l; A& l* _6 p+ M - 6 Z7 c6 d% D; _" x
- module_param(acnt, int, S_IRUGO);
% S1 J* f) B# E) M+ r - module_param(bcnt, int, S_IRUGO);+ J$ y+ }2 T! s$ L/ C
- module_param(ccnt, int, S_IRUGO);
复制代码 6 }; b! i; [' A' }2 ~6 q
3 u4 Q) b H' u, ] M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: K7 K9 I8 ~. p; q( Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ W' x" C/ y( ^) p0 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 {& E" r% D& E
. C! @: ~9 S. |. E% q
% w( n. V6 m$ e( B; j* a+ B" z
|
|