|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# x, J/ ^1 a) b! D% Q- [code]EDMA sample test application
1 `0 I2 S. I2 \& L4 B2 ^! M - /*9 `) b6 ]3 P* W0 E2 P
- * edma_test.c
. e0 S$ L# Z6 z9 H2 ] - *
# B# ~1 R* C8 W8 a* g1 D L9 `. i - * brief EDMA3 Test Application4 D) x [9 P/ L3 J7 v- B3 j
- *$ J w9 W) M' P5 M7 v
- * This file contains EDMA3 Test code.
- W" j0 b2 C: w2 o0 U' D - *4 S+ v W0 N5 ~* _/ R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( r+ G/ V; }" A% V, l; y0 d/ H0 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: Z0 q- x3 k! Z/ t# S, |! W' ? - * TO CHANGE.
: d- R% ~4 P& } - *
1 i; c) x0 Z* ~( W5 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& e( A5 U5 n% R+ B! G7 M, C- y
- *' e8 `1 e4 g* `. p) z; G
- * This program is free software; you can redistribute it and/or. r2 `. _/ m1 S$ ]$ a1 Z
- * modify it under the terms of the GNU General Public License as1 E0 ]& ]; w) l* f* h
- * published by the Free Software Foundation version 2.
' }) u0 ^: S; m+ a: m0 w9 U- \ - *8 Y; @: g) |. ~& x M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 N9 [" D; c4 m2 I+ A( H2 U5 R- y - * kind, whether express or implied; without even the implied warranty( Z. \0 m1 N3 u9 ~$ x6 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! [0 W+ Y' y1 _5 f5 b2 B8 f2 C
- * GNU General Public License for more details.+ n# [0 t+ _1 f1 F0 `3 w2 P
- */
# M# X2 l( c3 Q0 N0 `3 l0 w
9 ^# l+ E, k& }& q4 y, e4 G. Q6 g- #include <linux/module.h>/ {: H; }, G+ _) M! Y& b% w) U' x
- #include <linux/init.h>( C L/ g7 Y r' r4 N+ {1 U' |
- #include <linux/errno.h>
% k) U9 d1 Y8 Q' y- a" v - #include <linux/types.h>
: Y% A T2 M; F8 r - #include <linux/interrupt.h>
" H5 k: ], G+ F9 w8 x% a - #include <asm/io.h>: E9 P- L& t6 d* W
- #include <linux/moduleparam.h>: K5 a7 [: o% N
- #include <linux/sysctl.h>1 C% B$ R2 H* t/ S/ \0 ~
- #include <linux/mm.h>$ G- V' J' t6 d
- #include <linux/dma-mapping.h>
' [+ c3 K; O6 M9 N! _
' Q; j5 x% M' K1 R- q" f2 T- #include <mach/memory.h>5 q& Q) g) L5 a
- #include <mach/hardware.h>
6 Y; A' P7 R8 `2 P! p - #include <mach/irqs.h># k7 h% N6 N) s- ~
- #include <asm/hardware/edma.h>
S+ p) {: M& N* Z! T: b, m- p; ?! [
, x* U6 A% T7 Z5 U7 p, K' u# ~- #undef EDMA3_DEBUG" f$ R7 P% p: V% B' Z$ O
- /*#define EDMA3_DEBUG*/
& Z# w- ~5 ~& s3 E) Q- d; R
$ Y' v( x0 W$ j- #ifdef EDMA3_DEBUG5 J8 `; O- k/ C4 N, C# n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. U% r% H8 E( c# `2 q) P0 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! {5 o- U! X" B5 k2 c4 ^% d. o R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 _6 w. p9 E( W% C - #else
! C: x! q+ q$ u - #define DMA_PRINTK( x... )) Q+ A2 L/ H+ O# \
- #define DMA_FN_IN: t+ @7 G6 x( F# }( v+ h) i
- #define DMA_FN_OUT7 p8 Q; z: j% E! Y2 |( r
- #endif" l6 W* c2 [1 \9 w# w
- : s7 W9 x- x/ Z+ ?) |8 ?; r! H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* s' f- H9 r) E' X4 [0 X- L
- #define STATIC_SHIFT 33 k) B9 p" ]5 l6 s
- #define TCINTEN_SHIFT 20
; d( ?$ j: k; E" U2 { - #define ITCINTEN_SHIFT 21
' l, t) b* g& g. x - #define TCCHEN_SHIFT 22
7 f0 M5 ^- B' M - #define ITCCHEN_SHIFT 230 h) q3 o/ [% G) J
+ F) |$ n& ^& k$ {. @ x7 _- static volatile int irqraised1 = 0;: I5 V( A' v& @/ w! ^
- static volatile int irqraised2 = 0;
4 k: C( |* {9 P' y - 7 Q5 |' y( s! \) D4 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 C! F: g* ^, V8 U' }7 P# ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ~9 e. s5 V5 [4 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ~! t) ~; P. F" u6 R2 p" _8 `) \
1 |) n0 n% Z. {8 ~% E3 j4 b- dma_addr_t dmaphyssrc1 = 0; Z! C' H* C' Y
- dma_addr_t dmaphyssrc2 = 0;
! |! a" ^$ r( Q; s- o* R - dma_addr_t dmaphysdest1 = 0;& A+ Q) }; M( P( Q2 F
- dma_addr_t dmaphysdest2 = 0;
8 A7 T' E0 c. N3 x5 Y- y) b
" R4 d8 Q# h A* |- char *dmabufsrc1 = NULL;9 _! z! H: ^2 w D
- char *dmabufsrc2 = NULL;
. v* j" w R. q$ G; J - char *dmabufdest1 = NULL;! G0 D- z$ c+ A* n; j
- char *dmabufdest2 = NULL;
( r l1 J5 B; l4 e# _3 h: V* y2 M
% p$ u- o; U! j- static int acnt = 512;9 j4 `6 h, k8 T
- static int bcnt = 8;
2 Q6 d0 ~* }: b* `! E+ U: b - static int ccnt = 8;) C; b" z4 d4 K0 e% H) ]: g" Y
6 T, U# P) I. q0 O# K" b- module_param(acnt, int, S_IRUGO);0 c8 l) `0 G' j1 p
- module_param(bcnt, int, S_IRUGO);
1 a. h# D/ r2 K. T# \ - module_param(ccnt, int, S_IRUGO);
复制代码 6 ~0 S# W" p1 W5 ^: l# g
) J4 x( C" i* P: A) D/ z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 G2 A, l* E1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ z! |: O6 ~0 g) I9 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& _' Q2 S. Q( O2 }) c1 ~1 P! R" G" ?" d
a5 Q/ F: E8 ?! J) ]$ M |
|