|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 g& y7 t: x+ ^9 p: D7 d) I
- [code]EDMA sample test application9 R' ]8 T8 y& {8 F
- /*
$ o& I7 r& b& V6 S4 G - * edma_test.c
$ Y2 p+ K% S+ d - *
* _2 a! J o% x5 v k - * brief EDMA3 Test Application! }" |! v8 U. i) c* L' \
- *
2 {7 P3 L+ V( i/ `* i' h* F4 a - * This file contains EDMA3 Test code.
4 q: A; P2 N/ T) ]5 u( M; O& L+ H - *$ F. }* _8 @3 {1 L$ O: K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' o7 A% G$ x2 j0 a% k* T9 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% m5 d, `9 X8 g4 O - * TO CHANGE.
" H" J: c, d7 y* G- N - *4 d/ j9 \. t" c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Z, o* f6 G/ M* M! H* n/ g0 j r
- *
- j& e+ H C: M! ] - * This program is free software; you can redistribute it and/or
4 `1 j+ i2 V( o - * modify it under the terms of the GNU General Public License as' ?6 C# e/ A2 O3 x* N. i6 m
- * published by the Free Software Foundation version 2.
- ^- ]% ~% w9 ` Q8 j) k7 e - *9 l- F* s( ?5 I5 R8 X/ P; u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
b, h8 ]' k0 W - * kind, whether express or implied; without even the implied warranty2 ?0 ]% q- ]- R& c4 _% D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 z6 T5 t) o3 H, m+ M8 I
- * GNU General Public License for more details.% e T4 u4 m4 u$ w
- */
" E; a2 R" W9 O2 m# S& m1 l
% {5 B: j, X+ e- #include <linux/module.h>, [6 _# ^, H* Y- h _; `8 W( q- ]4 B
- #include <linux/init.h>
0 i- G" M3 z# Z - #include <linux/errno.h>3 h$ t4 g* U6 C! F* I [- S2 J
- #include <linux/types.h>
( U4 z5 M+ g- M - #include <linux/interrupt.h>& ~1 Z) N$ k. U+ C! o E+ |4 W
- #include <asm/io.h>
$ ^2 T9 O2 f; _+ ? - #include <linux/moduleparam.h>( s M* g% a6 Z* R) L! B) [( ~: Q
- #include <linux/sysctl.h>
$ G# V9 s$ D- C8 F - #include <linux/mm.h>- D ^2 M9 t1 {0 I2 \; [+ w
- #include <linux/dma-mapping.h>
( n& C0 N ^0 s/ _ - 2 f: Y3 c% ~+ W1 W }$ _
- #include <mach/memory.h>
9 R/ M# @, q6 F) P - #include <mach/hardware.h>2 x/ i# e8 U! ^, W5 {9 m, o% ~3 z- U
- #include <mach/irqs.h>
3 J. j0 g! \6 {' s - #include <asm/hardware/edma.h>
+ {* ^3 c7 ?+ t2 l l/ I. b
7 v! T9 F8 o. h0 O- #undef EDMA3_DEBUG/ _4 |" o q7 x" F: j0 ?
- /*#define EDMA3_DEBUG*/
+ [- r% ]* U0 [7 H( W) r - % E2 D4 \+ |0 f5 w! J; Q
- #ifdef EDMA3_DEBUG1 s8 v- K+ `: T( U# W7 Q2 s; p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% L9 B$ } q [3 ?8 H) T
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 \ m7 q" n% G" [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% K! H, M# q; u" ] - #else
( R8 ~& L" n( A" K - #define DMA_PRINTK( x... )$ f. ^* i9 B5 G! T0 Q' m
- #define DMA_FN_IN
1 j% R, x+ ?9 r% p+ B a - #define DMA_FN_OUT
5 q% \$ z! h j) ^% S - #endif
* h( m1 x, G& V4 F' J% |# Z9 m/ F
, m/ r4 u9 }1 B3 F3 B) ?, H# L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 B* H2 T* r- {& M1 f* R
- #define STATIC_SHIFT 3/ K* u1 _( i% n$ A6 X& `
- #define TCINTEN_SHIFT 20
t. k. C$ _! o& K4 z - #define ITCINTEN_SHIFT 21
, H; O. E$ Q% A - #define TCCHEN_SHIFT 22
) y3 d. @6 s' ?0 Z$ h! R( N - #define ITCCHEN_SHIFT 23
$ A- L/ J) l, {
' I" h+ ^2 g. N3 G3 P- static volatile int irqraised1 = 0;
# S& p7 k6 F: g$ {1 C5 x - static volatile int irqraised2 = 0;
$ j+ f( I+ c8 u4 b. r9 h; ]
) R, d) r' ]& g* C$ E) `; e- T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f3 D$ L4 w! ~' [. R) F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ \) B+ |. [ Y* n! U0 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 A$ ]( K* |/ Z4 H
4 e& A4 H* U+ t- dma_addr_t dmaphyssrc1 = 0;
# H- p# V# ^) p' P9 h6 e+ P - dma_addr_t dmaphyssrc2 = 0;6 c) x9 I" J! h9 U6 I. g- T
- dma_addr_t dmaphysdest1 = 0;
6 u" Z* B2 M' F1 m - dma_addr_t dmaphysdest2 = 0;
- N/ C2 t$ w6 N( ]
3 C v9 G( W" h5 }3 [, s+ j- char *dmabufsrc1 = NULL;
. h; E& F* I4 c5 ` - char *dmabufsrc2 = NULL;9 F- g# f7 W! v8 S8 F
- char *dmabufdest1 = NULL;3 {! o8 |2 x) k4 g8 E. k
- char *dmabufdest2 = NULL;7 g! M9 r+ C. j
- , F0 k0 \5 z. _ N8 u1 R
- static int acnt = 512;. m/ `; k/ e9 P5 c3 Q; I; k9 S
- static int bcnt = 8;
) z1 F R0 H/ |) r! F/ F) Z - static int ccnt = 8;" J K8 c( f. F
- 9 s9 M, B3 J. Y) I
- module_param(acnt, int, S_IRUGO);/ p7 T/ f' R3 R
- module_param(bcnt, int, S_IRUGO); L! {* |. z r3 c0 m$ K
- module_param(ccnt, int, S_IRUGO);
复制代码 6 }# ? w! }, h# l$ X' q6 |" t' o
: `5 M$ _+ r/ H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" v I7 v* b* d) G I& t. |3 c. l- Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: y/ U0 i) E- t3 n4 a5 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* k& q0 u! O" X: i( D& [6 ]: c h6 P: h, T
- L' {* _- C e1 I |
|