|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ R- b7 E( z, o$ ~, O3 f1 {- [code]EDMA sample test application
& k9 d- T% C8 R - /*# e+ F7 [. B- U' \& K3 H' x
- * edma_test.c
4 B" t/ Y! ?$ }) y/ T2 \+ h! m - *
& N. X. R( A# C/ C+ e - * brief EDMA3 Test Application
/ c6 Z( n# J l0 o - *
, G% w7 E4 \, g - * This file contains EDMA3 Test code.6 O; a7 |! Y1 |7 z) t5 i
- *. e( g4 x/ W) \/ V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 b( x1 m2 M/ p* H0 [5 Z5 D7 c; d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 B& E0 w7 c- D! t5 o0 j - * TO CHANGE.
$ {* |! ]! _/ \$ I - *' c4 n3 i; V* y+ F0 P# r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 w# F1 `5 K- G - * J* x1 `! Y8 X8 A$ F" A) {
- * This program is free software; you can redistribute it and/or
# L0 l$ k8 g* E. N$ F1 T8 M6 o - * modify it under the terms of the GNU General Public License as
3 ? y$ B$ i" p# ~ Q - * published by the Free Software Foundation version 2.
i& l4 C- D7 X9 Q2 h - *
$ j% R' i( n" s" W( E- k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ H7 n- C, z0 ]7 ^5 J# g) f4 C
- * kind, whether express or implied; without even the implied warranty
/ Y' n; q3 F+ `, y' f& u. \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 C7 b X8 p- S ? }5 O# N; |9 N
- * GNU General Public License for more details.
) G7 ?" }5 U& Y - */
: e. {4 _; P b/ |1 m
, A0 w; a8 O2 G: V7 r- #include <linux/module.h>
0 c D3 Q9 z6 C0 g - #include <linux/init.h>. ~8 S: i# n. V) ~6 e* c: A
- #include <linux/errno.h>
# b* `: Z8 B v/ N- ?/ j - #include <linux/types.h>
0 n( m, m9 I6 H! Y - #include <linux/interrupt.h>2 [$ V% l, F$ ^' s
- #include <asm/io.h>4 d1 K% V/ A5 x7 s3 p
- #include <linux/moduleparam.h>/ E: F. x4 a( t! o
- #include <linux/sysctl.h>1 g0 x. R: O4 H8 E* l G! v) q
- #include <linux/mm.h>* J3 A* r: \1 z8 }
- #include <linux/dma-mapping.h>
1 i9 G3 |; B+ @! u# K; J - 8 j. f2 b, A( g
- #include <mach/memory.h>
: \% J6 a! O, x% P" q7 U$ k i2 i4 M - #include <mach/hardware.h>
3 S$ r) i9 }( N. k x3 m - #include <mach/irqs.h>
7 L6 p6 z; j4 R) P; i. d - #include <asm/hardware/edma.h>7 ?* H" m- y( M) v, ~' ?' n6 t9 U% p
- # N2 i* P: B# _7 W; |2 g
- #undef EDMA3_DEBUG
# Z. R& l& X& N: a - /*#define EDMA3_DEBUG*/
) p- ^. u- @$ ~2 V4 z
0 v, j* u* e/ `& j% R$ s- #ifdef EDMA3_DEBUG
/ P% Z- O* _) w+ c' N8 H \! W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 W* s9 m. C+ U4 B. Z; }# J5 \/ y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 P+ Q2 f. E" J% h - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) n. p, X h+ u# i/ ^% r - #else
$ l: S% E/ D( Y6 z, y - #define DMA_PRINTK( x... )
4 \# \9 H7 z4 d) O - #define DMA_FN_IN6 F. }: K0 R8 t( \9 B9 ?- ?
- #define DMA_FN_OUT F, P0 m5 ?3 y* O8 r; z8 @/ @
- #endif0 T2 t. ] u: k7 r3 z" c* q. B& A
( s3 ~6 f* c$ Z5 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 D- N+ b! ^3 ~/ r2 |* {
- #define STATIC_SHIFT 3
2 A \ F3 ^* f k6 R( G* B, R - #define TCINTEN_SHIFT 20& k- q. }. V$ b+ P5 k0 E5 K% d
- #define ITCINTEN_SHIFT 21; T% }& Y* d% \% t$ q
- #define TCCHEN_SHIFT 22
* Q# I7 M: s9 `" ^8 a - #define ITCCHEN_SHIFT 23, J/ f. s* g' u6 A' {( x
- & q$ D4 R( ]- e& j
- static volatile int irqraised1 = 0;' P' W6 h% N5 x/ D5 [
- static volatile int irqraised2 = 0;
' p& H4 N' p9 f& u; w - ; D) z" x6 {% h" Y4 v9 c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ T4 M# ?8 b+ q" w2 u! ?% b% o/ N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ _% @& \9 R2 W+ s2 K# r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( R' {: z, L5 J5 E( W* E
$ G: f$ P5 P3 M9 N- dma_addr_t dmaphyssrc1 = 0;
+ z: l8 t+ x. g4 z4 R9 N - dma_addr_t dmaphyssrc2 = 0;5 H& K5 g" i! v) D9 n3 M& Y
- dma_addr_t dmaphysdest1 = 0;
+ |. E# D( ?6 b r9 r! g! X - dma_addr_t dmaphysdest2 = 0;
0 f6 p( c( r+ c& ?- P+ M1 L. Y! p- k: i
$ o# t3 ?4 a3 _- char *dmabufsrc1 = NULL;$ y0 t1 K! A. u6 |& B; J
- char *dmabufsrc2 = NULL;
2 u* C' ^; a0 z3 ^$ W5 Z - char *dmabufdest1 = NULL;9 A% z( _' }) C! s- y, @# D4 c) r
- char *dmabufdest2 = NULL;
3 Q0 R. }7 M6 M$ ^
: a3 _" j7 H/ M- static int acnt = 512;8 \9 t H* c9 A7 A) L7 m4 F
- static int bcnt = 8;2 F$ |1 ]) p2 {3 }: D
- static int ccnt = 8;
: r5 ^2 [8 b- i% U r& U0 G( x% q
* ^$ T9 O4 {( j7 Q6 h- module_param(acnt, int, S_IRUGO);8 }6 @, W% V. S' B$ f& W2 v: V) i- I
- module_param(bcnt, int, S_IRUGO);0 ]7 U# p6 E0 x2 h6 A
- module_param(ccnt, int, S_IRUGO);
复制代码 6 T/ D2 ^5 H4 f \
0 R( ?0 @5 k& F) q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
U- K* I! Y0 v' marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- s# _9 }. B* u/ x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 E( Z, x8 Q/ n) c' ?
4 F. K" o1 ^0 `+ d$ s
0 \! {* H- g# M
|
|