|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ o: @+ S& S$ R, p- R- [code]EDMA sample test application3 G' g" }9 a1 D/ R' g: Y
- /*
8 q- `+ |* e" D* S% b - * edma_test.c; N; b1 {9 g C+ m( A# T
- * M$ C( c5 ?2 _* x9 d: J
- * brief EDMA3 Test Application
% B1 u' F% T, n) l0 u; S - *% [6 F- c1 X9 M3 [
- * This file contains EDMA3 Test code., C H5 w ]( L+ k0 D7 R- A* v' X+ ]
- *
8 H, q2 f$ y! Z) c/ s6 P4 ^5 d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! n; `( Z- B5 u7 ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# ^" v& U' c; L2 D2 x% Q - * TO CHANGE.
* F- g, r$ G; x1 M( V$ [4 @' b - *
' y' \5 V( _. ~9 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; q6 S7 E+ m/ ?! _/ c( j
- *, E9 f) Q' i' z/ [/ n; Z% B* ~, Z
- * This program is free software; you can redistribute it and/or/ h( X7 l/ r# X6 ~8 l
- * modify it under the terms of the GNU General Public License as
3 U7 ~& X4 I% A( S - * published by the Free Software Foundation version 2.
& C4 a) d$ g1 ?5 E - *9 V3 ]/ `8 J8 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" e, N$ u3 X2 O# u: q/ _9 {0 N! ? M
- * kind, whether express or implied; without even the implied warranty/ u- J/ H7 t( F" ^: t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! g& o S4 @9 z - * GNU General Public License for more details.) I% m2 i& h! s; _
- */) J& I( M D B+ F; L* }/ p6 ]/ \
- & X4 G! m! ?+ q# t9 M$ T4 l
- #include <linux/module.h>
4 o1 N( A9 C7 h9 X - #include <linux/init.h>/ ~3 d* F+ T4 ^1 I
- #include <linux/errno.h>* |! E, T) K" h. p, A- E6 h& j# q
- #include <linux/types.h>
+ o6 J& U9 G+ Z4 o8 {, N - #include <linux/interrupt.h>: R# s/ f, T0 ~! U6 f
- #include <asm/io.h>
3 j0 k. {) R6 k* |# _. k ? - #include <linux/moduleparam.h>& L7 b' B7 Y, `9 ]3 l
- #include <linux/sysctl.h>
4 P! v4 V) N1 D8 a3 t# K - #include <linux/mm.h>
- W9 J/ Z$ b( F: K+ H4 H - #include <linux/dma-mapping.h>
# W+ |8 M4 Q1 `: r2 n( ?" V! O
- f6 _4 o- x$ T. x- #include <mach/memory.h>
) H$ g; h0 Q- g" H5 e - #include <mach/hardware.h>
: h, N" x8 X# S0 @$ |8 Q - #include <mach/irqs.h>! b5 h& s, Z# H
- #include <asm/hardware/edma.h>
* D* H" U6 ]4 a9 Y' P! ~! c
q& |# r% Y. T) U- M6 Z- #undef EDMA3_DEBUG/ w' o9 @* }0 K' P# t2 q8 ~" g+ r
- /*#define EDMA3_DEBUG*/
" J# S( `) C& l$ M/ W
; a% p. N. K# x* Q+ A8 ]9 F- #ifdef EDMA3_DEBUG
( P+ a% J d8 T. S3 E, P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 r- | }7 k3 X! g' z, b5 d! H9 _- U! s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 P4 h+ H2 t+ x0 |8 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" t; ?2 Q( P |& R7 f V: o# M) F) c
- #else
5 q9 ?6 Y9 o- o' |: S7 H5 M - #define DMA_PRINTK( x... )
* k+ B5 G, j4 S( d) W# Q$ W/ ? - #define DMA_FN_IN
7 f. c9 K2 F; |; \# ~5 d+ O' Y* G - #define DMA_FN_OUT0 b1 L, r0 X( |& s8 R6 \: W6 @
- #endif
, ?/ X# S5 @7 @. a6 }, G% h: {
% b' D1 y- f( C X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ O$ V A8 }0 q9 a1 M - #define STATIC_SHIFT 3
9 t2 ?: X4 R) A - #define TCINTEN_SHIFT 20
( ~" u6 s0 M+ ~5 N - #define ITCINTEN_SHIFT 21 F; _8 C7 }* J) _
- #define TCCHEN_SHIFT 22& b# e! d, R5 T! n2 g# ^
- #define ITCCHEN_SHIFT 23* X4 @+ p0 v1 |3 q5 Q- a
- 7 l6 @5 X2 P* z4 e7 z& {: [
- static volatile int irqraised1 = 0;/ v8 G6 n; R# O1 ` g, |: b0 M
- static volatile int irqraised2 = 0;
8 ^" M$ r. G; p, i0 S- G% J
( T7 t0 _5 M/ I' E) n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ?3 o5 n0 u1 `8 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# n4 B+ h+ d0 B4 q+ @$ e5 _0 O8 \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& C3 `5 `0 C6 l1 Y6 x; y
& f* k- K7 z+ p z# p- dma_addr_t dmaphyssrc1 = 0;) d( W5 b9 L5 ?# F3 e( i5 E" Q
- dma_addr_t dmaphyssrc2 = 0;
4 G) B q7 n0 [- g& I - dma_addr_t dmaphysdest1 = 0;
3 h$ H. m* s( w- h! M - dma_addr_t dmaphysdest2 = 0;
1 P0 q2 O- `4 H. E& C - : ]7 B2 L1 U- J' f
- char *dmabufsrc1 = NULL;: k' j* q5 K1 u7 u3 H
- char *dmabufsrc2 = NULL;/ Q* e. _+ {; e* V1 ?
- char *dmabufdest1 = NULL;
3 A/ U! n6 u7 D$ d( F1 [5 |" } - char *dmabufdest2 = NULL;
- x9 J' d& W' w( h9 x! {5 j. I; I - + ~$ ^# y+ `. x, A/ V7 ^! g4 F
- static int acnt = 512;
- g$ m$ l; F6 c& C, C - static int bcnt = 8;
$ f" H2 M- i2 ], T A2 P - static int ccnt = 8;
- N9 j9 Y) e6 ~, k - . ~ _! S1 ]1 e
- module_param(acnt, int, S_IRUGO);2 j |2 Z+ _( z
- module_param(bcnt, int, S_IRUGO);4 L" ^+ Z/ w* S
- module_param(ccnt, int, S_IRUGO);
复制代码
/ d; i) x* O6 Q) d8 D* C$ R* X- R- z, |/ y: d! Z7 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
\- u- G3 `, D) \& C, d- rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N/ y( { E: ]% R4 b* g+ ]5 p g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' u" C* B5 ]2 @# F; s G5 R
2 X& c$ T$ ~# X4 ?8 P3 k' R: c: h- @: U- o1 K1 n
|
|