|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' j( i ^, p* V% d$ W# f5 G- [code]EDMA sample test application6 N$ a: I: B2 Y8 T
- /*
) Y9 h+ t. T3 A' J - * edma_test.c9 D, x6 u* X- b2 m4 Y7 |% l
- *& e) v& f3 y6 h3 g, |
- * brief EDMA3 Test Application
3 [% h4 f/ S* O E% M9 u! ?1 d - *; g9 o, U5 D/ g7 a0 L
- * This file contains EDMA3 Test code.
% k9 X! q7 k' _9 O n - *9 i9 d% C. X0 y: S1 o/ W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* x7 E' ^8 V& P" T' V4 B2 f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 e6 U( Z1 k/ q' L$ _ - * TO CHANGE.
7 m+ \& P: d9 l8 ?8 X1 X - *
( o# x8 C+ r) S. Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 M/ K- {; X; O; D - *
* D. I9 t5 x$ B" b0 n6 D - * This program is free software; you can redistribute it and/or
X& Z1 s! y) q - * modify it under the terms of the GNU General Public License as
, U# h H: a) W7 K - * published by the Free Software Foundation version 2.
* W& l" b' P1 Z2 d7 A& W/ X& ^) \ - *( ?1 {. J2 @% v8 i+ J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: [* u2 W$ y1 p - * kind, whether express or implied; without even the implied warranty# D7 D- W4 d9 i" U8 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 ]& W' E$ e0 b% [
- * GNU General Public License for more details.
8 U D% k }6 }4 W' K4 B8 d; ` - */6 b7 q1 j3 ]' J, `" o
3 i( P4 G! R. f; \1 \7 q9 i- #include <linux/module.h>
2 W, ?* e2 \$ ]7 D+ u - #include <linux/init.h>1 g; [5 k0 m( K3 \. H( ?
- #include <linux/errno.h>: F* Z; ^. B- h
- #include <linux/types.h>
. m9 D) g4 p8 O) n0 V7 a/ T$ _ - #include <linux/interrupt.h>( Y# z1 u4 Z* k7 o+ K
- #include <asm/io.h>
: Y! A6 q- o% Y - #include <linux/moduleparam.h>
" I- e. a( W% W c. Z! [5 p - #include <linux/sysctl.h>5 H" p) B5 m" I8 g8 k; O8 W
- #include <linux/mm.h>' y3 M$ R0 F! z, l1 |6 g
- #include <linux/dma-mapping.h>( e' e2 p* K" ]/ ~8 e8 X/ S
" r+ X) O" M( G8 H; \% W- #include <mach/memory.h>
. q4 S) G7 I4 w/ }. [" M+ d - #include <mach/hardware.h>
- g! Q2 o8 P/ F5 c, p$ Q1 h1 @ - #include <mach/irqs.h>
) w7 B7 P* r. ]; d! F - #include <asm/hardware/edma.h>
R/ J" A5 I$ i" l
, F7 P3 @. p% t" o% O- #undef EDMA3_DEBUG1 R! B# k" s G2 X/ ~! z
- /*#define EDMA3_DEBUG*/# y$ v, R4 r/ @0 L4 _
& z; W! z, u+ L9 q- #ifdef EDMA3_DEBUG ], F/ r. }/ [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 u, u o* J: x2 W8 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. {! F: C: C7 e7 E5 X/ O# [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ j4 P$ N% J, l - #else" o- @! n) o, j0 f% o' R$ X
- #define DMA_PRINTK( x... )
$ \; m3 e; T9 h3 F - #define DMA_FN_IN
; y# c" w3 f0 L& x7 `) L: K9 c - #define DMA_FN_OUT
& ~8 S) M& V; D0 f# g$ ` - #endif
4 m V0 p) v8 W - A" f. L0 N" U5 i1 E1 M# p8 {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ n0 Q' p6 Y$ }' T8 N; m, r - #define STATIC_SHIFT 3
o0 c0 z! Q( U- J - #define TCINTEN_SHIFT 204 U$ A$ ^+ G0 ?) J8 l8 s+ ~
- #define ITCINTEN_SHIFT 218 [: Q. h9 H. i5 i# p& B
- #define TCCHEN_SHIFT 22
p6 T& q# R3 D+ e5 J6 F( r1 J - #define ITCCHEN_SHIFT 23
/ V4 [! G8 s5 P5 V; l4 L
8 T) L. E8 h m1 t( \+ p- static volatile int irqraised1 = 0;8 ~$ [/ a2 r: Z2 p
- static volatile int irqraised2 = 0;
" L; g. ^1 L& f+ ^+ C - ( j- m3 r9 J. P% F1 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s7 p c4 S1 z$ _% V& @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p: q" o! S7 Y, t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ O9 z1 T# _$ ^; m6 C0 I - 7 K. q# h: H5 ?0 {! o: G
- dma_addr_t dmaphyssrc1 = 0;7 x; i7 L5 i( W1 h8 d$ L. M4 \
- dma_addr_t dmaphyssrc2 = 0;
7 y \" G" ^& U# u4 U: n* W1 f) Q - dma_addr_t dmaphysdest1 = 0;1 { p% F7 i7 E& P
- dma_addr_t dmaphysdest2 = 0;; t) ]- |" X2 _
) N4 M* d3 M9 Z P- char *dmabufsrc1 = NULL;
8 n' C4 ?% d0 Z0 m# Z# L - char *dmabufsrc2 = NULL;0 ~5 s; a! O {8 O/ H
- char *dmabufdest1 = NULL;
: [. F9 u$ O" y! [, s - char *dmabufdest2 = NULL;
1 T4 S1 Q# X9 s {8 s - # P- i: B9 W& X. A! i5 W* I
- static int acnt = 512;4 f, a B; ~" |
- static int bcnt = 8;2 {. {2 T4 u$ j! n
- static int ccnt = 8;
( v6 {" n; I7 ^5 o
3 z; p) I }. ^2 J% P- module_param(acnt, int, S_IRUGO);
; C! t6 N# _5 g8 _! ` - module_param(bcnt, int, S_IRUGO);" J7 z, s) n* p; D% y1 {
- module_param(ccnt, int, S_IRUGO);
复制代码
( o b4 M; G1 S! v9 g
" B; U) Q5 X- o+ Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 p( G0 z. I3 E. a: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 u3 ?7 H5 z9 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: h; t3 U- c2 Z, {; M7 X
2 T% r, i7 q: F9 }- q
% h8 B: x6 t- ~ t
|
|