|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 J% Q. {8 B( w! j
- [code]EDMA sample test application5 J- Z: D1 x, }, @
- /*
$ _& L3 A" Z1 v8 G+ T- v - * edma_test.c( U4 \3 ~ {* _ X# R
- *
$ K' F$ h7 r1 S8 F7 c - * brief EDMA3 Test Application& K9 K( ^3 t3 H5 W1 P
- *
( b, [4 d# k7 C$ ?4 a - * This file contains EDMA3 Test code.; e9 i7 ^- V; N0 L
- *
$ b5 T* o! c3 u) O9 F# g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 V" K, } K' L+ O" g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ u; W4 l) ~" f3 ^6 ]
- * TO CHANGE.- z* p- g6 q; i( H$ t
- *( k. T6 n) e2 z, g9 P$ i6 t1 Y% N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. ]1 {% M( u/ A
- *6 {* h0 \& j5 i3 E
- * This program is free software; you can redistribute it and/or
9 T. O3 c. w& @7 \. K; d - * modify it under the terms of the GNU General Public License as
& J6 J2 r: |$ u7 g/ X - * published by the Free Software Foundation version 2.: I/ i( r% C$ v4 P0 u7 Z, g
- ** p! p/ m0 X. M* B) Y4 k d% w# }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 f$ n- [, H: f. c z' o3 { - * kind, whether express or implied; without even the implied warranty
2 n& [ Y0 J$ t) v f1 X0 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 Y. n& F$ L+ _- k3 r( C" x
- * GNU General Public License for more details.6 W1 S& u( I* X) b0 G
- */
' j! R |3 r; x/ S+ I/ {! m6 h7 A; [
& S1 [; Z, t( A% S- #include <linux/module.h>; P9 S/ z& X1 f# W P7 [. b
- #include <linux/init.h>2 d- D5 H: S4 r
- #include <linux/errno.h>
4 s' g/ e( Z! s- l6 ~. E - #include <linux/types.h>* r, D/ `+ P/ {8 j, s
- #include <linux/interrupt.h>' e$ _, |1 ]+ R% n6 }
- #include <asm/io.h>7 A, `+ ?, g6 g. ~, ] h! ^
- #include <linux/moduleparam.h>
* P J& }' ~. d3 b# {2 l( p9 O - #include <linux/sysctl.h>7 v8 O% h! R0 F8 y4 h% r
- #include <linux/mm.h>
9 o+ X, {; I: F( B% r1 J - #include <linux/dma-mapping.h>
% u, \7 r7 a2 D3 R f
9 `# E* }$ t3 l6 O$ l- #include <mach/memory.h>) t2 b4 ] m d: M. o& ]
- #include <mach/hardware.h>) y4 [ g9 c) F Y8 W) a* ]
- #include <mach/irqs.h>
- u; R% ?5 ^) A d3 X4 c% A - #include <asm/hardware/edma.h>
) |; _7 K- D( d# [( \
$ N. E1 C' Z: z4 @) h. [$ }0 y6 a( ?$ n- #undef EDMA3_DEBUG
6 O- M! w' K6 l - /*#define EDMA3_DEBUG*/
! _# x# W& e3 U8 G* G2 U9 V* n - , Y! b# Q/ C9 ^4 q3 E% P
- #ifdef EDMA3_DEBUG9 r2 b$ |: @' s1 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 q1 _5 J; f! e/ Y- n" { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); K1 _8 }0 o( f) E! _+ p+ {/ y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 u L4 _1 [$ S0 f
- #else: u- d2 s5 ^+ l, @8 T2 m7 t
- #define DMA_PRINTK( x... )
$ J( {( M; M. ]# K - #define DMA_FN_IN
3 `$ A0 J% H- x8 \$ w - #define DMA_FN_OUT* P+ A3 _2 S' D* _" l& T; \; c' X
- #endif
+ l* l. Q' H; z$ _6 J8 \ - ! L) @7 _7 ]' L* h# J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- E' {3 |0 V& \
- #define STATIC_SHIFT 3: @% t v4 o" W2 B; B6 D* G0 c: h
- #define TCINTEN_SHIFT 203 Q, G+ L; T, f' F; G0 V* B) x; a1 L
- #define ITCINTEN_SHIFT 218 b. ?& ~3 u A
- #define TCCHEN_SHIFT 226 N& {% r2 S, l; w' {
- #define ITCCHEN_SHIFT 23+ \2 [" [3 J& y3 Q* [: d! g5 B
- " E2 ?8 n) N: _9 \) ~5 `8 J
- static volatile int irqraised1 = 0;) M: `# n; C6 z) a# d
- static volatile int irqraised2 = 0;
' h9 m3 [8 l& i! ^# _% B, A0 s - ! h& x3 B l" P) u0 i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 O0 z+ p) g2 @# x- D8 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Y/ U' E) A- p% b9 y# G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% T( z6 `5 u; G5 g, w, K8 W
% f Y. X) B2 r1 m- dma_addr_t dmaphyssrc1 = 0;
$ E* \ y2 F4 R3 t, t" @ - dma_addr_t dmaphyssrc2 = 0;
. O# @; k! @' Q( n+ y - dma_addr_t dmaphysdest1 = 0; i }" W& {' r" i5 `
- dma_addr_t dmaphysdest2 = 0;
$ K! [3 P \% o* {
# I( ? @( v( c) V2 n g8 H0 j- char *dmabufsrc1 = NULL;
0 a$ a* o7 G4 c5 U9 o - char *dmabufsrc2 = NULL;
. U/ x! k ^9 M& i; A# b7 \ t# b - char *dmabufdest1 = NULL;
[: Z8 F+ Y' Z n2 v! M) n - char *dmabufdest2 = NULL;
+ U: P2 w; B: G4 ~ - + {! Z9 I1 [5 ^7 ~9 d w
- static int acnt = 512;8 P0 F" a3 R6 N/ f* ]
- static int bcnt = 8;9 u! K9 q+ C$ }. T
- static int ccnt = 8;
3 O! U2 _7 E& Y) I. v* l3 W - , m# C+ [0 _4 }+ X1 y
- module_param(acnt, int, S_IRUGO);, Z& Z# R# Z& c4 K3 k! S3 F
- module_param(bcnt, int, S_IRUGO);
# V6 q/ }( q1 r8 G' O9 B, Y - module_param(ccnt, int, S_IRUGO);
复制代码 * T+ w7 C3 z: |& Q. j; M9 l
; I" f, ~" k7 }4 m0 _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, K8 t; Q# E2 ^# d9 O3 S( y& darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
], j6 k. R% p% @" K7 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- j# a: j- ~& q g \; k" a1 H' y% i" g# |
" F. e r1 o" [+ x$ i
|
|