|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ E& ^ E$ \! w9 z, }5 Z- [code]EDMA sample test application; _, I# }* d: r& a* ~/ G3 g
- /*1 m& j+ g7 W; w0 ?* R
- * edma_test.c
/ U" Z4 I1 ^1 n - *
3 _; z, i+ L6 _+ W9 f - * brief EDMA3 Test Application1 y2 L8 }/ a. D3 S* t6 b* t9 u
- *0 _, p8 D% u6 Z/ Z
- * This file contains EDMA3 Test code.* |; u/ g$ o4 ~* r1 j% T
- *7 B6 h2 [" U* K' s1 T" o0 }; R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- X9 }* j' ^& ]9 y) B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! ?$ |0 s3 E4 \ m. x - * TO CHANGE.; I' D; o. x0 B p
- *, R1 \6 V) ]- e- Q2 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ _4 U- s9 u! f% A9 y) q* e' s - *& R9 J* R7 u& I% b) u
- * This program is free software; you can redistribute it and/or
5 g( e# N/ b9 P6 F - * modify it under the terms of the GNU General Public License as8 [. X9 b; H1 _' v; [) p
- * published by the Free Software Foundation version 2.
) e& B5 J' o( ` - *
$ L2 y2 |3 e }( b, ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ I! E3 ~1 r; M. g2 f) n - * kind, whether express or implied; without even the implied warranty
" B5 ^$ s2 e2 ]6 v: p7 b. q* u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" y) L6 J' }8 p$ f8 I5 o - * GNU General Public License for more details.& G9 Q, Y; e& G
- */
- x/ i: z6 t Y' X% ^# a
! t: m! O% o& |. k0 y+ b- #include <linux/module.h>! S: p6 {- v l: G, O& j$ a
- #include <linux/init.h>
5 b% H0 }, }0 R. p - #include <linux/errno.h>, u# d! d/ r* Z! z
- #include <linux/types.h>
" y( `6 c' w. j' h9 q - #include <linux/interrupt.h>
, Q9 \' @9 J" u6 |, @0 o- z0 I. m* ]$ b - #include <asm/io.h>
- v3 Y! O7 G- M) C - #include <linux/moduleparam.h>
! i6 `5 C, s. S9 _: ?& d! v - #include <linux/sysctl.h>
9 o( y6 X5 r R - #include <linux/mm.h>! w" `9 o* A8 ?
- #include <linux/dma-mapping.h>0 R8 U, f5 V7 [ ~( k/ }& ]: M- p; j
- ; @( J' K1 H. ~- h
- #include <mach/memory.h>
4 Y# h) t4 j2 T# q - #include <mach/hardware.h>2 K( V0 d+ w' Q, ~! L- l1 b D: h
- #include <mach/irqs.h>
% e" P4 U: r7 m+ y5 |3 V x0 B - #include <asm/hardware/edma.h>; R4 q( K) j- X, C. O+ T( E! R4 N
- ' m4 t; z% e. H: j$ V8 L2 K9 g
- #undef EDMA3_DEBUG! K' k4 F c& U
- /*#define EDMA3_DEBUG*/2 G; p8 f9 M I9 R
4 S5 F8 q: I7 y, n/ I- #ifdef EDMA3_DEBUG `, T1 u9 J) _1 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 t* g' @* m0 l& n: P. `# P- w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 R" G1 K" N0 }( R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 k) w& O! c3 V% }) {, v4 @ - #else
! U# ~' z- u1 s7 r4 z+ ~ - #define DMA_PRINTK( x... )
- I7 Q% a( f/ x( U5 I, J2 E - #define DMA_FN_IN
+ g6 ?# D* H! Y8 D7 {0 s2 F - #define DMA_FN_OUT
, y. {' o3 O b+ J: Z% w5 y6 | - #endif$ z. F, O, q R+ i+ |9 q, l
7 [7 U4 ?+ O/ j5 L1 }6 ~1 v a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 ^. b* o* N9 D0 E I! n' h
- #define STATIC_SHIFT 3
6 t$ i1 X. V H3 K) u- h, c# q - #define TCINTEN_SHIFT 20+ n0 a; k6 U0 P
- #define ITCINTEN_SHIFT 21
3 N, u) Z* L2 N - #define TCCHEN_SHIFT 22/ r- [( X7 w8 g$ b
- #define ITCCHEN_SHIFT 23
' q7 {) j6 j4 q- {
7 x/ k" I4 e9 h/ ` [' R- static volatile int irqraised1 = 0;# Y2 w/ D1 U! m- u5 v
- static volatile int irqraised2 = 0;5 Q. L/ u! z6 b' L m' S
- ; M# A+ z& Y. W5 w7 z5 _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G" n! `1 w" k) K' |6 d- e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 H$ w& Q0 p- h: n- W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _, m, _/ f, d
; o, _) b& y( r$ N3 J( x( ~- dma_addr_t dmaphyssrc1 = 0;; F4 D3 e* W$ ^; D
- dma_addr_t dmaphyssrc2 = 0;
4 R2 j+ J K9 R, H/ L2 Z - dma_addr_t dmaphysdest1 = 0;. T) K" @& u; z& v- D
- dma_addr_t dmaphysdest2 = 0;# @* k, |) \7 a( j5 y4 S4 S
- . b) C P5 r c+ W8 S$ `* @
- char *dmabufsrc1 = NULL;" S+ J1 a# Z4 F; o5 k. c# }1 v* A5 Z
- char *dmabufsrc2 = NULL;
0 a0 f# N! i# j6 f" S - char *dmabufdest1 = NULL;4 M% [' U8 I1 X( a( \' Z+ m
- char *dmabufdest2 = NULL;* y- J" e" Q& R2 s2 Z4 e8 [
- ; o0 U* I; _4 W7 ]' n* c
- static int acnt = 512;0 O/ w2 O* K2 u/ W K# v- R
- static int bcnt = 8;5 U# ?+ L6 a v
- static int ccnt = 8;
) P" d+ \7 T; I, P/ i& j - 7 I; k" U/ N5 Y" ?1 c
- module_param(acnt, int, S_IRUGO);
* J+ n+ T: {; d" e T - module_param(bcnt, int, S_IRUGO);
: n) T7 G6 F+ C2 x! p - module_param(ccnt, int, S_IRUGO);
复制代码 + M. m" ?& L( c( V$ E2 c
" _9 |9 K: P- M! y3 P# g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ J' V/ n" f* P, b' s' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& }" V; x+ E# r8 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. E7 M( q0 Y; o$ B% u9 D' ?# z/ s3 V2 ?
" d7 x5 j% S4 x8 ]# [ S |
|