|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 R. m+ W3 K2 }9 H
- [code]EDMA sample test application2 D5 \+ F& }! f) G
- /*
/ u- m, }" ?1 O$ N$ i% O - * edma_test.c
4 y+ e1 `4 Q# Y" U - *
R z: P+ n2 b* I - * brief EDMA3 Test Application5 j! T" t( ]0 |# F& f% {- {
- *7 P) }$ X/ i3 _# E7 W, _
- * This file contains EDMA3 Test code.0 n! C) |& F8 N- { h5 p
- *
- G) V7 N. z( w# |4 w% k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 t0 P& k l1 }8 f6 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 r2 _" N1 M8 {1 z2 A% }! a U* y - * TO CHANGE.1 B+ i5 o) O$ |( n6 s
- * E1 [( R3 w/ {/ k+ x- s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# K3 U& O9 J- w( l
- *
' ]+ k" A' e/ E V9 d& ` - * This program is free software; you can redistribute it and/or$ n6 [7 y2 n: T6 m
- * modify it under the terms of the GNU General Public License as
! n ^9 C* G4 `2 Q M - * published by the Free Software Foundation version 2.' v8 r* `1 n' J4 b d3 D/ C
- *5 H) E( p' K1 p [5 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. a/ M; Z, M" p0 V( G3 l - * kind, whether express or implied; without even the implied warranty
3 y! M! O: }( e1 i; E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 q5 Q _+ r7 Y2 J- A2 k! b6 q; A
- * GNU General Public License for more details.8 z7 }) u) r |: A1 C4 i
- */
; D8 F+ O* G6 w- w: y6 s
: S8 q0 }8 m$ }! A( k- #include <linux/module.h>
6 o) k* E Z( j) A - #include <linux/init.h>: ~7 f& k. n: ?9 E: q: w7 v1 Y/ B& T
- #include <linux/errno.h>
0 z9 `8 d1 V$ A% l - #include <linux/types.h>* @4 `- J( s* a( ^$ T
- #include <linux/interrupt.h> D0 r+ ?: u# z7 h, g6 Z
- #include <asm/io.h>
{5 Z: [% Y6 Z n8 w - #include <linux/moduleparam.h> i$ S, f# x- @6 U# M1 s- U1 e# q
- #include <linux/sysctl.h>
6 U& S+ ? h% z2 l$ x7 Y/ A - #include <linux/mm.h>. I. A: r% }. q0 O% s/ A" R
- #include <linux/dma-mapping.h>/ m5 C Q4 H% L1 S. \
- 7 x: Z& p( `& l2 g% g5 O1 `
- #include <mach/memory.h>. u3 _- e+ ?' H9 Z8 y7 O* u
- #include <mach/hardware.h>$ Q Y8 \/ |7 n. a2 Y) T5 s
- #include <mach/irqs.h>
0 X8 p3 a" Q% h* ~' g0 C - #include <asm/hardware/edma.h>
# K4 v9 a H u/ q U2 j
& Z( w( f- }- z% k, v' [% ^- #undef EDMA3_DEBUG
, {6 b$ i% q. Z% A* _% s% x0 n' h - /*#define EDMA3_DEBUG*/7 m1 w* y* z4 g$ M
- ' f- j) G8 z1 T8 }9 |
- #ifdef EDMA3_DEBUG
, E' e. }* @/ b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ U( I4 H& j3 [( {. C# _, ~3 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ o, Q" N6 B L7 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 U- d5 k# ?: |9 P - #else
- L8 \ a0 b w- A# U& J# g - #define DMA_PRINTK( x... )
4 F3 c1 U5 ~3 Q# m: z" S8 F3 [+ [! S9 j - #define DMA_FN_IN
& A- `& x1 p6 q6 b- Y - #define DMA_FN_OUT
+ I2 k3 R1 W. X) o( b - #endif
9 Y2 e, u# J/ E" u6 Y
1 F- Z+ Q0 `9 h: k b" F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% T: G% y8 @7 B5 p* ? ]" Q - #define STATIC_SHIFT 3. J/ c" j9 j* X0 R, Z
- #define TCINTEN_SHIFT 20( v0 j2 M, K/ `% c. B& L
- #define ITCINTEN_SHIFT 21
2 O% E. i' |3 V& @( Y% k - #define TCCHEN_SHIFT 22
; V8 ~. U6 f2 ` - #define ITCCHEN_SHIFT 23
6 A# o( v+ f, v1 s1 K - , i0 h: \+ g' K* b
- static volatile int irqraised1 = 0;2 O [- Q& P% I$ l# V
- static volatile int irqraised2 = 0;
& v0 n+ C( E& Y+ L9 L4 a - 4 \1 f) j+ Y M5 W0 ~
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, I+ r. R. ` j& u1 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 A/ k" O* }. |0 @6 C1 O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, z( s+ w- u! s9 V9 c
& K: G7 L- S! z4 G- dma_addr_t dmaphyssrc1 = 0;
$ n! C; Z3 K8 j( E( R1 J4 ~ g - dma_addr_t dmaphyssrc2 = 0;
. F" `) x7 N; t9 f+ E* h7 G - dma_addr_t dmaphysdest1 = 0;
& B" e: q/ g d( b4 C+ ?& H - dma_addr_t dmaphysdest2 = 0;) ~/ [) z3 L, Q1 N2 H! {8 |
W+ K' j) X" B; l! t) s- char *dmabufsrc1 = NULL;
. Y; y4 {" `2 W6 E1 ^: Y - char *dmabufsrc2 = NULL;! u- X! h* ^+ n0 [) M: n( d y, w
- char *dmabufdest1 = NULL;8 l8 i5 q J: g
- char *dmabufdest2 = NULL;
- y( M! i' ^1 N7 ?" m$ n( D
; }& v4 L5 n" s- A9 m- static int acnt = 512;' Q* Y; H4 {* n, n i
- static int bcnt = 8;- e* a8 V! V% U2 I0 _2 F
- static int ccnt = 8;* i! [) i/ d+ L7 f2 q
4 d9 G! O9 m. ^# M' ^- module_param(acnt, int, S_IRUGO);
' h1 p) W- @7 ]7 W - module_param(bcnt, int, S_IRUGO);
9 ]6 A% R# h( d% f- Z4 f - module_param(ccnt, int, S_IRUGO);
复制代码 1 F& C9 }$ c' @ o
2 l) b# Z, J$ u# p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& r. C: p2 n2 D5 k7 y$ J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 Z7 N6 E5 k7 Y; h% M x2 y) w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ l: d j" O" [! R7 b& H2 [( X) z9 j
% p V s' \; H8 u2 K$ t
' C5 f% d/ w. p4 R( E1 V9 }! @ |
|