|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! ?" c! b7 T/ d; x
- [code]EDMA sample test application) z- x: v! S+ P% g+ {! u5 q8 g( A
- /*
0 d: _2 [2 B. { - * edma_test.c
( j4 J( C* r* o7 @ - *
7 q! ?* e' M* Q8 i - * brief EDMA3 Test Application
3 M4 O8 c0 c% I7 D) ^9 S - *
8 Q* d: y, Y* J5 S! \7 B - * This file contains EDMA3 Test code.
0 S# A- H& V6 O- o1 u0 S - *
( |/ F% ^% Y/ Y6 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ g9 G* K7 {% B' v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 ?1 j( f/ H5 `- j U6 P - * TO CHANGE.
9 |2 L% D" K4 T+ I - *
/ i5 L: X4 J" @5 G i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, B; e4 G& L9 o$ ?1 q F7 | - *
P7 c# p8 X) P) u - * This program is free software; you can redistribute it and/or
4 F$ Y8 {: f3 [ - * modify it under the terms of the GNU General Public License as
$ a7 o4 j* u* L8 y" [# m3 x" e/ V4 @ - * published by the Free Software Foundation version 2., A: y, z" f/ ]# @% I# T! a" h6 b
- *& ?0 b+ L2 R: }- a# q" v7 x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& E! e# {0 B Q, H- y' a - * kind, whether express or implied; without even the implied warranty
' ]7 m1 O' C# I% n! j5 G; Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. q0 D9 I& Z) d/ A* O - * GNU General Public License for more details. Q! X2 ^" `% E( H
- */
7 ]) y. o3 j) m! M1 i" o
( e) P5 I; E% g- #include <linux/module.h>: @" K+ v- r7 R" `4 c
- #include <linux/init.h>
5 i# A* R! Y0 B& i7 k' O; V - #include <linux/errno.h>
- w% b' l9 m; o9 ^9 R! S8 a - #include <linux/types.h>1 d' G$ Z. s# }7 b
- #include <linux/interrupt.h>
) Z- s6 i8 K! E1 G' f9 h7 G/ x - #include <asm/io.h>: S* M u" `- F2 N5 _6 E# J+ A
- #include <linux/moduleparam.h>0 m o, O: y) i6 M2 v' A* ]
- #include <linux/sysctl.h>1 B- R: F' u' \, \( y G
- #include <linux/mm.h>
- X5 j0 J. ]% T7 w _5 Z: J9 V: W - #include <linux/dma-mapping.h>. {) D; r) b. h) e( @1 B
- 5 [ _3 S- d3 L' e0 w3 k
- #include <mach/memory.h>
, F$ \6 K# }$ {5 Z% L4 N - #include <mach/hardware.h>
+ R9 o+ P* z% r* I4 e. ` - #include <mach/irqs.h>
& q" ?: T# R( o - #include <asm/hardware/edma.h>
/ T- F- J! }. B: W - # I" r% l0 z7 O
- #undef EDMA3_DEBUG
: M+ l" p0 g! f6 V( | - /*#define EDMA3_DEBUG*/
# L: Y9 W" q. e8 W. M
$ ^7 K. Y- p# G% p$ T- #ifdef EDMA3_DEBUG
- ^& A( G! _. n5 f( K! y. x% Z1 X& \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* e* y; ~6 W0 G: a& r" t0 v# |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: W/ B, u$ t+ @- G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! g9 B+ Y# z m9 W6 ]! @
- #else8 l- N C3 j4 s1 Y! q
- #define DMA_PRINTK( x... )* |1 ?5 k4 ^4 Z2 U5 I; d4 u
- #define DMA_FN_IN
, {8 R- p& S" r7 Q9 \' c$ K - #define DMA_FN_OUT
& }8 Y: \3 P" B! v% a0 A - #endif9 i! \+ o3 v1 g0 U E
# h, n+ s6 Z2 V6 \% p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& b2 r' g# F4 d6 k$ Q' o - #define STATIC_SHIFT 3# ]) b7 S9 Q' ]: M' l" ^
- #define TCINTEN_SHIFT 20; i% }$ M0 b3 ^7 m3 ?: A
- #define ITCINTEN_SHIFT 21( m. g% @8 j1 c' j
- #define TCCHEN_SHIFT 229 V2 Q. f0 a f8 I. H6 s; w4 z
- #define ITCCHEN_SHIFT 23
0 B/ s6 N/ z8 a5 P- U$ I: [3 k; q
5 B5 p; f8 h9 D" o- static volatile int irqraised1 = 0;
5 K5 V* g) t* l: x - static volatile int irqraised2 = 0;
_" z& ?6 A9 ]! G
9 m- P) b5 b$ Z, [ G; z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 S# ?- z/ K, z( Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b2 G0 u" ?4 z% h# |+ k
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I! [9 r4 P/ _- }) w6 s F
* E1 H% L- o3 ~* O4 i- e- dma_addr_t dmaphyssrc1 = 0;
: O$ O; d4 h5 _* d - dma_addr_t dmaphyssrc2 = 0;( R9 x Z! T4 Y+ Q+ i: J
- dma_addr_t dmaphysdest1 = 0;( Z4 K' d( A. n0 ~/ N$ x( z4 t
- dma_addr_t dmaphysdest2 = 0;
" M/ c, {# }/ X" S5 ]
' I0 E2 F5 s p+ P3 w E$ W6 [6 |- char *dmabufsrc1 = NULL;6 h. t. q- O% C& m
- char *dmabufsrc2 = NULL;: H5 K0 M; N5 ]4 l1 T" g
- char *dmabufdest1 = NULL;
7 l4 C3 i0 F+ N1 G7 v6 O! ~$ ^# _ - char *dmabufdest2 = NULL;6 h7 r9 M% g* ^% p Q& U* s
- 3 ]& H; i5 l/ \
- static int acnt = 512;/ L" r1 u0 w" W
- static int bcnt = 8;
% l" M' @9 a3 X8 V0 N - static int ccnt = 8;
6 d# r/ R' y" u, |6 t) } - ! ~8 s+ D2 D4 W5 S% \* ~4 A4 Q
- module_param(acnt, int, S_IRUGO);
9 |) `/ r) f% j2 M - module_param(bcnt, int, S_IRUGO);
: _' L' j7 s2 y) O7 |, J% |" y - module_param(ccnt, int, S_IRUGO);
复制代码 $ p! n4 Z) a Y9 b( Y8 q
, w; J6 V" b$ v! r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; r: V n/ y4 K7 Q! jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& V1 n3 C. \3 K% N4 z( y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; R# ~0 ?. R8 i0 E2 b2 J
$ m* y; ]; c* ` P' E) z; ?) s
* B! q1 `7 r) |1 c, A% w- w$ O* P5 M |
|