|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, B4 s# L _3 H8 |$ E7 X- [code]EDMA sample test application; N; W8 W; F; S; v T
- /*6 ~! j, B7 J$ P
- * edma_test.c/ ?& T, m, X$ ^6 e0 G
- *
j5 d6 r$ z5 P h( c9 Z - * brief EDMA3 Test Application) f+ K }% I( ^5 w' Z
- *
- q/ F- }! \$ h - * This file contains EDMA3 Test code.
4 e6 |$ I5 B+ D) \4 L7 Y - *
% a! H1 c' d9 p$ ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ l! F* Z9 N, `& M m0 V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 z5 h# D3 L1 \6 Q - * TO CHANGE.
( }1 f" k8 S0 J: b, B: D# D - *, @. v0 W8 o' j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ]8 x- O3 z6 Q2 ^! F8 v3 ` - *5 u; s% O3 y; i) W1 V, {
- * This program is free software; you can redistribute it and/or
7 h. f' V! r5 x) q" X7 s - * modify it under the terms of the GNU General Public License as
' Q) M7 ?! w$ u0 w, G$ r) d - * published by the Free Software Foundation version 2.
$ {$ d4 N1 k- n3 N; w5 ?6 w3 M, D/ O - *
; j) a) s* i! c2 y0 s' A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: o# ?. C# \* w2 Q
- * kind, whether express or implied; without even the implied warranty
. o- m2 `* ?: V+ {2 i. d! \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% K3 S; t0 e/ ~' P' m; { - * GNU General Public License for more details.
& q' G; C; R- v5 Y; D - */: X+ M+ c) R; d) U/ [6 G6 x' Y9 W; Q
. S3 ^6 {7 k; \0 d/ |2 F- #include <linux/module.h>
$ _$ e5 l0 M) }& `* F5 B8 K - #include <linux/init.h> t9 g; p# D; s4 }9 P6 h0 G2 Y
- #include <linux/errno.h>
" j: T9 x7 X4 f. h- @# Y) F - #include <linux/types.h>* N6 w4 z* g: q& O3 `- S
- #include <linux/interrupt.h>
" l. y3 C9 r: B - #include <asm/io.h>
' u/ e% {6 a- f" t& ? - #include <linux/moduleparam.h># L( B4 o. f, `
- #include <linux/sysctl.h>
' |0 \+ U, T, O( k$ O T - #include <linux/mm.h>
0 X3 o# u7 f/ R - #include <linux/dma-mapping.h>
: y" M: M5 N8 g' S8 f
+ p6 k3 X& a! D, O8 e- #include <mach/memory.h>/ W; e& @2 i" e
- #include <mach/hardware.h>
* O+ G( O; E, j3 q) W - #include <mach/irqs.h>
1 Y; }- h6 ? W/ l - #include <asm/hardware/edma.h>8 S" w' P K t: Y) o
5 E8 S; T- T4 ^4 C7 }- #undef EDMA3_DEBUG
4 ~' ^1 B" O. d, d I" ^ - /*#define EDMA3_DEBUG*/
1 @; C0 t8 J$ t: i" B, H3 ^0 M
7 i# i+ j4 ?" f$ G0 Z- #ifdef EDMA3_DEBUG
+ Q. c6 ^6 Z* @% }! m* K7 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! E1 j7 T7 R: f4 o) R% K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). Z# p: m- t$ x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ z6 r& |; u" n _
- #else; G+ H, ^8 x2 {, T/ p8 A
- #define DMA_PRINTK( x... )- S. x4 L% A1 `" r- j
- #define DMA_FN_IN! s9 L, D7 w6 H8 O4 m
- #define DMA_FN_OUT
& E/ S& F& s A" O% i - #endif0 |! I; M9 N$ M) k: w
- 0 Q/ D: }+ F! k) @. [: v/ [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 K$ {( o: O0 p1 x) b) S! F
- #define STATIC_SHIFT 3! ^2 c& g( w+ X7 [. B4 [ z+ s
- #define TCINTEN_SHIFT 20
( W6 T, M8 ]' h6 |: q& ]! \ - #define ITCINTEN_SHIFT 21
) D* V; o0 z& M5 ^, n; p - #define TCCHEN_SHIFT 227 z/ |( M+ B6 B7 b
- #define ITCCHEN_SHIFT 23# Y1 j1 T" u: r2 W8 S
- : a# f/ U4 G4 I, f* ?& F: i
- static volatile int irqraised1 = 0;
# _; Z; A$ `8 C8 a1 ^- ?3 E - static volatile int irqraised2 = 0;' U1 p7 j3 l }1 g
3 M `# X3 A' p& X5 R7 R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 z( ?3 i+ j) ^9 M( B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H3 y2 Q: f9 \1 v8 W6 z8 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ N6 R; y. r' M( z/ n, g9 g
5 `% K- L! L G/ k+ L5 K- dma_addr_t dmaphyssrc1 = 0;$ s+ D% \6 L7 Q1 n
- dma_addr_t dmaphyssrc2 = 0;( ^ T9 J; c6 ]; b2 c& b% u
- dma_addr_t dmaphysdest1 = 0;
- o$ ?; B3 [5 ~7 m# f$ [- Y - dma_addr_t dmaphysdest2 = 0;
* W* P4 V4 |, c# @$ l - # q( ?5 J& t& A2 d# t: q5 ~/ @6 Y
- char *dmabufsrc1 = NULL;3 T0 g% r" H, l0 a
- char *dmabufsrc2 = NULL;! G" x) ^2 T8 F; Z2 }% G# d
- char *dmabufdest1 = NULL;8 G5 a2 g1 P9 G; F0 B# @
- char *dmabufdest2 = NULL;+ X0 y8 Z' E6 h0 P, @7 l
@) c# [" u2 ?, B; T# G* A: r- static int acnt = 512;$ D. Z1 x: m# y" v5 h3 C; b
- static int bcnt = 8;
5 W( P- h, i- R - static int ccnt = 8;
% ]& j- ~' b- e0 w5 `- f
) R! _' V" M) U( [5 E) Y% Q- module_param(acnt, int, S_IRUGO);
5 _; P- Q8 U3 H% Z& r( M - module_param(bcnt, int, S_IRUGO);
4 ], j5 j4 M! h) a" g9 i/ I) J - module_param(ccnt, int, S_IRUGO);
复制代码
N5 e$ I4 [ ~; b* t% E" _
z. ^% ` u9 v" G6 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- _4 z( l8 @' f( Y, k( Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: e9 ?) G6 r0 o# Z6 [% ^( @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- Z2 f! V( F J$ W5 b7 A) \- S4 g4 O( T" C. i K4 u
$ A: O3 L' q( W0 J |
|