|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 \8 _% k5 i, ^3 U- [code]EDMA sample test application
" g( y. P2 t6 o4 L1 Y* r* ~( s - /*
- F/ I4 T. A) Y. V* K - * edma_test.c! c! |4 E% c; R' s6 U4 \, D7 Y
- *
5 \4 R1 V# ^! r - * brief EDMA3 Test Application
0 w2 }: |/ ^! y& e* K/ U8 i9 w0 a0 n: C - *3 c- Y0 Z' T3 B, M1 i; C, f
- * This file contains EDMA3 Test code., C( M z C' v6 x/ G% }4 h1 V, R
- *
T% s( J& x9 j. I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ `' C- t' ?$ v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ y1 f4 o% |0 x2 `$ H1 w% T( s - * TO CHANGE.$ T* N! T6 c" f- A# v
- *2 d# ]9 O5 C. M; j' f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// j( q( ^0 @# I3 i
- *
$ w( u: m E. R1 l4 p' a+ M* z5 w# h - * This program is free software; you can redistribute it and/or
0 r' o$ L+ |' S+ Z! L! ` - * modify it under the terms of the GNU General Public License as0 A* }# ^2 _) f, h8 N* |
- * published by the Free Software Foundation version 2. }# o; j6 e2 j* g1 U
- *
* K, ^, h H# {6 ?3 @5 J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* Y! c9 v7 F* k& S4 a& b% H - * kind, whether express or implied; without even the implied warranty( s X) t, D" P5 J
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& ~; E: t- a% N$ w, |
- * GNU General Public License for more details.
0 Y3 x+ w9 O0 B9 a - */6 s# i% N$ M- D9 E
, j2 Z, Y5 Q$ N2 j( d, S- #include <linux/module.h>3 C& `! }5 P2 @& I& {' g; W0 c
- #include <linux/init.h>$ L% Q' U/ q+ z# l* Q6 D3 S) v
- #include <linux/errno.h>
2 i# |- J5 F) _% k2 O - #include <linux/types.h>
- c" e& H0 Y7 `7 ? - #include <linux/interrupt.h>
+ T& V. y2 g E - #include <asm/io.h>, ]! k! m; z% g% u4 w! k
- #include <linux/moduleparam.h>! O' n4 k/ H5 s8 i& o
- #include <linux/sysctl.h>0 S* f' V, D S) H! `3 A- w
- #include <linux/mm.h>" N% |7 Y; p* }$ L
- #include <linux/dma-mapping.h>* S: i& t" ~- p" `' g; q9 w
- 9 C. @1 o- U2 d2 |
- #include <mach/memory.h>9 k: m$ y: Q' P: S4 f% D' h
- #include <mach/hardware.h>
' C* M5 n3 @- C - #include <mach/irqs.h>
, S$ V# U2 W7 `# G4 i4 f5 a) ~ - #include <asm/hardware/edma.h>2 e' j0 c \( y6 B7 d
7 K0 w$ c9 c; u- #undef EDMA3_DEBUG6 {& e# `3 F' o
- /*#define EDMA3_DEBUG*/' Q! t' }( H- i5 Z
) y0 F7 X/ c- F/ J/ `$ y* b$ }& m" l- #ifdef EDMA3_DEBUG
' y& l/ T6 h+ G9 j1 I1 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ x. J0 {& w1 Q6 Z- e7 ? - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 U+ G0 r; G9 N J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Q3 J- F u% ]. m O
- #else
8 _+ [- g' }4 F- [4 m - #define DMA_PRINTK( x... )3 _/ F1 i9 q3 { N! h
- #define DMA_FN_IN
. v" Y/ w" i- v4 q7 l0 o - #define DMA_FN_OUT/ e1 K. B: j* R- U/ W! \' K. b, z( M2 ]
- #endif6 s) [) \5 R* _. N3 `" \
- / ]0 n3 ~# E/ u5 O: A+ F% }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 p# l9 Q% E3 R6 M: O. Z. @6 O ~
- #define STATIC_SHIFT 3( W0 c! {- t2 O I2 M: O: J1 L: ?
- #define TCINTEN_SHIFT 20/ y. P. H$ g* a: g$ s9 V
- #define ITCINTEN_SHIFT 21- @5 b- `8 g& m0 G
- #define TCCHEN_SHIFT 226 Y: P. y3 G% N( t- h2 w: L7 v2 N: d
- #define ITCCHEN_SHIFT 23/ q# ~6 D& O" t* _* M
V: n- b6 }0 Y$ D/ \& ^& i, A- static volatile int irqraised1 = 0;
6 `6 F6 z9 P# W& O; o# `$ h - static volatile int irqraised2 = 0;0 _$ I7 F, g+ ^
2 S4 h1 w- }& X' ~' _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& E8 [ s+ U( r9 b- Q6 J5 E$ a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* N h6 j* z/ ?, v4 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* m0 t9 ? a. y8 S" B% `/ i- [ - 5 _' a# Z- O% ^" P8 j `: N
- dma_addr_t dmaphyssrc1 = 0;
3 h) C3 K- q. S/ w' Y9 _ - dma_addr_t dmaphyssrc2 = 0;. z. j1 T9 _: ?; P2 K% a/ j8 n9 M1 J0 Z
- dma_addr_t dmaphysdest1 = 0;
( c' h8 N# R* V/ w, h1 P - dma_addr_t dmaphysdest2 = 0;2 ?9 O+ _- A% H: @: f
- ; n. e9 L4 W$ x# t2 U- {
- char *dmabufsrc1 = NULL;$ W. K& k9 X, u$ q# B' I$ ^% y
- char *dmabufsrc2 = NULL;
8 z' W1 N3 N6 k* h4 z# l - char *dmabufdest1 = NULL;" Q" U4 k' ^ C3 a% u3 z |; S
- char *dmabufdest2 = NULL;" B, w( { @9 \0 x3 I2 Q, o
- * Z6 O' J- X* h, N
- static int acnt = 512;2 h1 r: c% r9 m3 O4 M6 B
- static int bcnt = 8;
; |1 b" L1 {. p# F3 t" { - static int ccnt = 8;) S5 n0 e7 W3 r
, C" t# o7 k" H+ |- module_param(acnt, int, S_IRUGO);
% d- ~; Z: W5 C5 r3 E( k5 p - module_param(bcnt, int, S_IRUGO);! T9 N- ?# a1 ]( m4 B7 d9 K$ Y4 r. [
- module_param(ccnt, int, S_IRUGO);
复制代码 P6 ?# O2 e- v1 `* \& Z8 P
+ J. X9 v! S3 E6 ]0 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ d2 }* J) P! h, Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& D- A1 k: U/ X& O) j/ O5 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 `) U; @: ?' c
4 P( m5 B/ ]5 y+ |) N
5 i z8 z* S5 W& D& A
|
|