|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 X+ w2 k7 x8 U) \
- [code]EDMA sample test application
3 s" E8 L9 n$ _2 j# u ^0 T7 | - /*
' s( `: c+ r- {( `+ L5 g - * edma_test.c: V1 g- o) o3 W3 S7 l
- *
6 V' T2 ~5 P; r7 g - * brief EDMA3 Test Application
$ R8 b" N" b- M: y - *: U2 U2 a' D5 G4 |5 G/ K) h
- * This file contains EDMA3 Test code.- I/ L9 B" o& ?3 g
- *
p8 j7 ?/ h8 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 M) I, Y! Y8 O& {. l( o! j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' B- @4 G: g7 h; o( ?0 o
- * TO CHANGE.
* B% B- `; o! @3 M# @1 u. K4 q4 R - *
! S: X' O8 }) K6 D% f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 z6 ?0 h" A# g4 V' E, p
- *& f6 w2 B! _! V% O
- * This program is free software; you can redistribute it and/or# o8 f& G, \) N
- * modify it under the terms of the GNU General Public License as" |1 ^6 }4 V( T( T; T7 k0 L/ V
- * published by the Free Software Foundation version 2.
Z9 `. _6 Y8 G* n8 H - *% j9 H5 R9 o b. C9 p b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 G l# _) V G: K" b
- * kind, whether express or implied; without even the implied warranty; Y) d! m; G: G) S0 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 E" @6 J1 N( W% G+ u
- * GNU General Public License for more details.
L- _5 d* f" }+ S - */, k9 Z/ t1 J) b* I" s6 j
- Z* b c8 L- b& P- #include <linux/module.h>
' l4 K" z- I9 `6 B/ c - #include <linux/init.h>
4 B% r7 Y$ l" Z - #include <linux/errno.h>9 o) f2 h: I( O% y3 y) g. n: f( I& V
- #include <linux/types.h>
( ?1 n/ o/ I/ }- K. Y) x - #include <linux/interrupt.h>
1 t! o$ w' Y3 m) S) [6 c6 b+ {% k; E8 [ - #include <asm/io.h>9 N$ V/ l4 T, S2 G% o
- #include <linux/moduleparam.h>
; R0 `" `- a3 w2 a/ v( N# Z - #include <linux/sysctl.h>& v4 U" B% @* [) j! w
- #include <linux/mm.h>& q- m1 Q1 G0 d3 t0 o
- #include <linux/dma-mapping.h>
) z9 S3 ~' |- o, V s. q - + c+ B" x, _# y) B \; P
- #include <mach/memory.h>% g5 e* ^4 b) t( S
- #include <mach/hardware.h>
5 C, F% H4 _$ K( ` - #include <mach/irqs.h>% o* ?& T7 n/ m/ B' f& j
- #include <asm/hardware/edma.h>, V$ f- E/ R2 g0 k
/ i- I* G' m8 X( [- #undef EDMA3_DEBUG
3 ~) q0 R, X' f8 n/ A6 q - /*#define EDMA3_DEBUG*/) q2 E+ t) @2 C! U- q$ ?: r
* U" O7 A, A3 E/ J$ [- #ifdef EDMA3_DEBUG& d* w8 z; |$ i0 I1 n* W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' \* W* G3 p$ {" j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 n, i+ f$ |6 W5 g* M( W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ~! v$ d3 X4 s4 e) ?" g ?
- #else' G- T9 j2 @* Z% u; l0 K& ?
- #define DMA_PRINTK( x... )
# X- Q3 y. M5 ~$ I: A - #define DMA_FN_IN' W6 f0 Y- u- G& C
- #define DMA_FN_OUT
. `% S. F, Y( V - #endif
$ S* X8 x- K: S - 6 }7 ~+ h1 ?5 F+ v @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% |- J7 g5 W$ H7 ]7 J# g0 \ - #define STATIC_SHIFT 3) g4 R l$ m! e3 a# `
- #define TCINTEN_SHIFT 20
0 W" g2 _/ D$ B, K: r- e4 v+ \( V - #define ITCINTEN_SHIFT 210 b( Y, d' M; b2 w0 P2 x
- #define TCCHEN_SHIFT 22* \5 W- d* }* P! s) i+ A; Y
- #define ITCCHEN_SHIFT 23
" O% }( x3 Y2 s
* q9 Z6 o' i4 d& G7 S* d- static volatile int irqraised1 = 0;
: W5 u+ w' v/ f2 J2 o8 O" Z - static volatile int irqraised2 = 0;
9 q; T% ^+ g8 \, X
, X* ~% G( V; @) i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 l. r! k, o% X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P& C6 s. d: ^9 ?" Q* L+ n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 |2 E" f @7 S
8 o7 C- {; Q3 X4 r. N! t @- dma_addr_t dmaphyssrc1 = 0;' t9 @& N [1 o: Q0 s* q
- dma_addr_t dmaphyssrc2 = 0;0 C$ Y$ z* ~+ Z6 r3 d1 O% U
- dma_addr_t dmaphysdest1 = 0;; c- @( z+ g, |& }
- dma_addr_t dmaphysdest2 = 0;
& Q2 a+ b3 L7 p% W6 w - 3 I7 C; G9 k7 a: Q- X
- char *dmabufsrc1 = NULL;
( G& R$ N U8 `1 o) c5 w - char *dmabufsrc2 = NULL;8 C5 v7 L1 u$ e. S
- char *dmabufdest1 = NULL;0 W8 A% K" `! c1 v8 d
- char *dmabufdest2 = NULL;% O+ s h' t- b' x& a
- ! Y% N$ M' o. A! z7 {' \$ M
- static int acnt = 512;. p9 H1 ?. L& D* v( C, i
- static int bcnt = 8;
$ k3 ]& C9 M% t* S; \ - static int ccnt = 8;
1 i& x. h: _% K5 j+ l8 H - 3 U6 R$ D* G z1 J/ T' {
- module_param(acnt, int, S_IRUGO);2 X" i- g7 f: g F
- module_param(bcnt, int, S_IRUGO);9 {# }9 y- Z0 V) J2 q5 R/ T' ?" q4 L+ O
- module_param(ccnt, int, S_IRUGO);
复制代码 " v, p. k) g6 _8 W6 M7 h8 c6 ^
; V- m# {" f3 e% ^. m+ @5 i 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 ` {$ V! R3 Z, o& p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 D4 y3 m! o+ {# q6 C5 Z1 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 @2 K% _- _" p+ H5 m* A
* Z+ K- p; f [3 O+ J8 h( D7 h/ Q! ~4 i* ?) b5 ]9 q, n0 f
|
|