|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 N. e+ j s( L) z/ c# c1 A0 X- [code]EDMA sample test application# N) U d1 R0 Y* o5 E3 N
- /*- }% M+ h" ^3 s1 A, {8 J. ?$ H# Z
- * edma_test.c
% c# Q) }7 V5 l& D; `/ ]+ R. U" g$ s - *1 E, [* r6 F& X. S3 e+ }* J+ g! ^4 z
- * brief EDMA3 Test Application
) R# k# t4 v! [4 e - *9 ^& q+ }4 ~8 \7 W
- * This file contains EDMA3 Test code.
* e+ T- |$ x7 J. l - *& e" b/ H, @5 R$ B9 P. Q! g6 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 o: Y8 b6 O' H# ?# o( d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( b, \. ~* ~" a4 `. S
- * TO CHANGE.
* k2 @; H' w1 i) t* S+ ~ - *7 \; {& s5 S' S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 }+ |% [0 f4 z1 M* N. C3 T( A$ ^$ R
- *3 {& a9 H5 z4 H
- * This program is free software; you can redistribute it and/or9 d- L# e' n7 Q
- * modify it under the terms of the GNU General Public License as4 s* w' t3 o& C! J- o6 Z
- * published by the Free Software Foundation version 2., e! a( A/ y( A" ~9 O7 Z
- *- v% b7 T/ {, t! ^: C" m& f; m! _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 z2 D/ ~) y6 z
- * kind, whether express or implied; without even the implied warranty
4 ?9 P, q! k/ d- p( _5 { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 p' s: |7 r5 u% W - * GNU General Public License for more details.$ Z8 j" a. Y% p* K- p+ h
- */; [# S- A1 O2 q6 r* A' j8 J
2 c9 P" ]9 x$ e- v5 Q# P* L ^. w- #include <linux/module.h>9 K7 D, H! W9 R! m/ Y+ |& P
- #include <linux/init.h>
' C5 J6 S* F) A. f/ ^! P1 @ - #include <linux/errno.h>1 L/ c" N6 r- `
- #include <linux/types.h> `4 m r s( P! x$ w9 a1 l
- #include <linux/interrupt.h>
+ L4 Z# d( r9 u - #include <asm/io.h>
+ Y7 v4 L7 ~. u" w E - #include <linux/moduleparam.h>
# F4 r0 d$ I- w( e5 T) H$ o - #include <linux/sysctl.h>
! b3 x% _- j0 Z& \$ j0 b0 e - #include <linux/mm.h>7 S* e3 `% X, i, C. P: o7 R$ r
- #include <linux/dma-mapping.h>/ a; ?$ G/ U8 Z1 `+ X
% f s' a( c/ K- #include <mach/memory.h>7 c3 u# S: ~" M4 h! G
- #include <mach/hardware.h>4 Z5 `( M" a/ ^& }- i
- #include <mach/irqs.h>
: m |% b& T O% }# k0 T - #include <asm/hardware/edma.h>
- u( W X6 l. n) V1 q
. f( u. ~9 V7 ?4 L4 u q- #undef EDMA3_DEBUG+ V9 ?" E& b8 I2 m. s! [4 g7 c
- /*#define EDMA3_DEBUG*/) c4 V4 |5 g* S! P5 O
- 3 g n. H4 d2 O
- #ifdef EDMA3_DEBUG
P) W, y$ t5 v- A1 L2 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 p! T/ R7 l, Y+ F4 p" h: X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 \9 Y) A# L& s+ T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& S$ O" a- S/ ? y9 K6 Y- P s - #else, [+ V, j4 o; I1 f. l' j7 z
- #define DMA_PRINTK( x... )+ M0 k+ w% O7 [+ l8 G8 s
- #define DMA_FN_IN
2 ?7 s9 Q6 }* d6 [ - #define DMA_FN_OUT
6 J4 J# u! ~. v* s s) {) g - #endif
1 i- {5 h( v+ Q" n" u/ ?( `/ F
$ f0 X; K+ n' |" c: N/ K4 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 z' I0 J5 K9 }7 U% [ - #define STATIC_SHIFT 3) @; D2 Z8 k2 b
- #define TCINTEN_SHIFT 20
9 [9 E: J$ m4 d" c$ D# @ - #define ITCINTEN_SHIFT 21& w9 S' |/ _# l& b$ L
- #define TCCHEN_SHIFT 22: Y7 L7 x2 I' E4 i2 s& p m' D
- #define ITCCHEN_SHIFT 23. W8 A4 h6 C* B; D' x
- 2 `! t% \! D; ? R- w
- static volatile int irqraised1 = 0;
# C( O0 P' D, x$ M1 A# T; L3 x - static volatile int irqraised2 = 0;
1 B' u; e8 J+ l) f; f* c* r - ! j8 p! @3 W; t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 m1 K) r' H1 t C4 g6 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ [: W2 x% P: S& w- u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( k7 Z/ w' @- `2 s. m: i0 v
6 A. m, A' I3 x8 E& ?9 r! D- dma_addr_t dmaphyssrc1 = 0;
4 B2 `* |1 v) K3 H' d2 F% u- @7 Y - dma_addr_t dmaphyssrc2 = 0;$ m0 U8 I" `, ]* R) B7 ]0 a
- dma_addr_t dmaphysdest1 = 0;& G- f; I# T ~- h+ ^1 e
- dma_addr_t dmaphysdest2 = 0;6 }1 C+ U! w' ~, V# D
8 Q8 N/ _. V+ r- char *dmabufsrc1 = NULL;% i7 e" i, h4 x3 Z, `2 J) J
- char *dmabufsrc2 = NULL;
2 I( P( L' p/ s0 ~ - char *dmabufdest1 = NULL;
$ {# I3 L. d' G' ` V( z - char *dmabufdest2 = NULL;
0 c3 w! j) q3 j$ F. E( r- e - ; T; D* D$ N' C/ B' D* O4 B
- static int acnt = 512;: w: Z G- v+ S' F+ U. i
- static int bcnt = 8;& K. g3 ?' B1 {- L
- static int ccnt = 8;
7 c+ s& D" ], P8 f- |, N- { - : Z N# W. ~: F6 [ y/ U/ s
- module_param(acnt, int, S_IRUGO);
7 C* L9 R( i4 V9 d& ^ - module_param(bcnt, int, S_IRUGO);" w1 h3 u# d. h" f# ^
- module_param(ccnt, int, S_IRUGO);
复制代码
5 ~% \6 {- k) y9 t0 ]8 a; e7 g9 Y' L0 j" T8 X2 z$ U% z5 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 P9 i- B5 E! g0 O: w$ K/ R9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( v3 e3 S1 d8 e: m2 T 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; H- L' m3 w, V7 p/ \. a$ h
* t( m1 b$ M5 Q& K
9 c0 g5 \: ^6 v
|
|