|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' t( A# a* J6 \/ d5 p+ M
- [code]EDMA sample test application
a4 |, Q1 [" @1 i( Y/ Q! W; c - /*
" g! `# ?) E" P$ @* J# S - * edma_test.c
' s: M# A7 c/ v+ R, E( Z7 ~/ X' m - *
/ {- }1 }$ _1 o0 z# G9 |' a - * brief EDMA3 Test Application
/ C) B) k6 w5 K% p0 B% ~" r% ` - *
9 [/ Q/ \( e- w1 A( R$ ^, } - * This file contains EDMA3 Test code.
3 b6 h2 t9 U) h1 V7 i - *0 |% ^+ B: n$ W4 B N5 O, d [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE Y) L. ?# S) b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 a" k' y& k/ D) @7 }
- * TO CHANGE.* R ]* @6 F# V, G G- s! n
- *
' z; B/ W: I4 ^- S2 z7 R. F5 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* e# L6 M/ { |5 y3 U
- *+ o0 h. v2 h6 y4 H
- * This program is free software; you can redistribute it and/or
" b6 G/ O. f4 o$ V3 P( v5 I! Y - * modify it under the terms of the GNU General Public License as3 N, x& W. K; W6 \# V% X* D& V# r+ S1 u
- * published by the Free Software Foundation version 2.
y0 t4 O( t- g0 y$ { - *% }% ]" z/ T% d& s. V( `2 O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
X" q+ j# l- X4 X7 w/ e3 s S5 c6 y - * kind, whether express or implied; without even the implied warranty6 u/ E: v: J0 E7 U) O: `+ f! S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 @) M+ j% I9 h) |6 I* ?+ {
- * GNU General Public License for more details.' G6 e2 O" y9 c* E; b5 a$ r
- */2 `, r# k8 u& D* ^' h
- 0 |: d0 a, }# y0 y' t7 d: S
- #include <linux/module.h>( I" F# V: e8 q9 _
- #include <linux/init.h>
, D" ~9 I% L6 S; L1 C' A$ M* X: M - #include <linux/errno.h>! m+ _: l: a2 r* X" F3 o8 h
- #include <linux/types.h>2 b$ k$ l0 P7 X% }& I( ]8 L
- #include <linux/interrupt.h>( g( |$ g1 A) g. f3 e
- #include <asm/io.h>5 W/ K3 A7 f4 P+ W
- #include <linux/moduleparam.h>, f8 |' @; l) }+ P
- #include <linux/sysctl.h>
1 ^$ J' |6 M; A' t9 I2 W5 g, ]" ]' T - #include <linux/mm.h>7 U4 l& r5 i2 n3 \- i" a3 r9 j
- #include <linux/dma-mapping.h>
3 f: y( K" q& u# i: G9 ~$ n* b5 H - D8 l3 }' e4 O9 Q+ u( [6 m
- #include <mach/memory.h>4 L& }. ~, b% {1 P' K3 x
- #include <mach/hardware.h> Z5 i7 P7 m+ J. U
- #include <mach/irqs.h>
$ Y: [+ q) X/ N; k4 t - #include <asm/hardware/edma.h>
U2 {! r8 b. {0 n" j& [ - 2 s$ ^# ]% f7 V5 Q0 q1 u; x) q' Q
- #undef EDMA3_DEBUG. `1 ~+ o- ?9 n% P Y
- /*#define EDMA3_DEBUG*/$ ?, l- b& w" z5 n* u8 k3 t7 H+ F
8 u& e6 p* Z5 b. x* @' [- #ifdef EDMA3_DEBUG T: S" h0 O) g* Y; h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 N0 p; v2 O& D6 x6 C6 l% v+ s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ u1 G3 d) e& @+ y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' ?5 Y* a& v+ K
- #else. T, e# [& A$ Z* H( S( n9 X
- #define DMA_PRINTK( x... )
- n1 X) N/ H9 D9 k' R* \! y - #define DMA_FN_IN1 G! F( r# w! q5 ~' x) B
- #define DMA_FN_OUT
q5 D/ D T h% C, G - #endif3 a0 b5 Q% ^) y
" R: P8 U2 E9 S9 c5 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ e9 H: F# V% k; A - #define STATIC_SHIFT 3
# g9 `) Z: Q" c* p$ A - #define TCINTEN_SHIFT 20
- {, @( }, W/ c - #define ITCINTEN_SHIFT 210 }, I9 V0 X e, H/ R( d1 k T
- #define TCCHEN_SHIFT 226 N1 Z- f% H2 ~* p
- #define ITCCHEN_SHIFT 23
+ c% P- w( p6 p1 Z/ R. r6 e& J - ' x \7 _; x/ u& F: _ t% e9 S; W: R
- static volatile int irqraised1 = 0;1 N7 q& {! p7 b1 ~) D
- static volatile int irqraised2 = 0;, Y+ T9 m+ S4 I/ J5 |: b
! m7 c" j2 n! i! [1 m n a" p f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ R3 |5 g7 v6 f- O3 D& _5 l9 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& x3 [: X5 K- H9 v) h3 }9 b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r; j2 I8 d |. ~" X3 Y; _1 \
! q6 U3 b( ^4 T0 n! c- dma_addr_t dmaphyssrc1 = 0;
0 B9 l: R( D- P* g* O/ k9 ~ - dma_addr_t dmaphyssrc2 = 0;
. k5 ?& G, W7 a9 D - dma_addr_t dmaphysdest1 = 0;
% P; {# `3 Q5 H; a" F5 |# S - dma_addr_t dmaphysdest2 = 0;
% ^8 |4 N# m' ?; e
- d/ e: x# h [3 K. e. ~- char *dmabufsrc1 = NULL;
# y E7 o5 }! e) \# F - char *dmabufsrc2 = NULL;
( L! R/ R: r( c, ~: I - char *dmabufdest1 = NULL;
+ R' F7 ]6 K5 A - char *dmabufdest2 = NULL;
7 C9 Q- d* d; {' ?+ d \% R3 Q
4 Q/ h! U! R" u2 p7 Z- static int acnt = 512;
! d. Z. ?& x$ J+ t. y$ u - static int bcnt = 8;
2 H0 z' `' {, v9 a( y, r - static int ccnt = 8;: B2 F$ z) ?: N" E$ B
- T4 h ~: D& `- module_param(acnt, int, S_IRUGO);
) L/ z* o2 _! X& I6 x V4 X - module_param(bcnt, int, S_IRUGO);( o3 O! _9 L5 W& F4 ?
- module_param(ccnt, int, S_IRUGO);
复制代码
4 Q' P- C2 S, V; J( w5 j
, @7 v$ o: H; m/ t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ k) W7 q( g! H' [2 D, `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( G$ Y' Y. Q5 o3 I8 V1 e7 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 O1 z7 P' v& u4 `1 ?0 m
5 Y/ U6 m0 A7 j9 m4 Q; y: T2 r6 D% u8 z) p
|
|