|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ?9 ^% o) B1 M
- [code]EDMA sample test application- ~4 d3 o; K) ~
- /*; G" o- L+ r0 e: ~
- * edma_test.c$ I5 H0 |# `* G0 H9 W
- *
6 F3 b3 q$ y% }! }& b$ Z( g - * brief EDMA3 Test Application
: d% _ e1 n, B - *
|' x; I3 O5 e) V+ r0 S - * This file contains EDMA3 Test code.
3 O" D$ u) J; @ - *
, N; w+ F0 ]2 l* p8 M# X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~& {0 m+ \# }7 R/ I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' D; [- Z, U, g+ b; ] - * TO CHANGE.
" G- N6 o* |# d1 l& a6 T4 ]) `( } - ** K/ A+ @9 }' t- h; G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! w, L, j+ o0 Y
- *' T+ m) ^+ k2 V5 ]4 ^8 y2 T1 Y
- * This program is free software; you can redistribute it and/or
4 n8 C& k" B, v5 V' x - * modify it under the terms of the GNU General Public License as* x9 h# L6 v4 l4 l2 z( e* p- X4 Z( X
- * published by the Free Software Foundation version 2.
6 K: L% l+ {, p3 M0 d - *& C' d( y" z2 z3 h- e2 B- L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, j" x9 G# a2 u- o [
- * kind, whether express or implied; without even the implied warranty2 o7 ]! H/ M% s& {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 c3 }% _) p3 h1 `6 _' b
- * GNU General Public License for more details.
8 x3 l* W+ A% m+ j3 G - */
, P8 [( f( `1 `4 F - " q! {0 r8 G n& ?- ^8 `
- #include <linux/module.h>& g" I* b. N0 c' {1 ^$ [2 i: J/ _6 r
- #include <linux/init.h>
- W. o5 I$ _* h6 t5 c1 g: i - #include <linux/errno.h>% t" u3 G% E! `+ T3 V; R5 U
- #include <linux/types.h>
5 f% V9 i7 t* |( {9 f5 z. t - #include <linux/interrupt.h>
+ l w% p# _+ A$ A0 x- v - #include <asm/io.h>4 M# j8 e& Y2 q4 H' r6 Y3 W0 W
- #include <linux/moduleparam.h>. {3 y2 g1 V# N$ B7 H
- #include <linux/sysctl.h>
; d' w: T/ r5 B/ { t& d - #include <linux/mm.h>- x7 a E/ p* X( L7 G
- #include <linux/dma-mapping.h>
+ H# E9 f; |4 _" A - 3 v+ E1 c# ^" t- }
- #include <mach/memory.h>
4 j/ D* M! ?2 \5 Z4 a, ?, d, E - #include <mach/hardware.h>3 _; d& s4 o, a4 A
- #include <mach/irqs.h>
5 O- f4 f4 B0 t, o; F3 h - #include <asm/hardware/edma.h>
' J# R# Z+ p P: a. R8 R0 V0 l+ |: p8 N
4 g* A2 Y2 W" y& b }- #undef EDMA3_DEBUG
, O8 M1 ?8 n9 r% @ - /*#define EDMA3_DEBUG*/4 A. z6 p1 N4 b8 ^ P D/ S
- ) r3 B$ y/ a2 X) R2 ^, {
- #ifdef EDMA3_DEBUG
) j$ l3 w" V, z" R8 F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 B1 T: C, [# h: ^ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ?; _3 X3 ] I7 ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ L$ ]. b1 y# g e - #else4 t; H% _; y, U4 F0 {1 E5 W
- #define DMA_PRINTK( x... )
j! M2 h4 Q9 V% C1 a- z" i - #define DMA_FN_IN
3 h9 K3 w6 z1 a7 R1 u - #define DMA_FN_OUT* o) P4 P8 L5 r' n0 Z8 ]1 t
- #endif( a5 u+ d4 s& K. q/ R3 f2 U# G
- ) |! w' w- o; ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ R/ B) p" p3 K. h2 h) Y - #define STATIC_SHIFT 3
& `5 k; b0 A5 Q( T6 L - #define TCINTEN_SHIFT 208 e$ y( f' m8 J
- #define ITCINTEN_SHIFT 21( r' B% O9 o5 e, }
- #define TCCHEN_SHIFT 22
+ P# j9 F% A4 s/ @: A - #define ITCCHEN_SHIFT 23
( [: c; m9 t% e' h/ s8 k3 @ - , Z/ s$ W- |# M3 J
- static volatile int irqraised1 = 0;: r( L3 @0 A T; Q
- static volatile int irqraised2 = 0;
% U/ o& t+ R9 L% G5 _3 Q - + y6 k" A( N; J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 H( k2 ~6 {* Y$ p- @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- l( ^4 S k9 b2 |: U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S' k# c3 [. T& a( u
5 V9 M2 K# y8 D3 V3 x3 O- dma_addr_t dmaphyssrc1 = 0;
/ R* d# \! p6 K4 _+ V$ g4 [ - dma_addr_t dmaphyssrc2 = 0;
$ l( P0 r z2 f# @) w7 M2 ] - dma_addr_t dmaphysdest1 = 0;
& O! T: y2 j) N7 j( @ - dma_addr_t dmaphysdest2 = 0;/ N+ a9 T6 O! k6 ~8 } D
- " w2 @# ]9 D: x
- char *dmabufsrc1 = NULL;
4 m: n* T) w) b6 Z! K - char *dmabufsrc2 = NULL;
. X0 |. N) \ z7 Q6 O; `1 z$ Q3 P4 d - char *dmabufdest1 = NULL;- o; P2 S- j1 b" y/ a; ]
- char *dmabufdest2 = NULL;
|# {* z* ~+ t3 Z - 0 ^. u( S6 \; \# T# B+ c
- static int acnt = 512;; ]: f/ |$ d+ L0 M' W
- static int bcnt = 8;
3 C: R. O6 e- }: I - static int ccnt = 8;
% @% N/ k* h( U' |9 t
4 c3 m; O' X k1 f4 A- module_param(acnt, int, S_IRUGO);
) p: m: C A y& q3 R. t9 u) d# k6 r - module_param(bcnt, int, S_IRUGO);
, C# f: V. W% ^# K+ M8 I) \ - module_param(ccnt, int, S_IRUGO);
复制代码
6 V `( G# z% l1 k/ G& X% g, o# y7 _: A; F' O/ A8 v7 r8 o! H( |" K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; `/ ]* @ e+ L; w8 _$ a: F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# r8 p9 Y2 [1 R' p) r- T: @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% C: l% p8 y0 h" s( W
0 c) ~9 P$ ], Y. F) n1 S
6 S0 y; ?8 s4 K. P( B |
|