|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. k0 K" A g. J: c- [code]EDMA sample test application
, c" a. d# Y$ h* i2 {7 f - /*; L/ G$ N% J) o! X# p
- * edma_test.c
) u& @0 M( C9 D - *' X9 @9 e, u# I# H2 D6 E) A/ Z* F
- * brief EDMA3 Test Application; n" ^! Q( {/ R* q
- *
; b, U8 J$ n- P/ |& R4 W' H4 y5 s - * This file contains EDMA3 Test code.+ M5 X) u6 K! y7 Y
- *& \7 Z0 c; n9 S( C5 k# a* P4 Z7 {5 I+ }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: J% B. T$ J% f% }6 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 N4 }6 h7 o* T" r. H) W
- * TO CHANGE.. |' ~9 a4 ~! J2 ?, O5 V: _' N
- *$ `, c8 T* n& w+ x' u5 @ R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: P, D8 }7 f6 x7 W: U2 X* D
- *
* X0 O$ u# G- _, f - * This program is free software; you can redistribute it and/or2 _$ I0 k/ S6 K2 K. G2 n
- * modify it under the terms of the GNU General Public License as
}. l# c' C1 P+ }3 F$ K - * published by the Free Software Foundation version 2.( V& j: k! H+ e) F
- *
3 X& ~8 t4 R( }* y2 k, w2 t/ s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 \- ~4 O, `7 c- S& ?0 o, x/ B
- * kind, whether express or implied; without even the implied warranty
$ R9 w. T% y. P+ \) ~$ C - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 d4 c; Q. B* d5 _) ~ - * GNU General Public License for more details.! p2 f1 _5 l" Y0 e6 }
- */
" A8 }" O0 z8 S: X8 p- Z% S/ m
' w. R% l# l/ [; @6 `3 c n- #include <linux/module.h>+ j. W8 h6 F' c
- #include <linux/init.h>
9 P$ L }( E6 ^' V - #include <linux/errno.h>, |& S* d# x+ q8 j1 h. s ?) U
- #include <linux/types.h>
& a* B z5 X+ U9 m+ g - #include <linux/interrupt.h>5 J3 h; [2 L E7 n! F1 `4 K0 F4 T
- #include <asm/io.h>& `+ n9 j2 u* l# Q
- #include <linux/moduleparam.h>
N" X" \' U+ r Z+ A9 G - #include <linux/sysctl.h>
) ?6 q3 S `1 H - #include <linux/mm.h>
4 Z: z/ I. e6 L1 K; d - #include <linux/dma-mapping.h>7 ?9 m5 m% d; ?/ \0 a
) d3 V# O* Q7 @* y/ L; @8 f- #include <mach/memory.h>
5 ^: z0 l3 X+ X! o4 _! L2 m5 j - #include <mach/hardware.h>
9 E$ l, l E5 P# }# m" H- o, K - #include <mach/irqs.h>& x% x* Q1 d& P6 W
- #include <asm/hardware/edma.h>% D: E) n' ?# q: D, b
3 V7 I$ H \9 l5 Z- #undef EDMA3_DEBUG! Z, N- w; U- J) |
- /*#define EDMA3_DEBUG*/0 H" j7 e/ _* X' u9 W' q5 I, ]/ b
- 3 g0 K6 R" T% C7 @
- #ifdef EDMA3_DEBUG
9 }" e9 A0 Z% ~5 |6 |' v" w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 i# k! p9 `" J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" b% x. x% ~; ]8 ]* [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' j. \4 q* L0 A# a' @& B - #else3 ?% H7 F& i0 D @% {/ _
- #define DMA_PRINTK( x... )
7 ?" q3 T: c! y+ d5 A0 y - #define DMA_FN_IN
% C) m9 r% J2 V8 Q# A2 i( r1 B& N$ }) G - #define DMA_FN_OUT
( Y* N1 \7 |3 a - #endif
3 v6 m. W3 d# ?. [9 a0 m5 a% e - . R3 G5 Z, N3 _2 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) F. z5 [- ]; q# m) q- K4 A4 {4 v
- #define STATIC_SHIFT 3' c" M# Z, t4 p$ d/ H
- #define TCINTEN_SHIFT 20
8 C! V) b; {& D' W4 E - #define ITCINTEN_SHIFT 21
9 m9 z7 w3 R* m" V2 x" V; [; ^7 p - #define TCCHEN_SHIFT 22
, [4 o+ B$ X; x, {. P; x# T/ q, k - #define ITCCHEN_SHIFT 23& {, Y% ^: U/ F
; O2 c+ r! d! A8 A; E3 s- static volatile int irqraised1 = 0;; w, y. j1 C& R2 i
- static volatile int irqraised2 = 0;
( k" g& o$ N, ~+ t( z5 X
; _* G/ c% I% e" t2 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 \5 Q! H3 [& G" W, d9 h% J - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ C2 I& ^% D) | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, Q0 O, E1 ~3 B" P
) S# s7 N& C4 f) W7 v- dma_addr_t dmaphyssrc1 = 0;
7 _% L- S4 V! ]0 T' u9 Z5 q/ e3 A: b" w - dma_addr_t dmaphyssrc2 = 0;
/ l! g1 |3 l% D - dma_addr_t dmaphysdest1 = 0;) _3 h: U* @, K# A
- dma_addr_t dmaphysdest2 = 0;
0 F7 ]" O. d) Z) v2 J9 \" O
p! X y. G9 y3 V, N- char *dmabufsrc1 = NULL; { K% \; G" S& C; j
- char *dmabufsrc2 = NULL;2 E K, c, P0 g, l( x6 r' _' X
- char *dmabufdest1 = NULL;4 v* P1 m) `7 g& o8 X" A. k* s" i( X
- char *dmabufdest2 = NULL;
$ e" W9 ^( j% k3 \9 g6 M - X0 g0 ?; s/ ]" D
- static int acnt = 512;
* b. k% N$ |$ u- u$ M4 c - static int bcnt = 8;" X, l) J; _+ Z- M6 c
- static int ccnt = 8;
- J. q- l8 a" ?6 V* J - ' I7 E2 t# [% s: T7 J9 s3 d3 c
- module_param(acnt, int, S_IRUGO);
0 O0 g8 X1 S( F - module_param(bcnt, int, S_IRUGO);
7 ?& G2 P7 }. U: |4 l- k - module_param(ccnt, int, S_IRUGO);
复制代码 3 ?+ T& K% \4 x2 {9 X+ P
8 }9 d; \) K5 ]" d9 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* T v8 t1 o0 L5 ]9 Q- v9 V% Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) g+ y8 `" H+ l% B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 I8 x. j l/ z7 o6 h1 q5 l
+ `3 P9 E6 u" Q+ I" C# U" j z8 a% X
|
|