|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* t3 U* @ i2 F( \/ ]3 B' x- [code]EDMA sample test application3 ^9 I3 `% Z/ }$ n
- /*: o" }/ ]8 j! i) u( O
- * edma_test.c, k% X) [* \4 r5 Z! x( Y
- *6 u, }9 U f; f+ u6 U
- * brief EDMA3 Test Application
3 \# h1 N( J2 i% W6 w0 {* b4 t - *1 Y7 \1 X. q, I; K9 G- G
- * This file contains EDMA3 Test code.6 D, V: R# n" T$ @ r/ d
- *
7 B# J: m2 |! W+ M& M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 g, ^% e3 g' M# f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 v! f, [- z* u0 s8 b! X+ I
- * TO CHANGE.; o D3 R& Q! C! D1 o
- *0 D6 p4 F V$ u% b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! B+ e4 v N- S! B! ] - *- F, s) {, w# i- C
- * This program is free software; you can redistribute it and/or X" p" r) V3 H0 j% ~. x
- * modify it under the terms of the GNU General Public License as
% c9 M( c B, a4 p - * published by the Free Software Foundation version 2., R, L+ }; g- [ G( b; H1 e
- *( Z2 u8 l7 T+ C7 n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 V) P/ G- M) J0 M4 S - * kind, whether express or implied; without even the implied warranty
, S, ]6 w9 X; h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 _ g' i2 ^- e! Z
- * GNU General Public License for more details.
, m* r+ q3 z b" Q0 Z+ C6 c, n - */9 v3 k9 N1 l+ t
- ( K6 w# u: U _ |
- #include <linux/module.h>9 }) \" ]3 q6 L4 T
- #include <linux/init.h>$ e7 ^) c& W( C0 g7 w
- #include <linux/errno.h>
. j M; W. O, N7 B" ?4 c - #include <linux/types.h>
/ X9 E9 k0 C! x' V: D. A' j - #include <linux/interrupt.h>3 o# f- {( F; h9 v% |5 P9 z
- #include <asm/io.h>
) q& H/ Y1 q( ] - #include <linux/moduleparam.h>% v: b4 ]; `) t
- #include <linux/sysctl.h>1 o5 ~0 y n8 v7 a
- #include <linux/mm.h>
$ @) K) k( V. q - #include <linux/dma-mapping.h>
0 @5 y; s& m" |* q* T' A0 w& _
}+ p. c3 r' Z" {, [7 G+ v. e- #include <mach/memory.h>
# A+ ?8 F$ a. f+ q5 Q% @ - #include <mach/hardware.h>
* S1 U; F4 e9 q - #include <mach/irqs.h>
6 k' y0 x# m$ |: r# x. m - #include <asm/hardware/edma.h>
4 M! w* ~1 |9 k7 W9 o - ' [' G4 ^: P( ?( E- x o
- #undef EDMA3_DEBUG
2 G3 v" y4 b3 H, { ~9 x - /*#define EDMA3_DEBUG*/
- P9 C' X$ z/ ?: ~9 E1 l$ ^# [
* f0 n- P4 g$ j2 g, M7 W' m- #ifdef EDMA3_DEBUG
, ~/ V0 w3 ?& j+ y7 w# g8 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). s6 M- m# c6 ?: J/ w6 v
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
D1 x: ?. \8 N8 x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 D k$ q+ ^7 ?5 i0 g - #else7 N/ \* P* d2 I
- #define DMA_PRINTK( x... )7 W' a9 W1 @) g, H
- #define DMA_FN_IN+ m9 \0 s% m/ a" a' d& D$ [8 m
- #define DMA_FN_OUT
, |. A0 ^1 [/ p& h' Q - #endif5 h5 N) E5 }) `# o- e7 u4 C3 `- T
. N* t6 D. ?/ @7 i" f6 Z' i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 @4 w! u2 r4 t( r2 ? - #define STATIC_SHIFT 3
/ q% B9 v7 W5 H6 Y" U8 s, k - #define TCINTEN_SHIFT 20
8 e$ s- I! R% J! a7 G. i - #define ITCINTEN_SHIFT 215 I* f; T, }# {- w1 B: \
- #define TCCHEN_SHIFT 22
2 `7 Y9 H" u; X: K, w - #define ITCCHEN_SHIFT 23, @. w4 u" C- B! o
- # T- |/ I$ |7 R- K
- static volatile int irqraised1 = 0;0 q/ u; f8 y1 R8 v3 g0 I9 e
- static volatile int irqraised2 = 0;
$ U# n1 C: D) u1 S - $ r' Q) q% w! \$ a0 x, y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _. Q3 h X( u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- Y& _* ^* O) S+ f' h) ~9 K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, O' c0 g. {, `4 p - , e/ u# |% I1 z5 h6 a+ P
- dma_addr_t dmaphyssrc1 = 0;( P; U% ~$ |+ d6 E4 O; N0 c
- dma_addr_t dmaphyssrc2 = 0;% M9 Z: Q M6 A
- dma_addr_t dmaphysdest1 = 0;# Q+ A j7 O- | h
- dma_addr_t dmaphysdest2 = 0;2 N$ F: @: i% x* }- d% c3 q" q
- $ I/ |5 B8 S; [9 L9 h1 G, T
- char *dmabufsrc1 = NULL;) s/ c& u' z4 p, ~- n' ?/ h
- char *dmabufsrc2 = NULL;! F( D! O. m; s" i/ F9 o4 z6 u
- char *dmabufdest1 = NULL;" _; u9 f0 `2 W
- char *dmabufdest2 = NULL;
! E( n% c7 ^3 f. Q3 O
' Z8 v- n- E8 Z, Y, k8 C- static int acnt = 512;
; L! {; s k; o( L9 p( } ] - static int bcnt = 8;
. e7 ~- h5 b" \3 v; a* S - static int ccnt = 8;
" ?& X* f$ w% _! T/ z& M
7 m# Q2 O* {/ }: Y. O4 r4 w+ Q1 ]- module_param(acnt, int, S_IRUGO);
: W1 T- Y6 v7 S0 v - module_param(bcnt, int, S_IRUGO);
- V2 d4 N6 \, q h+ \5 V - module_param(ccnt, int, S_IRUGO);
复制代码 8 H0 p2 t( w% P& b+ O* ]+ |
& i8 h+ n. n1 Q Y" l( R6 z3 P1 Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- o L. W# e! G+ |$ D1 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* G) ^7 h2 K! _2 S# d. r! p% t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 k- D* m! }1 }9 ]
" `! S" r4 S- e
1 ]8 s3 k5 q# |
|
|