|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ T$ s! L# G( {3 h5 A( M- [code]EDMA sample test application
I2 l; X7 c- L4 d7 \ - /*0 f1 A4 t; B& c& x6 N
- * edma_test.c
- D2 B3 L0 }( a: m6 \ - *
8 d% G- E% U& U: U: L4 T8 Z: E - * brief EDMA3 Test Application
- O, c4 }; V" B+ X7 R( Y/ z - *
9 g4 K ~9 @! m - * This file contains EDMA3 Test code.* f( c1 i& h0 K9 W; q
- * B/ m5 _4 l) P' ?. Y7 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 A L( f; @2 k+ V# j. ^ ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, @$ c* e' I. N! q/ _) B0 Z, [
- * TO CHANGE.6 T" j- x# m7 b3 K8 m
- *
{3 U$ e4 U7 k6 E% ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: Y+ M O6 U0 G# \, | - *5 t0 {. x' Q* Z2 Z
- * This program is free software; you can redistribute it and/or0 k! D4 y8 a* p$ G i
- * modify it under the terms of the GNU General Public License as
- f2 s' K4 M" R+ v7 b - * published by the Free Software Foundation version 2. e, ?# L# u( r. R A, m: R1 e: t: e
- *, \5 b0 `* O7 b0 E; m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ^& T9 Y' w+ G4 p3 s
- * kind, whether express or implied; without even the implied warranty
9 S/ ]7 T9 w" M- b7 t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 t( x' w7 d% x
- * GNU General Public License for more details.$ L0 Y ^0 z/ _2 r- S" Q( Z
- */
+ l9 Q! r) {; _* l5 K
+ l: c9 @ V" I- #include <linux/module.h>
+ J0 d7 E( g- L2 u& [ - #include <linux/init.h>& g. g% |5 F. E! x2 w
- #include <linux/errno.h>5 n( L& m+ I$ {' `3 ]# V0 W) \2 `( O7 @
- #include <linux/types.h>
6 y) n, T: g: X - #include <linux/interrupt.h>
- ^. H) W; R h; _" w% r - #include <asm/io.h>7 x7 U2 Q8 `4 U0 t p+ {( o
- #include <linux/moduleparam.h>% r n `) Y; \3 p7 R
- #include <linux/sysctl.h>0 m e4 t& K1 j+ d
- #include <linux/mm.h>% u- B6 k; f' o9 x% Z& K4 P# g" K
- #include <linux/dma-mapping.h>
3 ^* H2 D: P. p6 Z4 N# v# T5 j, l
' c N& ]. y2 _' G1 h* B, R+ {$ Z- #include <mach/memory.h>5 d' c2 Q' b! d! h- G9 F) P3 j5 A
- #include <mach/hardware.h>
, |% w$ N( a8 u& d( P! U2 B - #include <mach/irqs.h>& S/ \: C# E6 b$ B& M
- #include <asm/hardware/edma.h>
" M8 }5 l3 L% x* D: s7 _8 Q* B, |4 S
6 g5 E, ]/ y- Z7 I" R+ }- #undef EDMA3_DEBUG; t, A7 v. F$ {) H1 ]
- /*#define EDMA3_DEBUG*/
* d, d- I5 c3 o - * u' u! d4 D( ^; p, `
- #ifdef EDMA3_DEBUG
7 p5 e7 ?) X; u3 m( f$ @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 Y% c$ A1 T6 s9 ?, A" R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! \1 p' l# v# A, G% w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) R% L+ F+ J/ _5 P7 k' b - #else
% m/ M4 Z7 w4 O5 g; q# b- } - #define DMA_PRINTK( x... )7 c+ a5 x4 w$ N+ t# x, m9 A
- #define DMA_FN_IN5 |$ E7 z* G# R8 [
- #define DMA_FN_OUT
. q B4 V9 s& b# } - #endif
4 Y$ m0 r$ [: o - 2 G; ~0 v9 N H# Q/ Q/ \$ R8 R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 }3 J1 z' R, x8 e- {7 e
- #define STATIC_SHIFT 3
, E5 w0 P+ F" |. F! i- y - #define TCINTEN_SHIFT 20: I4 ]* M- F' ~1 k1 ^# E2 U7 @+ J
- #define ITCINTEN_SHIFT 21
V! U. s& p, U7 F3 R) R& T - #define TCCHEN_SHIFT 22
, d9 H2 O2 j/ N- H; S* J - #define ITCCHEN_SHIFT 23
/ p3 u5 F; F5 j- l/ J9 a - & @+ [" n* R9 L. b
- static volatile int irqraised1 = 0;) [- i$ Y& F8 h. ?
- static volatile int irqraised2 = 0;
+ y% w! j. D* r0 K
1 c7 `9 f! }3 y5 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* K* u! P ?$ w }- v( S9 Q* ~0 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, u6 E! A9 b2 c: Q0 H' v6 {1 l) i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* S; B1 d$ y* T2 {$ `
+ V: ?8 W' ?! Z, u' t0 E4 _- dma_addr_t dmaphyssrc1 = 0;
) } c* Z7 `& V2 b - dma_addr_t dmaphyssrc2 = 0;
1 f* M$ M% b" J/ |/ x' `9 g - dma_addr_t dmaphysdest1 = 0;* [: {8 [% y4 l, f* @9 @7 I2 T
- dma_addr_t dmaphysdest2 = 0;- g+ u5 w, P" @3 s- P# Y- h
0 Z( @- ^& D" z6 l, ]' }) ~- char *dmabufsrc1 = NULL;
9 L; u' P( W- ]5 x4 V# g - char *dmabufsrc2 = NULL;0 d( b: e5 @ ^% x% D1 A
- char *dmabufdest1 = NULL;
% y) i1 x6 Y5 }, y - char *dmabufdest2 = NULL;- A. [. u( T$ C/ u5 f9 L
- ! J" |% M; T% }: }
- static int acnt = 512;
: D! |. x6 [7 }& z4 s - static int bcnt = 8;) t' G; y7 b7 E' Q6 u& A9 e
- static int ccnt = 8;
; {" B/ @$ v: g - 1 ]: s. z: ^6 L4 Y8 M
- module_param(acnt, int, S_IRUGO);% k% }+ ]" `" I: D
- module_param(bcnt, int, S_IRUGO);: T* h2 R+ t6 X; E6 r& Z' s
- module_param(ccnt, int, S_IRUGO);
复制代码 - u- U0 g$ I7 ?: z9 X6 e- ?
+ q( z3 U! f; K6 m2 w0 d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, G& l$ o+ D# N) V' k$ Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: V( Z; c/ s9 s# v. Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 t/ z9 @! J8 }# l8 i
f6 G3 P, S- @# j& q
% |( e8 P, H- o
|
|