|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( _- e/ M3 M+ i) ?% C9 I- [code]EDMA sample test application5 a7 R) f1 z. M2 F
- /*
- A3 Z" X4 |0 _3 { - * edma_test.c5 R a2 h9 c# c! w
- *3 g) E. {9 q7 y9 h: j2 t
- * brief EDMA3 Test Application) L3 m* E- d( j" q |
- *1 {$ c4 \$ _8 Q0 @4 o
- * This file contains EDMA3 Test code.
) _8 U) p, e2 e. O _ j! e - *1 @6 v+ `3 v) T, v/ a% T6 z6 ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* L! k* w- n: z* }# p+ D) B2 f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) s+ Y% s8 d8 f; A - * TO CHANGE.* B8 D* _+ V t- ], s4 p8 t
- *
! [# I: d4 d' {& `0 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
m+ e5 \( [4 O) A0 I2 G6 U2 R; U5 C - *+ o- u" K# ^4 t. `6 m; C% |/ u
- * This program is free software; you can redistribute it and/or
* G# Q% T$ U# [0 X9 |- e - * modify it under the terms of the GNU General Public License as/ r3 r& v% B: d/ u9 F/ n7 o0 g
- * published by the Free Software Foundation version 2.% w; f( R) f( {# G
- *5 R6 p4 `+ L& p$ O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 v; @" T, _0 o7 ] - * kind, whether express or implied; without even the implied warranty4 L" W; ^, N$ l4 V! r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) K$ [( {0 C; l% x0 w I: M - * GNU General Public License for more details.* o* A$ ~- x, W7 \
- */) F( B6 l7 I$ E2 \
- , W" D' u# c$ f M% i; z+ A
- #include <linux/module.h>' T# k# Y+ k1 Z/ O1 C
- #include <linux/init.h>
+ D0 T! n& L4 e# b0 M k. A/ Z* p - #include <linux/errno.h>
( v J4 B3 R9 V+ Z' m - #include <linux/types.h>6 U; v: f* E$ g' w+ U) d$ R7 ~
- #include <linux/interrupt.h>
3 e" {0 q0 A# O" q$ J - #include <asm/io.h>
% u; t4 F- C, |& X2 k - #include <linux/moduleparam.h>" A9 \6 H0 T- T' z( b# _( g7 ~0 \$ I. _
- #include <linux/sysctl.h>5 M* O; E! K9 m9 i$ r3 x9 k w. j
- #include <linux/mm.h>
* F' M, Z$ ?# V9 k. \; [ - #include <linux/dma-mapping.h>
/ C5 k1 E8 c$ p
/ Z6 n) S/ }, i/ y8 M3 a- #include <mach/memory.h>8 M( C9 R& _# o) U# e' Y6 `4 j
- #include <mach/hardware.h>
* i$ Y: I- c1 s" P1 W - #include <mach/irqs.h>5 z3 I4 C* B$ f, d4 v+ v
- #include <asm/hardware/edma.h>
8 N0 T c# ?9 y& |& N - 2 x, [1 x9 z$ Y! Z. c
- #undef EDMA3_DEBUG! S2 `8 \& A: l; C9 l/ N) f
- /*#define EDMA3_DEBUG*/
# x) G5 k& N6 ^& {2 ]( s6 r& w, z2 _& D - % Q' Z+ x' A! I7 H7 k
- #ifdef EDMA3_DEBUG7 ~4 t% P, X7 _: \% |, d% n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ a& r7 u+ M6 P( y" X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# _7 m: F$ H# v4 S1 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 G' W: n/ x+ ~ - #else
4 y5 s& r6 \8 V: M+ B+ R - #define DMA_PRINTK( x... )
! I2 t/ z( z! W- \- `* U - #define DMA_FN_IN
# |3 H0 Q. y1 u% H - #define DMA_FN_OUT
3 r& I9 d- h* X - #endif0 l1 {/ O( g5 ?; V
. @+ p! w/ c8 w2 q3 `! H+ X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 h+ G, S+ L6 A; i" D
- #define STATIC_SHIFT 3
1 D5 ^ N* N$ j) Z8 J g. V - #define TCINTEN_SHIFT 20
0 K0 ?. i. y5 N" \) j - #define ITCINTEN_SHIFT 219 G3 b' Q0 h% o+ K C- K4 X
- #define TCCHEN_SHIFT 22
5 W& C- n$ u. {9 K' A; Z# x- H - #define ITCCHEN_SHIFT 23
6 ^3 d! Z7 `. F. K - 1 w# G6 p; U9 u1 _! G
- static volatile int irqraised1 = 0;. R8 Z0 R* ^ f9 r; U4 N
- static volatile int irqraised2 = 0;" b4 d) s; X8 s
) V& b3 D, t" _! R4 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" l- \% A+ h! R" D8 h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); C7 J4 {3 f. X4 {+ ^. P6 l5 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G; _/ ]6 {* T$ f1 O' E- C" P |( p
. D$ ]# A. x$ m9 v- @6 F- dma_addr_t dmaphyssrc1 = 0;
3 b4 \7 I2 c; Y4 f _ b8 i. B - dma_addr_t dmaphyssrc2 = 0;7 c3 @% M9 \& F! H. O& c4 r2 c
- dma_addr_t dmaphysdest1 = 0;; b$ o7 }. v" L0 W
- dma_addr_t dmaphysdest2 = 0;6 `! ?4 i7 ], ^ u1 H
- ) h7 |, i! g* F) M( p0 i+ J* h1 {
- char *dmabufsrc1 = NULL;
* k4 o1 V3 o6 ?' Z& H - char *dmabufsrc2 = NULL;6 N5 l6 @; H& x' `0 W
- char *dmabufdest1 = NULL;
7 J+ ^" W! B) C; K+ V7 U8 w - char *dmabufdest2 = NULL;+ x D/ Z& B; ]# _) V1 x M! L% H
- & M0 Y N6 z% F8 |! [
- static int acnt = 512;
2 m! V0 z8 N8 y [# G% e N - static int bcnt = 8;/ C% j% X. m" |( m7 }# C
- static int ccnt = 8;
$ w. @9 T: I$ q- S
2 `+ {4 U" _* h$ a- module_param(acnt, int, S_IRUGO);
s3 h1 d& z1 [" m5 O+ A( H - module_param(bcnt, int, S_IRUGO);$ l' p; S" I* a* b" O0 d
- module_param(ccnt, int, S_IRUGO);
复制代码 . V+ a) {" h1 X! T
9 G! l b( w0 } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 H% w* {/ m: a6 y6 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 U$ n) Z$ [ `8 \' `7 B9 q6 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 f3 C W. G# @0 Q0 ^( u/ Z
8 u) q4 U E. H# W9 d# Q$ x9 S8 a$ g S
|
|