|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; @: W+ i$ b4 b- y0 |0 m: x
- [code]EDMA sample test application9 b3 x6 p/ O/ \+ P8 n) v% }- X# [; W: {
- /*5 \# G2 ~( ^0 s9 k) O" _/ Y
- * edma_test.c. Z1 F( D' N9 N% p, G% }0 w
- *# i4 E1 D0 p9 m8 b. L+ X. U9 Z6 O
- * brief EDMA3 Test Application' q5 N& L; F$ k" h
- *3 Z( y* Q& R' J, y7 N- _
- * This file contains EDMA3 Test code.- z. o) j1 |- j) v: f& I5 e3 U
- *- |3 |8 [$ S( |/ t- q; N- l! B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 \: }% J. N4 y/ e- ]: J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 y8 u: [4 Q' U; \1 g& u - * TO CHANGE.
6 f- F( W& Q- H3 ~8 M: D( } - *: B, U# ] F7 ~2 a( X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ C' Y% d' Q( m& Z5 R' n - *
7 M8 ~: h/ L; }/ t1 u y: @ - * This program is free software; you can redistribute it and/or9 d, ` ^+ M A3 K0 L4 T& F
- * modify it under the terms of the GNU General Public License as8 v) w( t0 ^- p4 Z) i6 S2 D" B
- * published by the Free Software Foundation version 2.
& W- f. }: m {" o2 z - *
8 S/ K' [* l" c. K2 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any' ^1 X' t2 R# f
- * kind, whether express or implied; without even the implied warranty
% e2 [; Y$ v3 N' e( q: n& h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 z0 l8 U. @+ O5 B5 x - * GNU General Public License for more details.
6 Z) U7 M4 S$ I4 u - */7 J2 Y9 u/ d' z+ ?' G% a# o
- , s, {# t1 W9 Z# b; ?/ o
- #include <linux/module.h># m) X0 E) ]% f, ?/ J) ~
- #include <linux/init.h>
. ~; q+ V, c* b9 w' n. I - #include <linux/errno.h>/ _# j p9 |) w
- #include <linux/types.h>
3 v6 r8 y f0 F4 ]. V j$ X - #include <linux/interrupt.h>5 k4 U9 ?9 a# ?1 `5 }6 d, R
- #include <asm/io.h>
4 h+ {) U( x* Y. u - #include <linux/moduleparam.h>
7 S6 u* _& u& c2 `' u+ @ - #include <linux/sysctl.h>
& l$ Z$ q" D$ T - #include <linux/mm.h>
$ L1 O: N7 h% S7 l f - #include <linux/dma-mapping.h>, ~) ^9 @: x7 A, w# Z: z
- - T/ {% G; T2 z9 B4 y3 i" I
- #include <mach/memory.h>" g. g$ H1 w7 f S) u: ]& L/ L
- #include <mach/hardware.h>
. C2 X, J+ [) l& _4 F2 P1 m- Q8 x - #include <mach/irqs.h>
0 }0 M9 V" s: c8 `" m$ m - #include <asm/hardware/edma.h>
- L# b9 I# D+ \( \" s1 b - , t7 j p% U: |9 J: O
- #undef EDMA3_DEBUG0 o5 Y, U, p: H/ E
- /*#define EDMA3_DEBUG*/( h5 ?" L9 M6 q, V6 N
' i/ Y) R6 G. g6 y6 Q# M- #ifdef EDMA3_DEBUG
* \' _7 v8 p& k g+ L( w9 `( h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ X' j# Z& f O& i3 d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" q+ w2 J; [6 A0 g- f5 \" Z* ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! ^! {( e3 o! B0 \8 |; K/ P7 l - #else' P. ~+ a, n, S8 }) |6 P
- #define DMA_PRINTK( x... )" K1 y+ ^6 {, I {% P9 x
- #define DMA_FN_IN4 b4 J: x: y) h; }
- #define DMA_FN_OUT6 `+ `4 s3 R4 r7 E
- #endif
: e& g! d; M+ f% z) O; _# R
! d; a1 {( Q8 L) e% L- y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# w8 Y3 `" N" [+ ^% N
- #define STATIC_SHIFT 3& l) x* ]- M. @! x
- #define TCINTEN_SHIFT 20
3 j: X3 ]( k- S( T - #define ITCINTEN_SHIFT 21
; k# G' M: l- H - #define TCCHEN_SHIFT 22# L7 X0 o0 v- N1 {, J1 h& b7 X$ O1 i
- #define ITCCHEN_SHIFT 23
- j& N$ m. q( E$ B - $ P5 E% C' e0 Z
- static volatile int irqraised1 = 0;- N* `- _' e3 [
- static volatile int irqraised2 = 0;
$ s) ?6 l3 `7 D" F4 j
9 _8 T- ?" ?5 |" J' U0 D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, R: a7 D2 ?: `4 j- t" F1 |; F* ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, d0 g6 t# U6 L3 Z- v, \5 Z! x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [8 ?3 x% M1 g
- , F1 g* r6 v, ^2 X& m
- dma_addr_t dmaphyssrc1 = 0;6 r3 \$ W J! G
- dma_addr_t dmaphyssrc2 = 0;( m' @# C; i' |. j! P
- dma_addr_t dmaphysdest1 = 0;
! V5 ^+ z) I( y; @5 v/ w - dma_addr_t dmaphysdest2 = 0;% A8 G- `9 X5 |! S# _6 [$ V4 J K- [
) R3 [6 N' T& b7 d, n; h- char *dmabufsrc1 = NULL;$ g. p8 Q$ R& P) W7 Z+ X# B, _. h
- char *dmabufsrc2 = NULL;$ h$ k c7 B) A7 h2 K8 m8 K8 N L5 a7 H
- char *dmabufdest1 = NULL;' R8 u u" H g7 k3 f8 [5 \
- char *dmabufdest2 = NULL;
0 _+ ]0 s" E/ J
% E5 w/ [. C( T# R, `- static int acnt = 512;, F* x% L4 v( K5 I( N( T1 d* W
- static int bcnt = 8;6 J; {) Y! ? A* d
- static int ccnt = 8;$ t0 f7 K/ B' m( L. U
- 6 H" |3 b. b/ p& h* e8 O) H" T
- module_param(acnt, int, S_IRUGO);
# q0 M; j6 r, u) ^7 R - module_param(bcnt, int, S_IRUGO);; n5 @. G$ y" d' Z! p5 u6 _
- module_param(ccnt, int, S_IRUGO);
复制代码 % m- x& B& Z- u* k# v
0 y, i! |. s2 c4 I r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( j2 f7 d% V+ K( z* E) \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- E: b& K/ j4 [ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 u, q! W: A: H' O) `
* O- m1 S; F0 y# r1 `& r
+ {5 K" b( c6 \
|
|