|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \6 z$ \* H% }1 u
- [code]EDMA sample test application6 u: G$ [9 n7 B% O3 h1 q( @
- /*: b( g0 e: B- R( g; C1 o7 | e% ~
- * edma_test.c
4 P8 [# v8 r( c - *( L- Q. L M+ Q/ b( M
- * brief EDMA3 Test Application% \3 { H, ]3 P* c) c0 v
- *0 k' \; w3 R# i4 M# Z4 w
- * This file contains EDMA3 Test code.
$ W. H+ `' ?2 j; D9 B - *
: k. i( o, R2 _! Z1 ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ^* C& \9 I o3 x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
M; F* k$ c/ b/ G% D - * TO CHANGE.
9 Y% u* F `& H1 u/ u. e( K ^ - *
9 s, z6 N9 s0 o" p, M: o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 a4 G& t; q: ?/ X% z - *
5 g# B c. Z' T g8 J - * This program is free software; you can redistribute it and/or
7 d; @8 w( c) E& e" z - * modify it under the terms of the GNU General Public License as* |3 y; V: Q2 _# V2 v9 Z% T
- * published by the Free Software Foundation version 2.
/ u7 T: u# f7 o2 |: d1 A - *" B: O3 Z* X& X5 t0 x0 g0 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 Y3 z: X" g1 @8 x7 u+ q
- * kind, whether express or implied; without even the implied warranty
. |0 O# R5 U/ v% X2 A - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ g/ r$ ?' {* f9 |6 S" ^. z
- * GNU General Public License for more details.3 ~% U! p: T" b& R4 g" p- `4 u
- */
: M8 _% t- V" `/ q0 v
+ R4 L# ?9 g6 |$ h7 l4 q. p5 Z- #include <linux/module.h>
7 I% N2 ]1 x8 I$ h2 K, ` - #include <linux/init.h>1 W% F* q4 `" w! I. \' c6 P& a1 m
- #include <linux/errno.h> P1 i9 _2 [9 W& ?0 u2 y. R
- #include <linux/types.h>$ ]; N3 C1 R* q) N
- #include <linux/interrupt.h>
& N- I6 q c5 _4 o - #include <asm/io.h>
% `- C# f/ J: B+ b" y3 ]3 t - #include <linux/moduleparam.h>
/ A, r A& n8 u/ Z7 r' W( n - #include <linux/sysctl.h>. M5 M& M0 s3 a- D3 v) G3 Q0 F, R* U% i
- #include <linux/mm.h>
; a) [' O3 w9 f- v - #include <linux/dma-mapping.h>- {, A" |1 e3 u
- 6 |# Z! ?: r' z: R
- #include <mach/memory.h>2 r7 V3 I6 f1 h& L5 v7 m
- #include <mach/hardware.h>
) e+ e, x5 ~: d& C0 ^ - #include <mach/irqs.h>5 N$ K9 V/ H8 H" r
- #include <asm/hardware/edma.h>
- X% V- w' D: K - $ W- \0 p# [$ o- c' c8 k. v# g
- #undef EDMA3_DEBUG8 { X% p3 @, `! y* v) x
- /*#define EDMA3_DEBUG*/
0 V* t: y/ t& |) r
4 J* q. a* D& i: d3 s- N- #ifdef EDMA3_DEBUG
/ E5 r5 B4 x1 K* ]$ G+ l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( g5 s7 p9 M/ Z: f& L6 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). D# a1 ~$ A- a6 B4 d8 {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# i/ S0 @! r6 j% D! c - #else- B, e; i7 j8 ?- E
- #define DMA_PRINTK( x... )! {: L. P& p) Q% @
- #define DMA_FN_IN `( o1 ~0 K) e% }
- #define DMA_FN_OUT# K) ~: ~; _1 G! N
- #endif% e6 ^4 z4 b7 _1 ~6 U
- " S" ^2 m& m9 d2 j7 B$ B! h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 ]4 [& [( F2 @, F+ k5 ^2 `8 ^8 g
- #define STATIC_SHIFT 3- l& D3 n# @7 J, c. M/ ^
- #define TCINTEN_SHIFT 20/ L' r7 ?' E; G# J
- #define ITCINTEN_SHIFT 21
2 F: P- y: O: H" @ - #define TCCHEN_SHIFT 22
' ^# k$ `- h2 J$ _# ~ - #define ITCCHEN_SHIFT 23# F1 J9 b2 a% X) G" M$ A8 l
+ Q6 U: t6 I, U U5 ^7 y- e- static volatile int irqraised1 = 0;4 _* \7 x- w1 x8 E1 E' Q8 q, g
- static volatile int irqraised2 = 0;
, V) v4 ^' w5 b5 F( M a$ T" O - ; M6 a9 C# b" v) X3 y5 M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 t X8 i3 `# T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 D. N' q1 e/ C+ D* g# i/ L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 K$ m% s p* W% L% b6 R) x; C) _/ y
- 7 O& q, I) b% S: C+ \
- dma_addr_t dmaphyssrc1 = 0;
( z8 G. A5 }# l' H2 J0 u3 P - dma_addr_t dmaphyssrc2 = 0;* P2 H; A* `$ G" r6 L
- dma_addr_t dmaphysdest1 = 0;5 O7 c- S- `8 H
- dma_addr_t dmaphysdest2 = 0;
v1 e0 J3 Y! b/ Z t
* t. D9 b; c* U! E- char *dmabufsrc1 = NULL;
3 b! r, @5 c# i. c - char *dmabufsrc2 = NULL;9 c; m" L) B( o& G) r+ X
- char *dmabufdest1 = NULL;' `+ l8 \, y0 r0 R. o
- char *dmabufdest2 = NULL;$ g, O( {6 M0 g! E
3 ?$ J2 _3 ^2 @4 y& R- static int acnt = 512;- R$ Z1 F% Y; l8 E! {. y
- static int bcnt = 8;( o% L: p/ g8 I+ \. ?
- static int ccnt = 8;
4 |. s8 w2 ^( y7 U7 u! @
/ |7 v( Y- g* e$ Q0 C; c- module_param(acnt, int, S_IRUGO);% x0 ?4 J q; M
- module_param(bcnt, int, S_IRUGO);$ g# c# `7 z! j c p2 z
- module_param(ccnt, int, S_IRUGO);
复制代码
; F+ t4 w! K/ i' t4 ?# m6 x7 P! N2 K# y$ \8 @+ | _; X, K! ?% Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. b" F% s9 _# O7 F$ R: \& Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 g6 w q' Q/ ^& Q, l; E% l' k: @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: T1 G& G1 a% i$ n$ D4 J; v. ^/ Z; B. v5 f) W
9 @1 j! q$ D5 Z4 J. O( x: H
|
|