|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 Y1 |& G6 Z" _8 I* g- [code]EDMA sample test application* \9 f- v' V r' M; G
- /*: C0 O7 o" b3 K$ s* Y3 K
- * edma_test.c5 Z1 p: G+ b6 W9 C
- *
% ]5 Z8 P8 e- ]! R4 b d - * brief EDMA3 Test Application
" \- Z' V8 R1 n8 @ t: k0 F% C - *
" h7 k2 d' r7 | - * This file contains EDMA3 Test code.
/ e4 m7 _: _; ` - *8 `, M: [. i$ f- Y/ v8 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ?; N$ C. i: s$ x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# _4 v' X; b2 U
- * TO CHANGE.
5 i V) A6 x, W- ~( U7 u - *
$ ~8 f: V$ u0 E) e( D) ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ], U( p/ Y* _+ p1 J# A
- *6 f$ C- {7 E" d8 v! m
- * This program is free software; you can redistribute it and/or
% u6 _( M" V2 p* N0 l - * modify it under the terms of the GNU General Public License as; B* n. r1 X7 M" k0 u6 v- H, }; T
- * published by the Free Software Foundation version 2.
0 ]9 d( d- E: ` ^7 C$ i - *. A @8 U4 c; z a2 u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 @8 A1 B$ o G; w/ Z - * kind, whether express or implied; without even the implied warranty6 C A: ]7 X/ J6 o" e+ I b. \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 O S9 k! G3 _
- * GNU General Public License for more details.
, v6 \# V& p( V$ V5 T, J, G: n - */
5 z7 j# d+ R( f8 O7 L i. ?2 [ - 7 m" Q0 p. j* \1 F, Z5 {8 w- |
- #include <linux/module.h>
% v. i: g9 [9 v, u9 g - #include <linux/init.h>: a* y4 x0 J3 Y
- #include <linux/errno.h>
; e G4 S: T) c& j* f6 N - #include <linux/types.h>
7 N0 s6 F' f$ } y4 W - #include <linux/interrupt.h>0 m4 M$ ]+ y% V% y6 z
- #include <asm/io.h>/ h! ` D" \. b! X- q, B# q) \
- #include <linux/moduleparam.h>
$ L% L) @6 N8 L' R: F! x - #include <linux/sysctl.h>5 m9 d0 X& g( N2 a! c
- #include <linux/mm.h>
; F# K% N2 X m3 i! X% L - #include <linux/dma-mapping.h>; E) W9 } U" y/ Q! `
0 B8 H7 R2 s0 d. p* Z7 u$ ] y- #include <mach/memory.h>
7 w3 ~' \, `" d7 x, L6 g - #include <mach/hardware.h>
% P0 `: A( ?/ s( Z2 [ - #include <mach/irqs.h>6 k0 V. G: O7 P8 N3 i
- #include <asm/hardware/edma.h>& f2 M# T2 V+ V4 _) ^. p8 u; x
- ( M1 O- l( j# a4 @
- #undef EDMA3_DEBUG' H2 k- R. l% y5 K: w8 Y, L
- /*#define EDMA3_DEBUG*/
3 a: i: k' A7 a0 I: @% V: G: }
" l: a+ \' D* C6 l; \ U- #ifdef EDMA3_DEBUG
3 k @3 T- J! x- u$ Z1 F( M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( ~( x2 k ^3 e. r: e+ e1 _5 P+ M$ g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 q& @/ a+ i8 C3 Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ C/ w, a7 S$ |& b& M - #else
( A, w: h1 Y q; Q% J. v D - #define DMA_PRINTK( x... )
# O1 @$ p3 W/ \1 w& k( a - #define DMA_FN_IN. c# O! r( S3 d6 z
- #define DMA_FN_OUT
4 Z; P; O( E) L2 }. p" Z q - #endif3 g# q$ N3 W" a
/ n' W p) `3 l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 g5 ~: y1 P& _' d0 J$ M# _ - #define STATIC_SHIFT 3 j1 D. g- N4 }0 b
- #define TCINTEN_SHIFT 20" h. D" s2 `: q! v
- #define ITCINTEN_SHIFT 21( z/ ~$ D7 U0 v1 G7 l; I" ?
- #define TCCHEN_SHIFT 22
3 |& L; V8 |% U7 j ? - #define ITCCHEN_SHIFT 23
V* T. j/ V0 X6 Q; N
- |' V: b: g9 V& Y- static volatile int irqraised1 = 0;; X5 ?6 d, q, k# n* ?
- static volatile int irqraised2 = 0;
% v) A2 S: T- n% R
' O0 E( M+ e5 C% z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* C: P$ H1 @. V% W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 o, q/ X1 u s7 m
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 v; d* p5 `$ S3 |3 t: A) v- s, R - 0 ~* ~3 ~! \$ }. T7 V
- dma_addr_t dmaphyssrc1 = 0;
# |0 }5 W! R! c0 u - dma_addr_t dmaphyssrc2 = 0;1 `9 w _' U; v) ~% K
- dma_addr_t dmaphysdest1 = 0;1 T: n7 {+ v: T8 W3 O
- dma_addr_t dmaphysdest2 = 0;+ Z4 O" T8 P1 i$ W& b) o
% t/ U @8 K; J$ ?# U e2 Y- char *dmabufsrc1 = NULL;0 a+ _* u$ f1 A+ o1 Z- i
- char *dmabufsrc2 = NULL;2 l" X( j, O; ]9 B9 o1 P
- char *dmabufdest1 = NULL;* H3 I: B* P5 C3 o4 T9 {% L
- char *dmabufdest2 = NULL;
% H1 h$ p( j! a& Q- v% B( n - 8 N T- _, F7 O: y1 K
- static int acnt = 512;
: D1 s" w' I. }2 P0 r - static int bcnt = 8; v+ l# b* O( K, l/ j; C
- static int ccnt = 8;
& I, b5 F; m5 O; P. e7 l* l
. l2 Q6 j; C1 S: s3 k, s7 l- module_param(acnt, int, S_IRUGO);
" g+ O& B& G4 u1 Y! i" n% k - module_param(bcnt, int, S_IRUGO);* s4 v) y$ L9 o9 n" i
- module_param(ccnt, int, S_IRUGO);
复制代码 9 {( m. C) k# t, h9 s& g, ^
% [, _4 k" j2 L( Z5 E) g _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 P- N: k2 a6 a7 g$ N0 v; B
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* Y, ?" w; r6 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ?; h0 \" m3 F9 r
5 ]$ p& x0 G' m. b$ j9 Y. }+ j6 J3 v8 s% A4 x5 m3 Y; p. Z* v1 D
|
|