|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 o- R; R3 B' z3 S
- [code]EDMA sample test application
1 Y2 q v, j H ~8 `' M - /*6 d. f% I- c; O! _, d0 v
- * edma_test.c* n0 w& }1 f! g+ w ?7 ^8 Y
- * c- [+ g& o* O" U) z5 u# n G+ C
- * brief EDMA3 Test Application$ ?2 K$ B# e6 n$ G7 f9 e
- *
8 R3 o2 Z4 Q: r8 u; U' S; k - * This file contains EDMA3 Test code.
% b# g3 t3 B( a. _ - *
6 J7 O5 t/ ]5 _' v. V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ {& [( F3 S; P/ F0 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 Q P+ M. P, v. Z" X
- * TO CHANGE.! M6 [6 A" ?/ V% X) n# L
- *( i# y- T* ]/ w# ^( a7 H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# ]' O( A) B. I! o5 Y" p8 A - *
% b: J* D+ l) [' F% m0 _ - * This program is free software; you can redistribute it and/or
- y9 s7 H) e$ C% H5 o - * modify it under the terms of the GNU General Public License as
/ @7 c, D8 c& y4 k! \! f - * published by the Free Software Foundation version 2. Z. E# \! O; v/ P/ s2 r# U0 D0 Y
- *
1 P& z+ K5 f: {1 j0 T' K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* M R& a% i6 o' o% ?1 C: g - * kind, whether express or implied; without even the implied warranty! l. k, p. ?$ K8 s. z. W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 s* N9 s2 T# g" I% c1 L - * GNU General Public License for more details.
2 O: N% b+ b1 d& ~; L - */
% r1 j" a9 O# C- V( j p/ a( Q$ m$ x - ( u) z, |# w7 B( J& l
- #include <linux/module.h>, O$ S: [1 I# R2 M) L
- #include <linux/init.h>
3 D2 l( N, H3 Z# [/ T& w - #include <linux/errno.h>
3 S- D3 z% W+ c9 y8 p9 R* x - #include <linux/types.h>' ^- U3 j' d# T* R' D' Y
- #include <linux/interrupt.h>+ i3 T, _/ V3 q1 {+ ?
- #include <asm/io.h>% U5 J" ?: S7 j2 z3 F
- #include <linux/moduleparam.h> e9 Q$ T1 |6 {2 f9 |5 x
- #include <linux/sysctl.h>* r C3 q& g( r$ o; n1 ~/ [4 e
- #include <linux/mm.h>' t9 a! i$ P5 i) r/ H0 F
- #include <linux/dma-mapping.h>
0 I5 x$ Z' w7 ^5 r+ a' o* J$ f7 O
+ p* K9 T p# z% }7 r0 _- #include <mach/memory.h>
( A( a9 h. {. @8 J# y5 _4 w - #include <mach/hardware.h>) D5 q- u! N2 Q: b/ f% S0 o, R6 v- I
- #include <mach/irqs.h>
* w3 {& W: C. F - #include <asm/hardware/edma.h>
; |/ h3 e- K$ ~0 ~ l0 Y. ` - 7 B& k( {, s8 Q: R6 Z7 ~+ S
- #undef EDMA3_DEBUG
1 W4 i7 X( v4 k: M: [' X - /*#define EDMA3_DEBUG*/3 h2 j# V5 `+ E& c% O: V' C
- 4 B, a7 S6 h x n& R
- #ifdef EDMA3_DEBUG
t6 ^. V2 Z. y1 i3 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% o) k( n4 Z, |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ?2 }. L; H8 g9 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# L+ u& q2 p$ p* M, _! K
- #else7 P3 G: X/ w7 Q E& s( s1 C. {
- #define DMA_PRINTK( x... ) I5 p" k' O) { J: D
- #define DMA_FN_IN
3 v, A8 P5 c5 O$ b7 @ - #define DMA_FN_OUT
; U9 k: u4 S) y0 v6 z" P& \5 Y( k! B - #endif
% O) N! o6 a" C- s - ' w) d" A& v" n. K5 E3 E' e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* f$ E4 _8 h* }1 U2 e* q d - #define STATIC_SHIFT 3
6 U& b* @2 p+ Q: ?% s - #define TCINTEN_SHIFT 20, y2 J8 p$ i, q% W( V5 T a8 _) j
- #define ITCINTEN_SHIFT 215 K- \' ~2 `) i
- #define TCCHEN_SHIFT 22
' T# t+ ^; {/ R0 j1 s2 M/ Z# e; f - #define ITCCHEN_SHIFT 232 m' ?5 [& L& D( A
- 4 [' i( H% [$ O% M
- static volatile int irqraised1 = 0;0 E. I! k: l) \
- static volatile int irqraised2 = 0;" B/ K, ^0 E' V
- * j) T7 O- d& O- p6 o" x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 N" S* V- x; B7 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 u& ]+ q p: R- H: O; d6 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& k+ [+ w- _! n" M% ?) ]
1 q) ~6 E: ~6 H t. s" Z- dma_addr_t dmaphyssrc1 = 0;5 E9 [) t# m* T9 P5 B/ t" @
- dma_addr_t dmaphyssrc2 = 0;
5 o+ T) m1 |( f6 @! m9 c - dma_addr_t dmaphysdest1 = 0;: `. A$ e( M2 J. a
- dma_addr_t dmaphysdest2 = 0;# P' O, `/ R6 P: J
- ' J, J( k- V$ d
- char *dmabufsrc1 = NULL;
$ W* A# Z7 U/ t( C - char *dmabufsrc2 = NULL;
7 ]7 `* |7 L0 ]. i. w# }4 z - char *dmabufdest1 = NULL;
5 Z/ o+ q% `; q E3 v4 l - char *dmabufdest2 = NULL;
0 u+ B5 G* q* A1 Z% U4 p8 r+ p - 8 U& h7 @" c& s1 W! y8 l
- static int acnt = 512;! N* @/ M( U2 ], {8 J7 D- B* x
- static int bcnt = 8;8 p7 i/ ]* s- B9 K, y( u) P! N
- static int ccnt = 8;
% l" F8 g* P0 B, t' M - 5 b5 l8 N9 X: A% f2 }! ^
- module_param(acnt, int, S_IRUGO);
3 s8 z, [( r+ Z - module_param(bcnt, int, S_IRUGO);
! f* f4 H6 v! J1 J# V8 v3 _! [ - module_param(ccnt, int, S_IRUGO);
复制代码
+ Y) V4 J& P B
, j L2 A2 ` R2 S4 r2 s9 s" H7 F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# @9 O, e* Y" a1 U$ i# w2 X. o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; q4 r4 H" }/ l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- Z5 M9 c& ]7 d& }8 ?
# e/ K' `4 R' M
6 K+ X5 K3 Q& R& A, e2 x |
|