|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 @8 _( ~3 j2 u; i# v% Q- [code]EDMA sample test application
% F: l4 ?% n/ b/ W( g# E - /*/ S% }; W! L: R, V% h
- * edma_test.c: Q: M$ ^- G7 B2 s! N0 G. Z
- *
$ _9 n& |% F- b+ V# c( h& j - * brief EDMA3 Test Application
7 |& ^5 Q6 Y7 X8 f - */ |) _0 n" `1 ~# t: g$ C
- * This file contains EDMA3 Test code.4 Z( v6 }1 p( c$ A2 D: d
- *
5 O- f" b2 ?8 H5 }* v* j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 j& I2 v7 l' O/ }/ v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- A5 p2 R/ w' ?0 P8 n0 ^( L0 D
- * TO CHANGE.8 f3 b8 c) h9 P: S+ O
- *
' _+ u4 {/ V4 y# u7 ^8 r- _) X - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 c: F" v% S( G1 S1 y. O! M8 Z9 | - *
5 p0 u6 n9 M9 ^8 h# `; W2 p) K - * This program is free software; you can redistribute it and/or `/ H y$ G1 n9 O
- * modify it under the terms of the GNU General Public License as& V9 F4 ~* h9 `. q4 R
- * published by the Free Software Foundation version 2.
}' W/ [% V7 V. U) H - */ J& X. m1 @) C% y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 n# g* P$ E6 s& D7 ^; L1 T - * kind, whether express or implied; without even the implied warranty
7 x, v1 r7 h! W I& y! B: | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& \: c( q u- L* n& T/ I - * GNU General Public License for more details.
% `: G4 N% h6 `3 _ - */
) m% X" a% e# x! e8 e& F. | - 7 B' t7 a6 W7 |. Q" |
- #include <linux/module.h>+ g$ ~# }5 g& K6 d
- #include <linux/init.h>
- ?5 e. p! G) r6 P - #include <linux/errno.h>
7 M8 s- g5 [- e" i. N4 b9 N& }3 \' i - #include <linux/types.h>) s6 l4 m+ o! B/ y+ O
- #include <linux/interrupt.h>( [& ?- D! D5 B* m! q9 n
- #include <asm/io.h>
0 ]3 f! e/ V; |9 V" ^' r9 v! N( z - #include <linux/moduleparam.h>, _) U3 M4 o6 t/ ?$ S
- #include <linux/sysctl.h>
( P- L) J: }3 i - #include <linux/mm.h>
6 c6 e4 Q7 R" B* Z6 W - #include <linux/dma-mapping.h>
2 F0 z: {* `. g0 p6 D6 n2 ^5 q$ D: w7 ?
; `) L! R5 ?2 F$ c2 E' N: l9 _4 ?- #include <mach/memory.h>
t( s( x4 ?! D& }4 h* ^ |$ A - #include <mach/hardware.h>
- p$ K$ R* B& t# s: X B" Z - #include <mach/irqs.h>
- D2 |! l( v0 r4 c( D: D4 } - #include <asm/hardware/edma.h>% O- ?1 |& f4 O
8 c& ]4 e: A4 q. d- #undef EDMA3_DEBUG
2 _7 T8 y8 ]6 c y" |- { - /*#define EDMA3_DEBUG*/
5 ]( ~; B# h4 P1 O3 }+ v) } o9 E - , J* b' H. f4 {- ^- \
- #ifdef EDMA3_DEBUG
/ s9 n" k2 }- Q; @- f( I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 ~$ d! u9 K( R6 u) }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; v% g3 k2 m' ~& q* D% o( a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 @" U! O" w7 P' e7 m
- #else: y4 @3 y2 H$ ~" Y- N; U
- #define DMA_PRINTK( x... ); F/ ]$ s( V6 K" [- N& S
- #define DMA_FN_IN$ d# g. Y! a' R0 V; `. y
- #define DMA_FN_OUT5 I0 [7 l, O- O
- #endif
3 v, I5 P; g1 K: E - , t; L* r. j/ ~+ t1 F! n$ W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 a' A( A0 W/ l7 W6 N
- #define STATIC_SHIFT 33 L8 l [8 A) h1 P8 l
- #define TCINTEN_SHIFT 20
) m( A, n, X6 {6 z# E6 A# \) Q - #define ITCINTEN_SHIFT 21; k; T' h/ k ^* J) w1 u/ L
- #define TCCHEN_SHIFT 22
2 }4 y6 P# c# ` - #define ITCCHEN_SHIFT 23
4 O: ?7 M5 C7 A/ i* | - 5 D+ o* x* x1 B: |+ L8 J' }
- static volatile int irqraised1 = 0;+ B/ E6 w& V; ~; I* m- ~
- static volatile int irqraised2 = 0;
1 d: z+ | d3 f8 |2 D/ h
- q$ W, _$ c! g/ J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! A2 x, J$ u3 S: b5 Z8 j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& c; a& [8 c6 a3 {6 I4 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 V, u: b7 b H: f
- & j$ b% T H5 K8 x
- dma_addr_t dmaphyssrc1 = 0;# I5 i' f: E2 n' H. x
- dma_addr_t dmaphyssrc2 = 0;
6 @5 c6 o' K8 I6 f - dma_addr_t dmaphysdest1 = 0;
$ Y; X/ k+ v( P' O1 w - dma_addr_t dmaphysdest2 = 0;- ?8 k( Z, T& s+ i
0 e) k( d( v2 @1 e- char *dmabufsrc1 = NULL;
" t$ ^. u4 k' ~. @9 z a: B$ s5 L - char *dmabufsrc2 = NULL;/ t+ s4 s2 X/ P$ H3 w
- char *dmabufdest1 = NULL;; N8 P* \1 i) _) t( Y, k
- char *dmabufdest2 = NULL;; e6 o, t6 n6 t0 _; l; }
- , |! J5 q1 Z' w1 ?2 w
- static int acnt = 512;
& ~2 m0 @; _# n+ S s) _ - static int bcnt = 8;4 h% @/ r1 d; _" z; B8 q
- static int ccnt = 8;
% \. \5 w5 X4 R9 o& }
4 o& b+ q) v6 |8 Z' @& D8 @. M% ]- module_param(acnt, int, S_IRUGO);
3 h) Z* V1 K) l$ p7 p - module_param(bcnt, int, S_IRUGO);- T5 u* c+ I+ T' y4 N& N
- module_param(ccnt, int, S_IRUGO);
复制代码
2 t! V; j% H$ m( L
( S1 [ _4 M8 C# J0 o' b# \+ O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ o( Y5 T' Q3 ]0 q: Tarm-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 x: g3 ]) j4 P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 V' }& c- i) k4 W/ x7 O5 }
, M( U$ k- ?- B" @3 S9 O
. c* t% U; Y% R% ~ |
|