|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / k5 ~6 Q. `2 i
- [code]EDMA sample test application
+ X" l9 b; x2 D$ ` - /*) Z5 [* l% }1 _0 w2 x# l
- * edma_test.c5 T/ O+ A) n# w/ I
- *
2 e6 t" Y# M) y2 _5 M/ F - * brief EDMA3 Test Application
& H' i$ p% F) f3 E - *" a( q+ ^8 E) r' z/ D
- * This file contains EDMA3 Test code.
; i) [- f' N/ [5 S - *( F% A9 }% U2 `! x3 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( l( u$ }4 d% y+ G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. p8 s. `) v/ T3 v+ P
- * TO CHANGE.9 D. g G3 t: h8 R0 Q
- *
, l# w1 F' V4 [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 \8 x# [( w) Z$ ?2 R; m! @7 P - *. e5 g+ ~. Z: U! F/ Q
- * This program is free software; you can redistribute it and/or
0 U; u: D2 f @, g+ Y% h; B - * modify it under the terms of the GNU General Public License as
, }8 K9 u2 M; v- M; J: C - * published by the Free Software Foundation version 2.& A/ B, T/ K: _; q' p9 s
- *$ J7 C* D( K' m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( F G" K8 j* Z& q$ \ - * kind, whether express or implied; without even the implied warranty% ?* G3 h! Q: T0 F1 w3 P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- {0 x2 h1 W) o& _7 Q) R - * GNU General Public License for more details.& N1 `4 V9 R" J6 N
- */
* z/ N. ?. `) ]. \ - ) k: F6 Y, C6 e/ c/ J
- #include <linux/module.h>5 _5 d) O1 l; B) R& O/ W3 p
- #include <linux/init.h>/ N" h" J( R( R& x' u
- #include <linux/errno.h>
1 z) e7 b: A! K - #include <linux/types.h>
+ x# U9 y% p' a4 e3 E4 A - #include <linux/interrupt.h>
3 K4 g& K2 l* \# ?' |0 X - #include <asm/io.h>
* @) O1 l$ a# S" H/ G - #include <linux/moduleparam.h>/ |" T8 x/ p: y# C# S% W
- #include <linux/sysctl.h>
9 ]( d& p3 R6 R - #include <linux/mm.h>. A- [& ~0 F6 k: ]& i& F) k
- #include <linux/dma-mapping.h>
4 J+ U m1 h |' t - : l! f |4 l! `! U1 }/ B
- #include <mach/memory.h>& L$ `) r! ]* L# k. L
- #include <mach/hardware.h>( b3 t. m+ j# u5 D
- #include <mach/irqs.h>
+ \+ q5 } S. B1 x" ? - #include <asm/hardware/edma.h>
: x( b! h" ? K [" u( _3 _ - 0 v7 e$ m, D% y" [
- #undef EDMA3_DEBUG- j" u+ A4 [! y- g! @6 a
- /*#define EDMA3_DEBUG*/
* L1 P$ J4 [5 e - : E9 t+ ~ R0 J6 c. R
- #ifdef EDMA3_DEBUG
; q1 m) w' b- s0 w% S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( z% O7 U) o1 D" g# w1 N3 ]" _3 V ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 \; W4 |* f7 x& f; g5 }2 O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 K8 O1 G1 n4 o: P' @- s- @8 g - #else5 j' Y& m+ N0 R9 B+ A/ c e1 A/ y: c
- #define DMA_PRINTK( x... )
* B9 G( D; b% k5 @) G - #define DMA_FN_IN
9 g2 ~3 X2 @. w9 ~ - #define DMA_FN_OUT: N8 f+ {& |# H
- #endif2 M8 t( N- A2 O' f! ]
( F) N; R9 G! \6 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
?% E) d0 a$ Y/ J3 f - #define STATIC_SHIFT 3
* ?% j; `* R9 Q4 E% r( k. g+ L" {2 m% [ - #define TCINTEN_SHIFT 20 a0 x7 |0 Q# g: P' B. w
- #define ITCINTEN_SHIFT 21. Z ]- O s- g5 V
- #define TCCHEN_SHIFT 22
( P+ x' r2 v! z2 c/ {' j" [ - #define ITCCHEN_SHIFT 23
0 P; a. j% H5 e9 x" \' g, x - + n6 }2 d2 E) \/ t# z" c
- static volatile int irqraised1 = 0;
7 c; M- C/ p! M# [/ L! F - static volatile int irqraised2 = 0;
$ q' ?. Z, v9 k3 f% S3 a- l
5 g. o/ B) ^( d X. [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z: N6 a9 U& v% k4 x; b8 [, w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! R O* U! R) r# M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 \' {/ j/ G7 P+ }4 O' {% } e" s - , z- w5 ^: g2 F5 k( O
- dma_addr_t dmaphyssrc1 = 0;: b( F4 K! v% a# z$ o0 W9 r
- dma_addr_t dmaphyssrc2 = 0;
$ D/ c5 Y9 [% W% S - dma_addr_t dmaphysdest1 = 0;
; ^7 }# K5 a( A1 K/ b0 J) _ - dma_addr_t dmaphysdest2 = 0;5 U2 j0 x0 `' z5 U f" a
- 9 s: T9 z* y( K; ^9 s7 W
- char *dmabufsrc1 = NULL;
$ U5 g* r& _; V4 U4 T5 V' b9 u - char *dmabufsrc2 = NULL;& p4 Y% j4 F* \- ?5 J3 M- N
- char *dmabufdest1 = NULL;7 z4 ]- @1 K4 t& a( X
- char *dmabufdest2 = NULL;- l) `5 y+ b; D+ [
! y6 [. {& ?/ u- static int acnt = 512;
( f9 b5 ?. |! I - static int bcnt = 8;7 o ]' x9 N" I7 n: |
- static int ccnt = 8;
3 \. [' b+ c' ]! B
$ }2 \& l, n- E- module_param(acnt, int, S_IRUGO);
5 d5 D( }) M1 e$ `" _/ K) s1 d9 m - module_param(bcnt, int, S_IRUGO);
- P3 U9 }. ~, a; }: K2 _ - module_param(ccnt, int, S_IRUGO);
复制代码
: a9 A4 Q$ ]; L# \/ c+ } Z/ A3 d: c! k' A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. y& W. b6 S2 _5 x: jarm-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( s( c. Y1 h& u4 e
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& s8 q, V# l) r. r$ {" T, `$ c* ~9 F
& E$ b8 |' l+ a, E+ `6 ~2 q
1 u4 x' M: v8 y3 k3 k1 ^/ \
|
|