|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 \7 u4 R8 ^4 F. S% x+ F1 d
- [code]EDMA sample test application
6 F8 D0 X& ?! |# W- `7 j - /*& y# W, P% s1 d6 a7 T9 s9 d) z) r( c) D
- * edma_test.c! t8 X* L8 K9 ^( n
- *; y1 u" d5 }, B0 M' h
- * brief EDMA3 Test Application
& T2 m. v! ?) t/ Q7 M4 s6 T - *: t" s1 u, F& o( g" p2 C4 G) O
- * This file contains EDMA3 Test code.! l" C( E# }8 `& R [8 W) J
- *
* n5 e2 [' m" g4 X4 I& A. t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 f6 r8 h7 \5 b, n8 M) O4 e. W! ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 n: [7 r( C8 r( P - * TO CHANGE.
9 V* l: o1 Y/ V0 d7 E; L9 m2 v - *
9 |, i# |9 i" `! A9 k9 h( l: i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' @2 X Q& L9 n% f$ z0 ]/ F
- *1 q- u/ E ]' W" ?& B7 J
- * This program is free software; you can redistribute it and/or X( V+ j, r. {) O% y
- * modify it under the terms of the GNU General Public License as
3 J. R3 c3 D; d x - * published by the Free Software Foundation version 2.* b) l( z: a0 u8 |9 p; F& }; W
- *; v& A3 j, m+ S( M r# ]; ]7 L4 p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: L# y! \% W8 ?$ s2 w! ] - * kind, whether express or implied; without even the implied warranty
( _1 |4 v/ x5 V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
D4 ]: F: c' R9 m2 Z& k0 K - * GNU General Public License for more details.
) n2 z) q" I9 b( o - */, ^* i @* t- r2 l
. t- s( J8 z! {, ~- #include <linux/module.h>
0 Z: p" d1 C4 c$ V - #include <linux/init.h>( S7 z0 d2 D! u9 [2 [2 s: D
- #include <linux/errno.h>
; [$ K( s7 j5 h* f& } - #include <linux/types.h>
) E- J+ |% D5 T; m* W( M - #include <linux/interrupt.h>
6 m+ X( L7 s5 l/ ~+ v( U* M - #include <asm/io.h>9 }" a% L. m0 k t: f
- #include <linux/moduleparam.h>
1 I2 N; g* F" e# q" O) J/ g - #include <linux/sysctl.h>
* i; j$ _, p: p& v' U - #include <linux/mm.h>4 @2 O5 W) n& y) T
- #include <linux/dma-mapping.h>, \. V' x; P5 b# j
- $ y4 K. c: D& k
- #include <mach/memory.h>" p6 l0 ]" g7 i8 r0 r5 X
- #include <mach/hardware.h>
# c a8 _4 y# B: v8 `8 c4 } - #include <mach/irqs.h>- H2 p1 \" U Y8 O
- #include <asm/hardware/edma.h>, T* b6 s; c9 o: Y
- 1 c( n9 s2 i' J- g. T
- #undef EDMA3_DEBUG6 @) ~5 e) V, K- g6 [
- /*#define EDMA3_DEBUG*/1 ~' ?6 H: L; T U! ^& ^
; u/ K# C6 t, u5 I, e- #ifdef EDMA3_DEBUG
" \* s5 [0 l3 _2 d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ j; u# @+ L4 N5 Q& j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; C7 V& `, O: u" B+ \! G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 l5 s1 H1 }0 u2 t- }' p" [- r f - #else
|) c2 `( o% ~" c - #define DMA_PRINTK( x... )
* d/ O! z A8 \5 k4 I/ A- C, k - #define DMA_FN_IN
& t: [ Y- y# G* L1 x% t - #define DMA_FN_OUT
) e5 K0 M2 f% n1 Y - #endif/ B7 A4 L; N' ]
. b9 \8 o F/ F9 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 g/ H! i/ v R- `* y - #define STATIC_SHIFT 3. e4 ?! ~3 {) J5 T/ U3 x. O: `; M
- #define TCINTEN_SHIFT 20& {# B4 h& c" Y3 A0 ]
- #define ITCINTEN_SHIFT 21% F6 D* d3 `3 l+ ]
- #define TCCHEN_SHIFT 22
4 a. M+ e S) ^/ ? { - #define ITCCHEN_SHIFT 23/ G8 l+ i& N! Y9 w/ E( \
' E, i* ?) n+ m0 I p- a- static volatile int irqraised1 = 0;
7 x0 s; Q/ `6 f$ A: l; e# b" C - static volatile int irqraised2 = 0;# m: S9 J% N3 U$ M% L- F7 ~
0 K9 G( P& U) R+ H4 k$ H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, }; E6 V* s* r& i% {; Z2 t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" e9 E/ X8 B( X2 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ v" e& Y$ R" [# p4 [ - 5 }# y4 a2 t% K0 p
- dma_addr_t dmaphyssrc1 = 0;$ U" O! `, j7 i' g5 ~* z" k
- dma_addr_t dmaphyssrc2 = 0;+ q0 ~7 o0 D3 S* K$ v& b
- dma_addr_t dmaphysdest1 = 0;7 J+ q% W0 e( W, P4 B# O
- dma_addr_t dmaphysdest2 = 0;" g& K% x' Q7 c# ^+ x! T. n. g
$ O. \- E; x6 o! r) x q; {- char *dmabufsrc1 = NULL;
G( X4 e& r- y. {5 ~ - char *dmabufsrc2 = NULL;1 j8 [3 Q) k/ O4 Y* c- i; I# Y$ w) |
- char *dmabufdest1 = NULL; C8 `* f# e& ?! W3 A
- char *dmabufdest2 = NULL;
. u) J) I0 p: D8 O* _& ] - + y8 H1 V" X( k! D
- static int acnt = 512;* P0 L! D2 ]! U3 q: @
- static int bcnt = 8;
# W" U0 R4 N- T8 A. E - static int ccnt = 8;' i$ C. J" X- U( R; s( r2 `" n
! |& r2 E; t7 b: Y V7 ~8 ]- module_param(acnt, int, S_IRUGO);
3 q% P3 K/ b d, g9 i/ B - module_param(bcnt, int, S_IRUGO);
9 }0 U1 z1 H$ Q, z/ L - module_param(ccnt, int, S_IRUGO);
复制代码 9 l' Z' l" w+ F
% ^9 d/ V9 K' ?' o4 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- a, c, ^* m% m6 k3 F! K6 i0 h
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 b' w o5 {: V4 ^, D5 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( n: W1 J0 L/ O- z# _! @; p. K
0 _6 ?3 ?/ k; Y0 l5 O3 D. ~" o) @
: ~% [$ I1 x" ]7 L' R: R9 s |
|