|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; J1 P6 B k0 E; n$ }# p+ y- [code]EDMA sample test application
3 g' s3 U+ U7 G: \3 u - /*
; p+ {* z$ M% L - * edma_test.c
# J% W, T6 @' l" W" N) g4 z - *$ D( Y* n0 v ?/ S6 d
- * brief EDMA3 Test Application
4 G3 S; W" b9 `+ y2 ~( j; S$ U - *
) H: r. h [' i3 i5 Q - * This file contains EDMA3 Test code.3 _7 V* u) k8 e- x5 f: @
- *
$ y% Y+ Y. b! Q$ _0 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) A2 K$ C9 o* E( A& a6 x# m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ? [: r! ~; z6 C; c6 N! j$ L
- * TO CHANGE.
0 I7 ~. e% y3 Z0 ^3 p; S- x - *
4 U+ [+ v3 ?7 w# J# y6 p( F& q$ q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 w# t: s7 T! q2 \; | - ** C) t! ]. U6 `- j* @
- * This program is free software; you can redistribute it and/or8 u! _! H: U; y/ p, U+ x, _' a
- * modify it under the terms of the GNU General Public License as
# N7 j( c0 P* [8 T0 a$ X* O - * published by the Free Software Foundation version 2.
3 b, E8 F, i. O& [6 j7 d5 r - *! }" \% E+ H+ l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 p8 D) h1 Y( [% ?: }
- * kind, whether express or implied; without even the implied warranty. H6 f; t, S, G7 |7 n/ o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 S! f: Z$ C) _% y, P5 [
- * GNU General Public License for more details.
! s, X0 O- {* [# K) H - */# w5 U; t; Q7 }' L3 v* M
5 P" a. w+ E& k/ @7 W% ^: p- #include <linux/module.h>+ Q6 g! f( m7 n d v
- #include <linux/init.h>
8 e' r* b2 Q' @. N+ h - #include <linux/errno.h>: M- z/ r& [3 H& b) W& Z
- #include <linux/types.h>
/ |/ Z3 ]5 D! g% ?3 c- `' D - #include <linux/interrupt.h>
" ~& H5 v( J7 W - #include <asm/io.h>& C$ `5 ]/ L3 s" i8 o
- #include <linux/moduleparam.h>. F- p6 X. k% N* X+ R5 ^
- #include <linux/sysctl.h>& x6 d4 n+ A' }# R0 h9 b
- #include <linux/mm.h>& z: P( x5 U3 B! Z! W+ k
- #include <linux/dma-mapping.h>
5 v# `1 O: G2 w: a7 m2 [8 `8 _ - $ n e) t) e- @7 t* [" G$ L4 K* f
- #include <mach/memory.h> M8 z( r7 y J+ {' [0 p1 W
- #include <mach/hardware.h>
\3 H/ ]6 V) u1 L; { - #include <mach/irqs.h>1 _+ E* @$ Y2 y$ |7 Y) M0 L. [
- #include <asm/hardware/edma.h>
; k+ h1 q. }6 n) L7 G
2 g7 w. l7 u6 [0 P- #undef EDMA3_DEBUG+ y0 D: J B2 k, y( m* W( j4 r' z
- /*#define EDMA3_DEBUG*/8 n M; }/ O+ l ?2 N
& H+ \8 T- m& |. ^% |7 C, s" u- #ifdef EDMA3_DEBUG! K2 o. |" [3 t0 a1 i3 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) ~5 O& c4 B0 K! H" n" Q, u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ?7 T+ w. ~. y7 Q! @4 P
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 j, N/ p1 v3 I4 J; b5 H
- #else
+ q& w( ]* O5 ?% a ?9 _9 v9 f" h - #define DMA_PRINTK( x... ) u: Z9 w9 v4 j: J& ?! ^
- #define DMA_FN_IN
( p3 X" I, P* E0 L- b& q" U - #define DMA_FN_OUT; _3 X5 W* T, v2 n- |1 u6 b
- #endif+ c6 Z! X! L3 {/ [- ]$ t; e8 \
- * D* c* ]5 }/ q' G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 X( ~9 d7 R. d; ~6 e& \: {# W7 _! x* H' r - #define STATIC_SHIFT 3
8 l, d7 s4 v3 `9 y3 ~ - #define TCINTEN_SHIFT 20) }. r8 j/ |" {+ S8 d
- #define ITCINTEN_SHIFT 21( E4 ^; z' e& W2 i7 H+ ?, ?
- #define TCCHEN_SHIFT 22 F% {" I' X9 Y2 W8 y
- #define ITCCHEN_SHIFT 23
6 X9 |; S* G: U% J. |6 x - 8 E8 \; C4 x- J/ R
- static volatile int irqraised1 = 0;
( U' f. v1 _4 ~9 x - static volatile int irqraised2 = 0;2 m2 P& U: E( {% e( W2 T1 [
- 5 }# X" `5 H* |* S {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); j+ k0 q- i5 H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 f4 n" W6 R$ p7 l J! {; Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. T* L5 o- Y; n' g9 E
/ ?" j2 {1 `9 R" X# x- dma_addr_t dmaphyssrc1 = 0;: T( b: Y/ w1 O. a* a8 ]& `
- dma_addr_t dmaphyssrc2 = 0;
0 m/ r5 y, t9 \; U% v+ l: w - dma_addr_t dmaphysdest1 = 0;& V; e! X3 R h6 e" B
- dma_addr_t dmaphysdest2 = 0;
4 L5 K3 Z- `" | - # N8 M5 c6 x( p2 Z" r9 h7 `/ p
- char *dmabufsrc1 = NULL;
3 ?" j& {1 F& F& E- c) A - char *dmabufsrc2 = NULL;. D# k; S9 P$ H, e
- char *dmabufdest1 = NULL;# r8 O+ v0 l9 R2 R g
- char *dmabufdest2 = NULL;% [. A& G* d. ^) C+ [7 _# `1 K
- 2 D _$ j5 q; c# w
- static int acnt = 512;
8 K2 F9 x6 l* v" R3 M1 z: _( I/ f - static int bcnt = 8;
3 B$ H( A* |6 J: E6 W( E - static int ccnt = 8;
' h' |1 Z+ X1 t, }- d* p# d' i
) w1 f# _$ ]$ T6 z, @- module_param(acnt, int, S_IRUGO);
2 W! g ~3 a: B7 u; R' l N2 o6 q6 |, w - module_param(bcnt, int, S_IRUGO);
! T( K! J9 T6 h1 f* G, B - module_param(ccnt, int, S_IRUGO);
复制代码
( C' T0 I+ K( x9 R
1 u7 D9 Y5 N# u& K* j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ D3 f$ _$ m8 F# x% ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 ^2 S( v/ X% X- x0 ^$ I6 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- U# V2 L: F+ X0 q' g; N) F
4 S. [4 n/ b, W+ w7 Z
& ~' q) n( J0 s7 O r) I& I |
|