|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ n$ i% q' d2 O) C& h- [code]EDMA sample test application) N. M3 \+ k* ]7 L* p" s
- /*
( f' t* z: z1 i8 H0 ]8 w+ {' y - * edma_test.c
' r4 p6 R$ b5 M. r+ D0 w# [% l# H6 _ - *
8 j; l0 O, t' F. ~& a6 }8 ^ - * brief EDMA3 Test Application
2 @& k8 X I3 k6 R: R3 I - *9 ^7 R* ?. o b$ }
- * This file contains EDMA3 Test code.1 Z: D V, |. B
- *
9 H: @1 e8 q7 {5 B3 w# W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 y% N+ U& g( V% R$ e; S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' H a3 {, {1 ?5 R
- * TO CHANGE.
6 M, S+ Q" R: b$ O0 B - *) n8 Z) L p. Y# W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 P8 W+ N, x; p8 L. U1 r
- *$ R1 u7 f ~% F2 \
- * This program is free software; you can redistribute it and/or
3 c9 J! n2 J' n; |- M5 M - * modify it under the terms of the GNU General Public License as) H9 k, _/ J+ u- G' T) b2 S
- * published by the Free Software Foundation version 2.( E) X/ p, s1 L) P9 l# m' F
- *9 e) M' D1 a0 A8 Z4 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
T8 B' D$ S& t3 T6 k" } - * kind, whether express or implied; without even the implied warranty9 F5 S, n/ b* a' w( B( _+ O1 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) K- a9 A# _* D- o - * GNU General Public License for more details.' T2 v7 d8 ~. y4 h
- */
) O1 Z# V6 J' C- N2 V3 ?& {4 l - 9 r: X. F4 ^1 s# r
- #include <linux/module.h>& ^3 F- X b0 O1 U! H5 C: {& p0 W
- #include <linux/init.h>
5 }2 ?1 X/ W0 @. Z9 c& x* h - #include <linux/errno.h>
. c& C0 x' ?+ V S - #include <linux/types.h>
C5 g) M. i' V7 P& K; ? y3 n, x- ^ - #include <linux/interrupt.h>5 P) Q) O- ?. y: \) b
- #include <asm/io.h>
, p" ?6 |( l4 \, w - #include <linux/moduleparam.h>: J# N v8 _! ]0 S# f' o
- #include <linux/sysctl.h>
3 W. i3 w/ w5 G) d+ W, t2 ]7 g8 Q - #include <linux/mm.h>& q1 F0 v z- R* l% B
- #include <linux/dma-mapping.h>
l4 _/ s$ j" Z. ~4 h! `
! ~, C3 N/ r* f1 L, v, i6 ~- #include <mach/memory.h>
7 ~( @) B1 P; q7 g - #include <mach/hardware.h>- D; u/ a8 s5 B* A L, J
- #include <mach/irqs.h>, G2 g: T$ ^% O6 v t: Y* K
- #include <asm/hardware/edma.h>3 s# y; D/ [" v! X
" w# n+ z2 m. I! }8 s7 Z, K7 ~$ o- #undef EDMA3_DEBUG
: w3 v, x" w& b! r - /*#define EDMA3_DEBUG*/6 q9 W1 m' D5 H* \! ?# _
* y$ U: b/ B3 _9 T0 K& g- #ifdef EDMA3_DEBUG
% s( y( L \) R+ }( Q8 Q y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ x% E4 t) x# h. r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ C; W- P3 h# h }$ e5 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 _) o9 ~3 q; {+ ^; F, ~
- #else% F$ u! M0 Q$ J# u' c
- #define DMA_PRINTK( x... )
9 \1 ]9 n" H& y0 h1 M/ ]: [7 Z7 [ - #define DMA_FN_IN4 K3 D8 V6 X- m8 [. K
- #define DMA_FN_OUT8 O( Y! F, q, l/ w# A
- #endif
) g9 e' x6 j/ U* [. b; f - 6 K; B5 h( i H f2 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 F8 A7 W( j4 w2 b4 F
- #define STATIC_SHIFT 3$ T: p! ?2 U0 y1 j- m
- #define TCINTEN_SHIFT 20& z- u$ M; E- K4 {/ |, r
- #define ITCINTEN_SHIFT 217 D* e+ M( i( f! ]8 D5 J: Y0 F$ `" ]
- #define TCCHEN_SHIFT 22) o. D: d. f4 O9 y$ P
- #define ITCCHEN_SHIFT 23" x( L) c0 i7 r0 n- J! X1 b+ m
- J- x# b( @7 E# q; p$ u1 ^3 S
- static volatile int irqraised1 = 0;( G) X' M* n# c6 P2 d- F
- static volatile int irqraised2 = 0;$ @. I3 D2 c/ c$ ?2 C6 k
8 c8 j1 c$ i, q2 K, a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ?( _9 _. d2 t* g9 A* j$ }2 F - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' O& ]3 G7 W# b7 x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ ]4 y1 V1 L3 k& k) t9 e
- 3 u/ L- w7 r9 t5 C+ u/ c
- dma_addr_t dmaphyssrc1 = 0;% [- k$ C6 g- J: z
- dma_addr_t dmaphyssrc2 = 0; Z( C" r& E( u9 p
- dma_addr_t dmaphysdest1 = 0;
) ~( v: l& _0 ~, O9 R6 o - dma_addr_t dmaphysdest2 = 0;
/ f8 {3 {! ~, W
2 K) e# o$ A; T, w- char *dmabufsrc1 = NULL;
) ?" L6 U1 M1 U3 ~, t: Z8 o - char *dmabufsrc2 = NULL;: y! E O2 u& a/ C* f
- char *dmabufdest1 = NULL;
v! ?4 E' M' ] - char *dmabufdest2 = NULL;
- r; b% S q9 n
7 y! f2 {0 l- A! U6 C+ h) d- static int acnt = 512;
" E& ~% _1 t$ ?8 t% j% X+ |3 \ - static int bcnt = 8;5 E2 U* N. t$ A* F
- static int ccnt = 8;
5 G) u M' r2 d+ S1 b- Y - , H, \* R$ s' Z: t' Q1 e; [
- module_param(acnt, int, S_IRUGO);6 H ^7 ?' p2 h; Z: C: S6 ]
- module_param(bcnt, int, S_IRUGO);
3 Y) Q, }) H8 n! p - module_param(ccnt, int, S_IRUGO);
复制代码 2 x# O; d0 a5 e, R+ s! {
8 l! ^0 u: t! a& e9 O0 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. H# T9 a5 a8 v9 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 _3 o( N7 e4 Y( y) P1 S& H8 K% `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" p! P5 R+ _9 z/ g/ R6 o
* _ C& Y3 L; B7 h' ]/ e4 E6 J
* @) u4 G3 Y7 T. g) A" d5 D8 \ |
|