|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 c9 f1 d9 |; v- [code]EDMA sample test application( O9 n# Y5 Y/ E8 z3 n$ I
- /*
B& C1 ]. K% @. e5 l+ c - * edma_test.c
4 i; r# ^% o6 Y$ n - *
. `% O" u/ K( j& g - * brief EDMA3 Test Application
* h9 n% P& u& I - *
! U3 R# Q; F2 G# j3 F5 }- j, Q3 a - * This file contains EDMA3 Test code.
- Y. i: q: j Z - *
8 \9 O- p( I3 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& P6 `' v8 ^. @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, J8 |+ K+ E, H - * TO CHANGE.
3 Y' S. ?' G, [) n, g, ^9 W' ? - *$ _7 T# F6 ]) I4 U3 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% w; }$ T6 P( z+ c) H, ~' a& z5 v - *
" z, u) z! L" _* @ t( } - * This program is free software; you can redistribute it and/or
1 N: ]" ^% K0 C% Y: T3 M2 q* q - * modify it under the terms of the GNU General Public License as* e; ]% F! q$ I- X+ n
- * published by the Free Software Foundation version 2.! F( X1 |/ f/ @1 Y# q
- *
3 ^& z& ~& o% K2 a% ]/ [! N& ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ @" z- ^2 R5 s) |: B h# ^/ z
- * kind, whether express or implied; without even the implied warranty
' ^& D( Z# v+ F1 y" V! o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! Z3 S& b$ R0 |2 A6 B
- * GNU General Public License for more details.0 I6 }% n& V: Q) O9 B* x% a
- */
9 R9 c6 m. w* m4 U2 d2 v3 i1 b - ; e6 g- }# r0 | B7 s. e( i* i% @
- #include <linux/module.h>
6 f5 p$ t( C$ ]" A, n! o - #include <linux/init.h>
) D, d8 E8 A9 q2 J; t" a - #include <linux/errno.h>
; L! |0 x4 R# X- d9 e+ K. @4 Y - #include <linux/types.h>6 ^# b- r& O L
- #include <linux/interrupt.h>/ ^9 M) Z7 f) {( c- c( u
- #include <asm/io.h>
. _9 V P' p$ I" }% N- Q - #include <linux/moduleparam.h>- {8 [# X" J [$ P
- #include <linux/sysctl.h>
" g1 Q$ Q% F/ m: _0 @/ a1 n: X - #include <linux/mm.h>8 n1 k( ?0 y6 |- w" ]- h! l4 X
- #include <linux/dma-mapping.h>& W9 T6 ~) E$ X) Q5 `
- ( y# X V- I1 p4 M9 ]
- #include <mach/memory.h>7 Y% {7 p. [4 Z& \
- #include <mach/hardware.h>
! X" K* J# e8 f2 n - #include <mach/irqs.h>/ S5 F) _; ~: z) \( \* F. Q
- #include <asm/hardware/edma.h>
' I. [' G) ]* } - ) n! u1 U6 q/ w
- #undef EDMA3_DEBUG+ U( b& F0 x/ s+ Z
- /*#define EDMA3_DEBUG*/, D0 k! o8 r$ J& }: Z
- 3 `$ R, U, [8 ^) ~5 \
- #ifdef EDMA3_DEBUG8 T; ]) z/ `& U/ z/ d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' c y W( U4 X4 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' a9 Y7 D8 w# J( i+ J8 `' s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 o6 y# Y8 k/ W3 {2 _0 ~! n; i
- #else
6 ~3 |* K$ e, ]0 I - #define DMA_PRINTK( x... )" L/ d" V# H( |) B
- #define DMA_FN_IN
u9 a4 o! F0 }6 U& g, r* W4 {7 V - #define DMA_FN_OUT
' y6 C+ ^% e2 j- g" H5 q, a - #endif- R2 M3 F: g! M4 K; K$ y
- $ V" v4 I% j# V
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 q! s, t: A" W! l. W" W6 V
- #define STATIC_SHIFT 3
6 }: ^1 g8 J, ]& p. N - #define TCINTEN_SHIFT 20
% U; |0 n O4 O2 Z" y! u - #define ITCINTEN_SHIFT 21
8 [; [/ f3 E4 S7 n' A- [, j$ ? - #define TCCHEN_SHIFT 22
4 [1 U, M! Q% { - #define ITCCHEN_SHIFT 23
2 r% e, N6 J5 O: X- ~+ G - g5 F. H6 M/ i# W) t
- static volatile int irqraised1 = 0;1 ~! y0 t( y' K% a# `
- static volatile int irqraised2 = 0;- O/ M& s" L4 U$ W
- , M; |8 t/ G% l! O/ R) Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& w1 d% t H( }6 Q+ U! V" G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v: o9 q; c0 f& h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 D. ^8 \) c7 f, [% E
. G$ m6 v! N# X- dma_addr_t dmaphyssrc1 = 0;* p d4 y: P2 t/ N3 o; v& k
- dma_addr_t dmaphyssrc2 = 0;/ O: o& t' }5 D& Y& I
- dma_addr_t dmaphysdest1 = 0;
; \3 _2 }( ~2 G, S; g; ~ - dma_addr_t dmaphysdest2 = 0;
0 U) z1 w P/ `# e- C* {5 y8 ? - - Z# B8 O1 s% M
- char *dmabufsrc1 = NULL;% p3 k5 i- A/ ]- V3 Y" ^5 ]/ ?
- char *dmabufsrc2 = NULL;0 H6 I- [% x* r5 [0 Y
- char *dmabufdest1 = NULL;! Z, D* `- k! f5 W. i7 [
- char *dmabufdest2 = NULL;
O6 p' W% M0 X; @ R( F9 D5 W2 ^8 x
8 a* B( @0 e/ @3 u- static int acnt = 512;- E2 H, o$ a- r2 |5 q1 M
- static int bcnt = 8;
@( v$ ~' Y: k7 k/ v- r. u' u - static int ccnt = 8;& u$ P9 s% w; o/ l% ^ @* J+ T
" w% M: M, M0 L2 s7 O- module_param(acnt, int, S_IRUGO);
6 P# I1 P* a5 n$ {# Y - module_param(bcnt, int, S_IRUGO);
2 L3 H: A, H1 a* O: H0 g' t - module_param(ccnt, int, S_IRUGO);
复制代码 * K" V+ b+ X: Z/ X9 R" j- _; o
( \. j- E9 r( w. M" |1 \5 n' n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 h) t4 d7 D: Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& D" E1 M3 y4 Q2 C' d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 t9 ^) q& N( t4 L6 ~/ g0 t+ C& B
) l4 i* x$ m/ R6 e, c0 \/ m! t4 U: \% Y9 K
|
|