|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 y7 \4 J% W( a8 U, e5 k
- [code]EDMA sample test application
& [4 h* d5 b0 H+ A$ K - /*$ V; d! F4 F: L% j
- * edma_test.c7 F7 r6 W ^2 {2 W4 h4 f V
- *+ |3 w' T/ Y8 P: E; x) ]
- * brief EDMA3 Test Application# E% v2 f& z9 Q; y2 _
- *- O, A# N5 f( i) H
- * This file contains EDMA3 Test code.
! ~, j0 a# [: A5 c+ u3 n& ]( g - ** ?+ n" B3 Z/ C- O5 U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. f, k1 P% m6 J x% C0 i* v$ N, B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* l, I. U `. ^ - * TO CHANGE.
4 P# h( c3 i# }6 S5 t - *
; l. z- q/ f, O' ?: m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- U+ f( B7 X3 d" l: ~ - *
( N3 d t. o( D - * This program is free software; you can redistribute it and/or
2 c' l/ `$ i# e5 f5 U6 [+ B' i: y - * modify it under the terms of the GNU General Public License as% i6 n! A7 t) g8 t. \0 v
- * published by the Free Software Foundation version 2.
1 p7 s' c3 p& P- ^6 Z' S - *
$ r5 F& L; Z B) T I4 f, _% ~2 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) h, D' X" O) t; V$ D) y - * kind, whether express or implied; without even the implied warranty& |" E- K$ d# i8 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 G/ P& T& R6 \) f8 i0 ~; M
- * GNU General Public License for more details.* n' |# |3 D- i9 Q
- */
/ J9 j9 A- n' H( c% l2 E
+ R7 J3 |0 Z. I' T7 D- #include <linux/module.h>; `, e7 z3 B/ i# K. d* g V) q
- #include <linux/init.h>5 G3 [" H: z' m' D4 O& U
- #include <linux/errno.h>
, U! @; w6 h4 h C N/ H5 H - #include <linux/types.h>
/ `$ X5 ^% f B% N - #include <linux/interrupt.h>
: d$ N# F* g" K" g" n+ _. J) H - #include <asm/io.h>
; Y9 K7 |. Q5 n- g5 i' g - #include <linux/moduleparam.h>( v* s0 D: s$ J& \. z
- #include <linux/sysctl.h>
6 L. ? P! j( f, u8 g - #include <linux/mm.h>% L2 `) \* t9 F ?5 F% v; J+ Y" D7 e
- #include <linux/dma-mapping.h>
( V4 |4 K. b3 T7 H H" z& A3 v% M: ~ - : H" b1 {% b% a" S
- #include <mach/memory.h>5 t6 x: T9 N( S% z. a
- #include <mach/hardware.h>
6 Z+ z2 R# G& p8 I: K - #include <mach/irqs.h>
9 |% W- {) p( b, E$ U( l - #include <asm/hardware/edma.h>
, M8 I7 {8 s$ U& ^* I Y - , J8 t1 W8 x2 x8 E3 w8 ]+ x0 s
- #undef EDMA3_DEBUG e5 K u! X9 u, G
- /*#define EDMA3_DEBUG*/
2 @! e" C4 ~7 _4 \. {
/ ]0 t9 ~1 X9 L Z- #ifdef EDMA3_DEBUG; W5 S# b" v, I' H( I: @7 {3 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): q; U2 k7 }" `. F0 V4 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 B p8 {2 a* O- k9 c$ t: Q+ P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 u1 L: A" R( L" \* x$ o0 N9 C1 N - #else
/ x% U' s# o6 Q9 q: ~ - #define DMA_PRINTK( x... )6 X- H6 k V1 o0 Q2 ^8 ~* S7 }
- #define DMA_FN_IN5 k: {1 ? e5 C* a! l8 n2 b
- #define DMA_FN_OUT& f' `( ^2 n7 W N' ]
- #endif/ s! u0 M# D& ]4 u1 I5 r
' m+ i+ Y4 N* o% Q3 ?! B2 D) D4 C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% \+ ? O: @1 p. `7 R% t - #define STATIC_SHIFT 3
& I7 |3 i) g) @% x, n - #define TCINTEN_SHIFT 20
0 f: P# u2 {9 s* F5 ~ - #define ITCINTEN_SHIFT 21/ a9 n$ o) u3 P& D# B5 D2 ]8 K7 M
- #define TCCHEN_SHIFT 22! D, l4 h+ E9 |8 H% i
- #define ITCCHEN_SHIFT 23
4 e( `1 d- `8 I B( X% P ? - ' h( g: }& ]# v9 ], I' s
- static volatile int irqraised1 = 0;
3 i1 _6 p1 h' e - static volatile int irqraised2 = 0;
7 c1 C7 Q* w' d4 y7 O
# I$ G1 j1 ?7 ^) K/ |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% u( d( l: g* [* A0 e r, G7 ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 l, T R; F& g2 w# m0 U5 t2 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; J6 Q: R( ?! { - % G7 E7 G, D6 t6 x- C7 n
- dma_addr_t dmaphyssrc1 = 0;
5 ~+ ?( g+ t3 C/ t, J - dma_addr_t dmaphyssrc2 = 0;! X0 f2 I9 ^' `% `$ D
- dma_addr_t dmaphysdest1 = 0;7 k$ g$ L, V) `. g6 E. c" }* Q
- dma_addr_t dmaphysdest2 = 0;
; ~: X2 c$ m6 p9 y
8 \1 `7 N7 |2 c6 D3 [; c- char *dmabufsrc1 = NULL;
$ z% S: u1 b; N - char *dmabufsrc2 = NULL;
; M1 t- b7 V4 [8 ~: k - char *dmabufdest1 = NULL;" ~$ M" G; N$ w: t5 V! q
- char *dmabufdest2 = NULL;
3 w- l/ X7 T2 M1 m$ t - ( ]5 Y2 ~, k' Q& M/ i
- static int acnt = 512;
3 C7 B' x1 r# z4 w$ ^7 L9 { - static int bcnt = 8;5 q1 R& R& t0 B6 H
- static int ccnt = 8;
5 A @" \7 `/ |# } - % N8 j* S# w0 k, D4 L" a* Z9 D- d
- module_param(acnt, int, S_IRUGO);
2 `1 c; Z# @# Z( D; R$ b4 y - module_param(bcnt, int, S_IRUGO);% I' f# y8 @8 Z& C# s6 a2 o: x
- module_param(ccnt, int, S_IRUGO);
复制代码 1 c E3 i/ ^* F3 w" E4 k
2 M7 R3 h' Y' A5 h0 |1 \ @* [$ a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% ? c. u: z. F3 _8 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ Q6 }) `9 B2 c( Y9 S4 G. q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 e8 V0 o) v" c/ X
6 a5 ~& T0 B" |! H, k! ?1 P: k
$ x* F! u0 c! M |
|