|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 p# q* R8 D* I5 y) F; S
- [code]EDMA sample test application
% l! c P' Y+ E1 O' u5 x4 e - /*
: j# r! G* e# n) _5 g: Y0 u) P8 C: w - * edma_test.c) Q/ A- A0 l0 V4 C! |, T
- * c( K: n% `. O) ~- Q7 ^6 i
- * brief EDMA3 Test Application1 X* A2 `& _1 j. J
- *. V7 T( g( ]4 P8 C# n) Z" B
- * This file contains EDMA3 Test code.
% w2 W# T8 o: t5 {. k- c - *
# U+ s, ^0 s" o' Z. M3 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 A) a6 x% D/ {6 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! m% e: X, J, s0 K
- * TO CHANGE.
4 R& P* w7 G2 z% A - *! W) F$ P! P' ?; @. G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Q# A5 ?6 O3 T0 G. ?1 {8 f/ O
- *5 k9 [& I# j# ?2 w/ R/ o
- * This program is free software; you can redistribute it and/or
' c; \, e' O+ S- `; R3 g5 Y - * modify it under the terms of the GNU General Public License as0 J$ e" D% w5 _
- * published by the Free Software Foundation version 2. y8 @4 y% k: C7 e
- *
/ U* N; [. ?& H0 w& z3 P3 E4 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- f) C% W) t" r& T1 ? - * kind, whether express or implied; without even the implied warranty. ^5 E8 }2 P4 h7 ~/ [6 T: C3 d( s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 ?( U& h3 E9 p F' P; ]
- * GNU General Public License for more details.7 n& ^# ?5 j4 w7 {: B
- */
, {7 O$ p5 b# u. w3 Y4 m
+ `& [9 U1 L. Q- #include <linux/module.h>0 g1 V: x7 d7 h4 Y; c
- #include <linux/init.h>
1 \2 g' \/ b4 c/ z x$ L - #include <linux/errno.h>' q' Q- C" M/ Y; r+ g
- #include <linux/types.h>. G7 h- J0 P. p+ |- h
- #include <linux/interrupt.h>$ [% `4 j+ Z2 I4 t8 I3 e8 w/ C" b
- #include <asm/io.h>
9 ?/ w: P: e' [1 d - #include <linux/moduleparam.h>- C a" h/ y& m6 q6 K
- #include <linux/sysctl.h>
- K1 j+ H: x$ y4 I2 [7 h - #include <linux/mm.h>3 L( A( A7 r2 P" s ^" O& R
- #include <linux/dma-mapping.h>
( i% x% m& J5 I: z+ Q - 4 h2 l+ R, C# |0 D. q# w
- #include <mach/memory.h>( E7 h7 y% a, B$ F# |( d7 j( E
- #include <mach/hardware.h>
/ J4 d% Y. E- t/ @. c1 g+ f - #include <mach/irqs.h>" d& E2 w2 R' R, Q, f" I; |. w, a
- #include <asm/hardware/edma.h>
8 C3 B8 b: {1 x, w
+ j D! s+ q" y. S7 x1 m3 T, O- #undef EDMA3_DEBUG
' l. A n! R1 J4 g4 j( @# ?1 K( D! y - /*#define EDMA3_DEBUG*/& Y6 h! z. e$ b) X3 Y3 V9 b( w
: X* j9 J8 v0 v0 l4 t O- #ifdef EDMA3_DEBUG) e& H% @+ ]) i+ X; {8 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" M9 @% u' J+ U' D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 l0 X* r1 X% m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 r: ?0 ?# @3 Y+ i
- #else
) Y& F3 J: X0 b- G6 v0 R - #define DMA_PRINTK( x... ): w1 N9 }. K6 ` K1 [9 x+ Z+ e0 D
- #define DMA_FN_IN
/ O' T* e h/ F {0 x; G- I - #define DMA_FN_OUT
! r0 ~$ V- e E& W7 ]: B - #endif/ U G! ?- P, s7 z0 R6 Y
) {' r2 z/ A$ Z! ~: F( C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* x2 c4 p/ g. w0 y) c1 f7 i. }
- #define STATIC_SHIFT 31 _$ Z; S+ J: w9 V- r( l
- #define TCINTEN_SHIFT 20* Z" ~# [! R1 [" z
- #define ITCINTEN_SHIFT 21* R/ l8 A T: X( V b- f1 }0 t a: h% M
- #define TCCHEN_SHIFT 224 I) ]$ j7 j6 r" @/ h/ W2 o5 u
- #define ITCCHEN_SHIFT 23
% |( j, x z6 r7 f7 o) a2 s - ; J+ Q* x# ?0 c/ S/ a7 t/ ^
- static volatile int irqraised1 = 0;
! }' C1 i/ M, J& t3 j% `9 _ - static volatile int irqraised2 = 0;
. y: ^9 N( c# p* N
9 r6 y9 i9 c$ ^" @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- o w: x, l; W# z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: W9 L9 m$ \; z1 z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& C3 m. R1 r! r2 l! _
- 1 q+ q3 N6 [2 U; Y# H9 H
- dma_addr_t dmaphyssrc1 = 0;
1 s( e. T& S3 g- P7 }3 y - dma_addr_t dmaphyssrc2 = 0;
: A [3 g, A; h, @" x$ i! H9 l' G2 k - dma_addr_t dmaphysdest1 = 0;
+ {0 ~: I M" f5 e - dma_addr_t dmaphysdest2 = 0;
& T) a6 x8 h! Y% I, S
- O2 H8 l+ A8 |' ?( n- char *dmabufsrc1 = NULL;
4 ?, k+ E+ d* @( v: K - char *dmabufsrc2 = NULL;1 c* S0 ~" Y0 I
- char *dmabufdest1 = NULL;
* ?: C7 p5 M3 |8 \/ P, c! }/ E6 |; j - char *dmabufdest2 = NULL;+ a" l8 m4 k( {* m
$ f, X) u J$ F7 H% p- static int acnt = 512;
' S$ }- H+ v- G+ L# x9 T9 v - static int bcnt = 8;
+ d8 R: Y5 ?5 Y5 G: D, g - static int ccnt = 8;! U: \' R* H" t& F
, U% y2 J2 B; I: |' r6 r% ~$ Q, ~- module_param(acnt, int, S_IRUGO);
- y( x5 M8 o/ s( W - module_param(bcnt, int, S_IRUGO);
+ u/ V9 R, ~8 B/ w y - module_param(ccnt, int, S_IRUGO);
复制代码
7 n1 G3 T4 e: z* m/ f. ~! ^8 a# W$ t. f- k0 |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" ~5 W9 t6 @, W& M L+ O- Y% ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: M; F/ R6 b# N; A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% D; p; d3 S- b( ^! u
+ o! A# _$ X% o: a6 v" N5 T5 I, d% f4 B; g& I) R7 o' a
|
|