|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* e- j6 L2 a. t* T* K- [code]EDMA sample test application5 ?8 K% T/ N- h6 L8 ]
- /*
4 T& `, \; j/ Z! P: j& {. Y - * edma_test.c% H1 D: T) u* i7 P/ j
- *
/ ~8 S; a$ g1 @8 u" O* I - * brief EDMA3 Test Application5 l: k: r8 p) x0 F" u
- *! h5 h, J- ^. p# Y
- * This file contains EDMA3 Test code.- {8 r6 T8 g7 G7 o: i0 O$ j
- *3 w5 L5 r4 s! F. E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 E& y8 u, V9 e/ w2 z% M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 K2 ]' T7 I, I( O4 p
- * TO CHANGE.( u6 I- J8 A/ s7 R' U
- *7 n, {& B* O9 |2 T/ e6 P* o
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ E' z m# F' m, s9 u. d5 E/ W - *
$ N$ e/ t4 D! p: }) \ - * This program is free software; you can redistribute it and/or" V7 d% `4 ^' y; f$ N5 k- {
- * modify it under the terms of the GNU General Public License as# s$ u& G# D( x& }7 w) i
- * published by the Free Software Foundation version 2.- t, K2 Z5 R4 J0 o
- *+ B$ S2 {# x8 w* J& D5 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ j: E$ f8 p% }$ z4 Q& X/ P$ H- q - * kind, whether express or implied; without even the implied warranty9 A( D" [( x9 Z- ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 O7 n$ f- N( }- z - * GNU General Public License for more details.
0 F6 A0 |& W% x$ X N$ | - */! X% s( T1 S+ V9 \$ e" ^
- ( v2 h4 C0 G" P; g3 G1 B' Y0 V
- #include <linux/module.h>5 J% S! J& N1 _
- #include <linux/init.h>
3 O R) ^ E/ @1 ` - #include <linux/errno.h>% O2 F( L: [- \+ X$ u, X* c' |5 R& f
- #include <linux/types.h>
9 p' N2 S/ x5 [2 T* r! b9 y - #include <linux/interrupt.h>+ g- y, t# O y+ x0 d$ g
- #include <asm/io.h>
" E, ?# S! J0 I6 i ~7 A4 g - #include <linux/moduleparam.h>
! r1 k6 }, _( f8 E; } - #include <linux/sysctl.h>
) f* Y* I; u# K/ D% M - #include <linux/mm.h># C' x7 _0 b& c j
- #include <linux/dma-mapping.h>; Z" q" P& O, d. a" z8 `
- ! c9 N0 N4 K+ W6 ^& b
- #include <mach/memory.h>
5 [) X3 R, C7 c4 H5 u8 q8 M - #include <mach/hardware.h>( z0 ]8 E' \+ z; k) y
- #include <mach/irqs.h>
" @& w# ?5 ]# \ - #include <asm/hardware/edma.h>. E' |+ e: R1 Z( `$ T
1 ^/ [7 I. L2 I" V$ G+ m5 h+ M- #undef EDMA3_DEBUG7 J, q D- m. F
- /*#define EDMA3_DEBUG*/0 A0 ^9 \2 ?0 n% n' P) L5 m( Y8 ?
( p& C: y; ]0 }- #ifdef EDMA3_DEBUG0 P* R m, x% r# h T3 @: u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), I* ~5 W* Q( F1 \: q6 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) c5 p! T# \( g6 L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% Q* K6 Y8 P+ l1 L/ I* C - #else" N1 [ N7 Q; e; J- `' z% _
- #define DMA_PRINTK( x... )4 U* F6 B7 v# ?- `1 J c4 i
- #define DMA_FN_IN
j' s/ C0 R) R) i' E - #define DMA_FN_OUT
% K# L( M( N; P: c$ w - #endif: X" V* \; p% l# q( D; {0 V' l
- & [! H( H0 `) U" H) ^7 |5 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( I, M# X3 e7 A$ ~' b - #define STATIC_SHIFT 3
1 S4 m M u6 d" B; G% O; F - #define TCINTEN_SHIFT 20. @8 F/ G( P/ _) O
- #define ITCINTEN_SHIFT 21
% P& a/ C- a# t2 Y2 M - #define TCCHEN_SHIFT 22& N n8 [% Z' o! n2 U2 G+ T! B
- #define ITCCHEN_SHIFT 23
) E* @" X; X( v3 b- \0 K1 O% `" T
- T8 K" g2 e8 V$ Y' X- static volatile int irqraised1 = 0;* S! J; n5 p3 s `; w7 N, u/ R
- static volatile int irqraised2 = 0;
: i) _$ A# u- a1 s - # T, F0 Q h- w1 x- \: F1 F8 j' L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v* @8 @5 L8 g _, O0 X2 G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q' |/ n! m1 E/ f& X+ J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 k0 |* \1 [" z4 F9 R- {; l7 `
2 |% }& W0 T+ U% X! X- dma_addr_t dmaphyssrc1 = 0;; W# G# e% Z7 b5 J( g3 @
- dma_addr_t dmaphyssrc2 = 0;
! Y- U" y4 z6 L& u - dma_addr_t dmaphysdest1 = 0;8 R5 j" t" z+ H+ x/ B0 J% \
- dma_addr_t dmaphysdest2 = 0;! K: i% h; {2 L* _. w& T' g' ]
- ! g! p6 A1 x4 V) U- K: ^: G4 W
- char *dmabufsrc1 = NULL;
0 g0 G4 f* ^5 x i - char *dmabufsrc2 = NULL;
% x/ G& X; \; J# ?) w% Q) y - char *dmabufdest1 = NULL;9 l& U& W8 d& {: D9 }
- char *dmabufdest2 = NULL;
. H) p6 f& U% V6 ~& y$ X# ?
1 f/ b- j+ k; f0 d5 h- static int acnt = 512;
+ A) c& {3 o) G# s- B1 p - static int bcnt = 8;8 ~0 R, p7 J4 ^' q; s
- static int ccnt = 8;& R, ~# e9 \6 D7 F+ s3 Q# G
2 }) [6 u* Z& h" y% `4 T- module_param(acnt, int, S_IRUGO);* w2 u, H) B5 {2 b0 D- m; T
- module_param(bcnt, int, S_IRUGO);( }3 V8 E; C2 \$ }3 L
- module_param(ccnt, int, S_IRUGO);
复制代码 3 C; @7 e! F* C& i/ B
$ A* Z: F. t' l7 ]4 n
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' S" j+ i! E6 V8 v, l; b: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 X( W0 h1 P1 e: q k- n- p$ N/ F3 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 y& a* C9 ~, A3 \8 O0 g% x5 v' b8 \. B) V, ]! ]
$ b) u7 @- c U: N- K% a
|
|