|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; P6 s7 t% } j& R% {1 ?7 C7 N- [code]EDMA sample test application
! O$ Z+ g; g: A* { - /*" W# l4 a: @/ Z7 r. w
- * edma_test.c0 f4 O* X; ~% \0 d5 V3 D4 i/ T. ^
- *
O: r) n7 Q% r - * brief EDMA3 Test Application5 l8 E# L; \2 G' I3 w" ~
- *- ~9 w7 u/ A" m0 p
- * This file contains EDMA3 Test code.
0 i6 a$ U! w6 y l' a$ }$ ^ - *% g \/ ]9 h% a+ N$ j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 D0 |0 q7 g/ H. N4 ^0 m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' L0 @ m& ^6 F. ?8 T2 r/ L( [
- * TO CHANGE.1 t* Q2 X& m' b9 i
- *7 D3 H7 z# u7 F7 ~- G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Q, |/ c9 u& W0 ^* ?1 f9 V
- *
0 G4 h/ q# G0 M b" X - * This program is free software; you can redistribute it and/or; z7 b4 v# u0 v
- * modify it under the terms of the GNU General Public License as
: J) V. i: }. n) N' g% z - * published by the Free Software Foundation version 2.
! D- u& ?" D) r, R$ H, R/ P - *. F5 d( r4 I: m& R4 z! o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any c/ R+ x& `9 u
- * kind, whether express or implied; without even the implied warranty* l& `1 P5 p7 r O# o6 `. w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 J4 W! `2 X4 S7 c3 P& g; T( g
- * GNU General Public License for more details.
9 K- D0 {. y1 L7 F/ ` - */
( Q0 R: i5 G0 L8 s- W$ N x - 6 M1 @) `; w0 R7 h+ V4 n! U+ _+ ~
- #include <linux/module.h>
+ D* T# G0 L/ d* b; V - #include <linux/init.h>& m3 X# \+ p2 S
- #include <linux/errno.h>
5 o/ i/ e+ q7 ^& [! g- ]5 \1 c - #include <linux/types.h>
/ X, Q4 S- Q) w% }5 b# v - #include <linux/interrupt.h>$ W8 e- Z0 o$ b) I- b. c7 B' D
- #include <asm/io.h>3 }7 \ {9 K" N! x' z9 m1 a
- #include <linux/moduleparam.h>
& X3 W% e5 r+ w: B$ X - #include <linux/sysctl.h>
$ B3 H: U4 U5 m. [. w( R' E - #include <linux/mm.h>& X* f/ U; G7 U' g7 l* \
- #include <linux/dma-mapping.h>
" B0 x+ x) X$ M* v- t4 y9 d
) G( x6 C9 n4 e$ H, l! C+ b; ~" ^3 H& @6 t- #include <mach/memory.h>7 F& V0 G! M& ~9 t: C
- #include <mach/hardware.h>& ?/ ?$ B4 W4 T
- #include <mach/irqs.h>
: n, h* q5 `; d2 o - #include <asm/hardware/edma.h>
0 @/ ^' M+ j6 c- s! g8 t/ B( l
& L) g, ]. Y: f/ x) `4 p! B7 V- #undef EDMA3_DEBUG5 S! k" h2 g1 r& S
- /*#define EDMA3_DEBUG*/2 @5 b; C9 W$ \- l# r) `
% |7 \" x* f' A! s- f$ l8 l, Y- #ifdef EDMA3_DEBUG; o2 Z, A* z6 _3 R6 j& g& s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 G0 l, u% [: ^& h" x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) a$ ~ d R$ |, X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ^5 l1 m" g. N- a" `* ]( S
- #else
1 p# |" w; J! y( S0 f/ I( F - #define DMA_PRINTK( x... )' C s' q: H: v/ V4 g' c) z' M
- #define DMA_FN_IN
% {0 a, }; ?' i8 Y - #define DMA_FN_OUT
& ?/ R7 C- p/ @7 e" L2 j - #endif- Z+ U6 D- ^0 q; a
- % o. w+ Z2 H0 K5 s% B0 f% X7 G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% q3 L) k/ Q: G& x9 {( U" t" S8 P1 m
- #define STATIC_SHIFT 3: p3 \: ]% m* ^5 ~
- #define TCINTEN_SHIFT 20
) ?9 W& S7 b/ T$ o" W$ O - #define ITCINTEN_SHIFT 211 ~* i1 ^/ A' u: E7 s
- #define TCCHEN_SHIFT 22# {! R! l0 c( n
- #define ITCCHEN_SHIFT 23 a8 }( _/ a& }6 Q
- 7 a$ s1 f& q+ F% y, e
- static volatile int irqraised1 = 0;
! d' j% {# C% R - static volatile int irqraised2 = 0;4 I1 m2 Q, c9 ]- Y$ }
$ F0 N) @% [6 m7 V5 [$ u* \0 t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' M3 g( d/ M$ z' d; P/ h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 f/ ?3 Q- W7 @0 d! _* b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 Z0 a) ?' ~8 u, g
- ?( r+ H9 P$ ~/ S- dma_addr_t dmaphyssrc1 = 0;/ A5 U' L. r+ c- [# q& h: U6 _
- dma_addr_t dmaphyssrc2 = 0;
- l1 D. i7 v' W6 x' C - dma_addr_t dmaphysdest1 = 0;" u: _+ h: o. U+ \ }% b9 M" S
- dma_addr_t dmaphysdest2 = 0; V2 Z' U* K a% S
; I b( E& d6 `3 X2 J- char *dmabufsrc1 = NULL;
9 Q7 m8 n5 c$ h% n6 N5 @ - char *dmabufsrc2 = NULL;/ ^( }) X1 V4 {1 m4 v: }
- char *dmabufdest1 = NULL;/ q, [; S. U7 ^ @" Q
- char *dmabufdest2 = NULL;( n! p" K0 F* H
- / X& X1 U% J5 M6 R' x' e2 P0 @; U
- static int acnt = 512;3 e) E, ~9 s- S5 h2 _
- static int bcnt = 8;/ C* ^; M2 P( x3 k6 ]4 i$ Q4 O
- static int ccnt = 8;
2 s0 F4 U# \7 W# P' y5 l - 0 O* h% o+ ?' _
- module_param(acnt, int, S_IRUGO);8 k5 ?+ M; G1 y9 q
- module_param(bcnt, int, S_IRUGO);
( R, s/ _! j F8 V - module_param(ccnt, int, S_IRUGO);
复制代码 5 \) V/ T" } ? |* v
8 a' f0 P. ?, `3 u( u) }! ^/ Z7 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 F$ u2 W, i: X* v0 M9 p Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 [; u9 M7 q0 \1 ^, }$ l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 r7 c$ R y A' ^5 T5 v; I3 b4 F7 }1 @6 L# U7 N
: i3 H* m4 a4 B2 {& b' j5 k
|
|