|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 b0 G" f& B3 G) |* S! Q! A6 t- [code]EDMA sample test application/ \( F- j' N/ f6 |/ h
- /*
" @: ]9 s' ^8 V: K! M" U. M p! D - * edma_test.c) t& H4 P; s g" G
- *7 h7 k2 n( C3 A, A' i: C+ f" r! P
- * brief EDMA3 Test Application F: O! T6 `/ p7 C+ U
- *
/ R0 l6 E. F. M: A9 K" I9 O - * This file contains EDMA3 Test code.) M8 B u* u: Q; Z4 D
- *" J3 T _# u# J2 } k+ P) b8 ]: b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* n* l; F8 n! e3 U- C# H) ^% R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) E4 e' v* G3 Q% E$ [6 @( y$ {
- * TO CHANGE.$ k3 h. o0 h6 c- | w! L) d
- *
4 s% ] q6 T2 C$ v3 w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 G6 q# D5 W3 k# I/ h, A6 V# d
- *
9 p% m$ W2 H2 k) a) F. I - * This program is free software; you can redistribute it and/or' o# q( K% O* e% d5 W& \
- * modify it under the terms of the GNU General Public License as
; \. P( g$ r+ ^ - * published by the Free Software Foundation version 2.
, F8 ~2 F. O, S& l; G - *
! A" n* F# R$ d0 D8 H$ O, I% w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! d& O( [! ^) l7 S/ d
- * kind, whether express or implied; without even the implied warranty
2 q, `; G, U* P( X& }) C# M, s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 v0 X* w' c0 Z9 ]( D* |6 q - * GNU General Public License for more details.
/ F) C# u6 h( z4 X - */( B1 G8 C! U5 s
- - U" B& }: y& p/ E9 g5 |5 E
- #include <linux/module.h>
+ `4 t; {! x7 ]' N - #include <linux/init.h>3 Y, Q% F: \5 y, `
- #include <linux/errno.h>
3 L# X4 G: x4 t3 }$ n4 W, z M9 l - #include <linux/types.h>
: N) Z! @6 p3 G* K* I4 s6 M: D - #include <linux/interrupt.h>* w! U+ q5 E" q e) w% H
- #include <asm/io.h>. f, q, Q) }: O, y2 ~5 z+ t! I# q
- #include <linux/moduleparam.h>, E: C w6 [" t; p7 n- W
- #include <linux/sysctl.h>! n2 t& c' x+ E0 @1 T! b- @
- #include <linux/mm.h>
( J* M( h' U( }2 c0 ?- Z - #include <linux/dma-mapping.h>
. h/ K" p }3 x' Q5 u3 g E - H- G# O: B2 W
- #include <mach/memory.h>. ~* e- F7 z! x8 d
- #include <mach/hardware.h>3 e7 P: \' L% T. k! C, n
- #include <mach/irqs.h>
% ]" L# y6 j7 `# U - #include <asm/hardware/edma.h>
" `; A- r }9 Y8 _" W8 R - # a! H, x" ?% `7 k6 }, M; r7 K( D3 F
- #undef EDMA3_DEBUG* \8 q" Q9 x8 X% M8 [* O7 \
- /*#define EDMA3_DEBUG*/1 L( T8 T6 A/ C: S1 ^
* J6 X2 q# N" ?% n( P: a; g- #ifdef EDMA3_DEBUG
9 j9 X& s8 N* @ X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- g9 W( _! _( ?! t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) n4 B0 f' ]8 d. z0 t& ?( o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 [# [, P0 @/ D+ ^$ C7 `6 X - #else/ q& r' w7 v: U1 D' C. C
- #define DMA_PRINTK( x... ) [. V8 ~, ]' |; H3 c
- #define DMA_FN_IN
/ L- n: Y8 I, d - #define DMA_FN_OUT
3 X. \6 d. z2 j7 ~: H - #endif
! f6 A ^' p/ ?$ _. M
: a# A$ s( Z2 ?2 W9 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 ? P" \; z9 ~) p0 r: Q8 [. y: ] - #define STATIC_SHIFT 3
! o, z" A) C% _$ n- t6 `; R- g - #define TCINTEN_SHIFT 20' n8 N* i& Y& m$ q+ D
- #define ITCINTEN_SHIFT 21
3 h+ F* n) C5 L" N! `. m - #define TCCHEN_SHIFT 22" \8 o9 Q* P; H6 W3 [+ r! Q
- #define ITCCHEN_SHIFT 23
7 p+ x* i% H5 ~ - * }" O8 l( ^, f/ C
- static volatile int irqraised1 = 0;1 C1 K& {9 C1 g2 K0 R7 U
- static volatile int irqraised2 = 0;# p$ ]. {( A* S( q5 m# I1 ^
- - ], A$ f3 L3 `+ h: C2 V/ f# }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D: ]: H0 u3 W, i0 P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 _# e- ~" G7 J$ k* s2 v9 Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 I# G9 O. h m6 z3 y, |- n
- `% G, i& ]4 \0 H6 b- dma_addr_t dmaphyssrc1 = 0;
6 M/ F) J4 B; z - dma_addr_t dmaphyssrc2 = 0;
' I) u [4 Z: N. l - dma_addr_t dmaphysdest1 = 0;
1 j( y4 l; t9 ^" g2 {) ^! S - dma_addr_t dmaphysdest2 = 0;; R. l( t6 y" ]1 o- w% w, L0 Y
5 ]' H; P( w) k: p6 B- char *dmabufsrc1 = NULL;, ]. a3 R# b) I% `+ }
- char *dmabufsrc2 = NULL;
% B4 G6 N7 q/ V9 k/ ~6 m+ b$ S6 n - char *dmabufdest1 = NULL;- H4 L4 H9 a; o& D: q
- char *dmabufdest2 = NULL;
# \0 T [* |; ~8 V
- k) V$ V- ^0 {- q, q: I- static int acnt = 512;# a: d0 c6 |/ ~6 [# a* ^
- static int bcnt = 8;
\! \; { i4 g) O& k/ l' j- F9 ] - static int ccnt = 8;
2 O. L" K# s2 x" N
1 }/ F1 W7 N, p$ V$ A& R8 R- module_param(acnt, int, S_IRUGO);8 K& z, a0 o1 t$ x4 L+ c9 H
- module_param(bcnt, int, S_IRUGO);
) c6 {& K& ~, u5 f: b- b - module_param(ccnt, int, S_IRUGO);
复制代码 # Z5 E% @) A% i- K7 p
9 @8 {6 }) S) [! {1 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# A2 K/ Y5 k% Q% ^0 L7 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% t7 g, m5 T; {" E& G2 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: U( D6 l$ J2 v5 _; ^: R2 K7 r
* a" D1 G j- M4 J4 G T |
|