|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, l& u) n, p# I+ U( x' t: L' k- [code]EDMA sample test application
; U& a h( M7 m - /*9 M6 K/ M; y. t' c1 f3 X
- * edma_test.c e4 G3 M) ?! H# Y' u2 S( w E5 a
- *! c/ b# j+ @( C5 @' Q5 `1 d C
- * brief EDMA3 Test Application
5 s) O0 K" o6 H/ E: a& ` - *
% J! K% T+ u( u$ \" a$ j# ] - * This file contains EDMA3 Test code.1 e8 t# z* a4 j/ B1 E( i
- *5 A7 y1 c5 y; P3 I" J# O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- j* M+ j* ?- \4 P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 r" t0 X3 K5 g - * TO CHANGE.
' i3 s' j/ ~, l( Z* F% r - *4 @. ]& h9 d- p+ V1 m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& _9 N- t) g% a, T) T7 t- f - *
/ e* Y) {, y$ t- P; V - * This program is free software; you can redistribute it and/or7 y: G% [# h, K U0 W z
- * modify it under the terms of the GNU General Public License as
3 B) N! Q8 Y9 ^/ f - * published by the Free Software Foundation version 2.1 P8 \1 I, C# h& R4 o
- *
' i0 ?2 v# r" D8 p4 H$ h0 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 [1 X! W1 p" K5 L. _2 S \+ v
- * kind, whether express or implied; without even the implied warranty
; u7 H6 U4 c6 m8 l- Z& Q, s( s' Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# p# w. o' I/ X( O" S3 a - * GNU General Public License for more details.
6 C7 g; z* Y) z- ]& w9 N) N - */6 k+ y9 w6 T$ p; t# u3 T, Q, P1 j Q
! \/ g: W, z# [- y u" E, M- #include <linux/module.h>
; d" M1 I/ G6 |! Z9 ]/ x0 } - #include <linux/init.h>
, x' a6 G- V* J2 t4 X - #include <linux/errno.h>
/ d9 F8 d" u7 I. Z( t - #include <linux/types.h># Y) |5 x; `2 ^
- #include <linux/interrupt.h>
% M) H* @7 m8 t/ V/ f& S - #include <asm/io.h>! Y* o! l2 C) [$ e7 C8 O y* r9 {
- #include <linux/moduleparam.h>
3 h3 ?( C6 k0 R- d1 J; W - #include <linux/sysctl.h>1 ^' Z/ [2 Q. k; ]: w% r! Y
- #include <linux/mm.h>* v- ]2 s: |0 t3 o. I! M
- #include <linux/dma-mapping.h>
1 w2 c5 S! h' Z) I
7 N1 L9 Z. e, n! P5 |, y/ I+ p- #include <mach/memory.h>
6 _9 S b- J7 O7 a! q1 p - #include <mach/hardware.h> a1 N+ A0 Q3 k
- #include <mach/irqs.h>, S( ?. ^! F9 W
- #include <asm/hardware/edma.h>1 ?5 s- I1 p' W, E+ W1 ^5 `/ `+ g0 w
- 5 E4 U, z+ |& q
- #undef EDMA3_DEBUG
# A3 y4 G3 A, x. ]& k8 n - /*#define EDMA3_DEBUG*/7 e8 o5 f8 Z9 V9 _
1 g R& ]9 s- `0 C+ ?9 @& X- #ifdef EDMA3_DEBUG
M6 h4 k% c- c1 p2 U& o0 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 r: G( L, o) A' a% L' B( ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 F. V; T" t4 D2 |1 |' ?* N! ?# W" |9 Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& F" [5 g @, X. Q* } - #else
1 c5 `) d' ^. }) @% }8 } `$ D& m+ e. X - #define DMA_PRINTK( x... )& R; ]/ h7 h- t/ V+ `5 D3 v
- #define DMA_FN_IN
# c1 H8 |2 n) P/ k, N( r$ j - #define DMA_FN_OUT3 ~! Q+ E/ ^2 F/ m% ^7 m7 @
- #endif, {& }/ u0 V7 H: E. J5 m y
- + S1 T3 ^( U; q$ z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 u9 z2 ]; {! C) T8 J0 n5 v. L2 Z1 J
- #define STATIC_SHIFT 3
a$ L: }1 L; t$ ~) C - #define TCINTEN_SHIFT 20
. s; }+ D' e" l# R& ~ - #define ITCINTEN_SHIFT 21
, ?: h2 \* B% g+ Z$ d8 y9 T9 J" l; J - #define TCCHEN_SHIFT 22
6 ?2 n) d- N0 U% j) A. m - #define ITCCHEN_SHIFT 237 C/ A* p& J8 S' x7 A) u
- 5 Y' D0 w2 ?" _ m; Y5 m. b
- static volatile int irqraised1 = 0;' K3 M( _0 V8 @; w/ C
- static volatile int irqraised2 = 0;* M# R4 e, v+ X$ g( Z8 |9 T7 B+ N% ]8 l
- ) q' H* S) @, J5 |' D0 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) i/ w2 q4 F, q, i4 d* T6 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 S( r I7 p9 [9 g2 u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. G2 |% f" R# g( a) P' G
% v$ ~* b) N1 C1 a- dma_addr_t dmaphyssrc1 = 0;7 {. f6 `; S! V, S5 j
- dma_addr_t dmaphyssrc2 = 0;. H8 t" X. u0 P
- dma_addr_t dmaphysdest1 = 0;
# J3 r1 ?7 G8 @! G6 L( K - dma_addr_t dmaphysdest2 = 0;: y3 ~6 ^' k9 ~6 [- p/ ]
- + K% i' W) E/ N* j2 ?% y
- char *dmabufsrc1 = NULL;$ ^5 }# I& B3 B* g: _
- char *dmabufsrc2 = NULL;
L, Z7 X* Q( }/ _' } - char *dmabufdest1 = NULL;
1 S0 H0 J3 H0 C, ? - char *dmabufdest2 = NULL;
! Q4 l/ \+ B* ~! C0 Q. d. z" b
- M9 \+ o2 ?! x, W- B- static int acnt = 512;+ k Z3 d4 c6 l7 u
- static int bcnt = 8;
4 Q5 f: h, m9 R ~5 Q! j - static int ccnt = 8;1 [: r% C4 }) _: U% m. m6 i) f/ O
) Z* P& {7 m: Q b9 a. X H- module_param(acnt, int, S_IRUGO);
! B1 w+ d' n$ I F5 U h5 ]( q' v; c6 ] - module_param(bcnt, int, S_IRUGO);/ r9 `" m+ Z) \ n& I; t- m, D( G7 R2 ]
- module_param(ccnt, int, S_IRUGO);
复制代码 , w+ A" W! S0 B, Y; w1 v- ?6 b1 v/ W
: Z+ g6 c6 ?9 P$ A& q% {$ ?$ i7 | F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* @0 U4 \* b& v s0 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) m$ p" c! ]! _# ?9 ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 \9 X3 m% Q! J! y' Q4 `9 p. B j4 I: c) g+ R
8 z7 ~; a: W% M9 O7 ] |
|