|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ R; |4 H) s9 ?2 d, Q
- [code]EDMA sample test application u( d: w% Z) _1 y* h
- /*$ `) Y- p2 h6 }3 \- A
- * edma_test.c8 _$ D( m6 r. |& c9 K8 N
- *
' e# J5 h+ |1 F9 ]! X- p4 ^ - * brief EDMA3 Test Application1 u" v& Z/ v: N4 R# F9 U' E% L
- *
4 p7 P5 c) F5 M - * This file contains EDMA3 Test code.+ s+ f' E' O' d0 M. P6 u5 _5 I8 D
- *
6 ^! W6 A; c, D6 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ R0 f7 p9 N1 [: W) G# \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 f, {& p2 D( F8 F/ }2 I6 R) a: {
- * TO CHANGE.: E- ^& o& n$ ^
- *
' _1 H9 }! K/ ]% P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ k* a/ h3 d% s9 ?! j
- *; S% f9 p5 i- r1 {# n
- * This program is free software; you can redistribute it and/or/ E! i) U7 q/ y4 L, Y
- * modify it under the terms of the GNU General Public License as
+ u3 e8 @; U3 C- P6 J - * published by the Free Software Foundation version 2.
6 J5 o( @" {6 V1 ^* c' k- L5 L - *' j2 k# }' @+ F: @% W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, V7 b. X7 _- C% y1 I6 \1 S; h( C) N - * kind, whether express or implied; without even the implied warranty( ]7 l8 `- V, l0 n( s2 ]5 \+ o; t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 o6 j& L) S3 U- e - * GNU General Public License for more details.. U4 _4 }5 D1 }4 D
- */( Z; u& L$ Y( G5 k& ]8 R5 ^# Y% x0 w
- 3 b3 V" Q* Y1 H& v
- #include <linux/module.h>
0 m% |' S2 t/ K0 G' c/ ^ - #include <linux/init.h>' ^; r! Z# V8 |! t- k1 @
- #include <linux/errno.h>
( c+ J7 b+ g! W, I! r - #include <linux/types.h>" w9 f0 _; Y& E- _9 M
- #include <linux/interrupt.h>
& m( z' u1 H& j0 s6 _+ { - #include <asm/io.h>
; Z B: z! Z9 E# R: N - #include <linux/moduleparam.h>
. I, N, w7 r! k( a- K - #include <linux/sysctl.h>
3 A! f: B; b7 z5 C* ~ - #include <linux/mm.h>, M: Y! |3 y6 l3 _8 A; k) ]6 v5 A9 b
- #include <linux/dma-mapping.h>
4 k2 E, ^$ C# L! h% u" Q - $ C+ |2 _0 S8 k' u) A
- #include <mach/memory.h>
}, A. K- W+ F& A - #include <mach/hardware.h>/ T% R! C% ]% Y
- #include <mach/irqs.h>* E' r- G3 t& Q! o
- #include <asm/hardware/edma.h>
$ @2 o$ U) G, |& x/ M: g$ Q8 D
" R& r8 }% G2 V4 s- #undef EDMA3_DEBUG# d; p2 [3 X7 ~1 Y, O# @5 T6 h
- /*#define EDMA3_DEBUG*/' J' u* b/ L7 e# S2 [1 P3 k
- 7 f) O" |# ^) \- F* W4 `; N7 X+ ^
- #ifdef EDMA3_DEBUG6 f s- X6 ]" H, F! @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- `% X. Y O4 |& C1 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ o$ f; ? {: K$ h, {0 D B& q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% y" z. h4 o, m - #else
5 Q3 R3 o8 A5 N R$ ^. p2 _. { - #define DMA_PRINTK( x... )3 [2 o3 D# [; ], F
- #define DMA_FN_IN% u8 J4 c" Z) H7 F% S
- #define DMA_FN_OUT; `- ^$ A B7 N, g1 j5 _! m3 J* Z
- #endif
1 N( H% E% @- O) d8 _% l I O& R* O - ! h: Y+ Y+ J% B) t' q; y6 F; P* u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( b0 g" }: ]4 A' Q3 O) h; G
- #define STATIC_SHIFT 3
2 b; ]2 Q. q9 \: u. Z - #define TCINTEN_SHIFT 20
) z6 _; G) L! E2 e% d - #define ITCINTEN_SHIFT 213 k- l9 y* _! b* v3 `6 p
- #define TCCHEN_SHIFT 22/ N2 j) h5 x# `1 l) B* u# F4 H. b
- #define ITCCHEN_SHIFT 230 I# e' A' {/ z" S
, o8 m; ~5 D& p7 Z8 {+ t- static volatile int irqraised1 = 0;
1 p, [( z; C$ \ X - static volatile int irqraised2 = 0;
( \! m; |0 a% h! ~4 D0 d7 }5 O. [
% B# e+ y8 }7 K$ x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
s8 v/ q7 m1 c+ u" [! z; [4 A0 L, W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% U9 s- x( s4 v9 y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' h7 y- }% X9 H0 O/ p2 P1 U
/ o/ d' a% b. ^$ e1 ^2 z- dma_addr_t dmaphyssrc1 = 0;
& G. h# O# O P) ?3 L3 b- j - dma_addr_t dmaphyssrc2 = 0;* Y# Q! z2 a6 b( P% C2 |# m
- dma_addr_t dmaphysdest1 = 0;
1 F; A" u H& f$ j. z+ h - dma_addr_t dmaphysdest2 = 0;- W. ]; S6 D; e X1 X" F
- 9 E" E6 |; R5 o6 t# c
- char *dmabufsrc1 = NULL;
( F; x4 z- l) F# t+ v+ v - char *dmabufsrc2 = NULL;
' c" s$ i% A8 Y( k - char *dmabufdest1 = NULL;
. O' A5 O' p( T& D1 w. {. w. l - char *dmabufdest2 = NULL;
3 _7 b$ |6 q8 m$ m8 l
5 v! T c* F+ m9 _1 D+ L3 w- static int acnt = 512;, Z; b4 u# K8 W
- static int bcnt = 8;) K6 [; r( z- C; ^4 ? q
- static int ccnt = 8;% |- d% l3 [" ^5 j
- 0 i5 W/ o' R, @* Z& ]+ f( q( s$ ~2 w
- module_param(acnt, int, S_IRUGO);# _( n% p3 H9 j0 E# ]9 u
- module_param(bcnt, int, S_IRUGO);
0 K9 {+ j1 m0 S W! d - module_param(ccnt, int, S_IRUGO);
复制代码 : }/ S3 W+ d4 Z9 i- D
, C# P* o0 t% k- Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 R) n+ U- c6 b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 N3 a, |( J! r' U6 i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 K5 f2 D4 Y7 X- N
: i% n' s* H9 y) T4 X8 c
/ q; O& m3 w+ a4 |% _; R2 @ |
|