|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 U8 q9 z5 P/ s+ K6 U- [code]EDMA sample test application
1 l/ }: o- t& m) N, y V4 E$ t$ b3 s - /*# L9 [0 [) {/ f9 X
- * edma_test.c
2 M+ D) K0 A) o - */ z5 @" K4 X( U) n3 X
- * brief EDMA3 Test Application
" y+ k% v3 W$ ~& A - *' A/ B i" R7 V9 M
- * This file contains EDMA3 Test code.
& g2 P; {. x; `# q! H0 H - *
3 O$ |8 n# @4 _' T8 f* Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 z1 K$ h3 I: h- Z! W3 N; P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 T ^8 u7 p1 r( W, S - * TO CHANGE.
4 l* |- r) Y4 ?2 H. y) n - *1 J5 c: v- n0 W, d$ {0 o$ y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; ^& h' F, \# t% s8 N% P' X" e
- *
3 ^1 V/ S! v+ R/ C - * This program is free software; you can redistribute it and/or4 S8 C7 S) d, z( A$ T
- * modify it under the terms of the GNU General Public License as
+ l' Z% W8 @ S2 c6 { - * published by the Free Software Foundation version 2.3 d7 p/ U T& @4 G2 l6 [- @
- *, x ]7 F+ z _2 w- l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Z& G0 L' G* X8 ~
- * kind, whether express or implied; without even the implied warranty# N" A% o9 q& _2 A. P/ H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 ~) x; M$ ]( {6 o
- * GNU General Public License for more details.
2 b9 ]$ G9 X( b* U* j( h3 m - */" P0 A- D! m& N+ @! o6 y3 Y
- # K9 T0 @( h- N( A* W' U; t
- #include <linux/module.h>
" o" Q$ c7 z7 }8 A; R; i2 S- A$ g% A - #include <linux/init.h>1 S; g r% q8 q( r4 ~2 P% u/ \8 v
- #include <linux/errno.h>4 B, G4 k! l3 j
- #include <linux/types.h>
) i2 |6 Z. [3 S, C, O, T! ^ - #include <linux/interrupt.h>9 I, ~; Z+ c- _5 ~$ ~
- #include <asm/io.h>9 h. ~. `% R8 b( e! x1 F: [
- #include <linux/moduleparam.h>4 p g8 v6 {; h+ |. g
- #include <linux/sysctl.h>4 e# `9 x1 _# n
- #include <linux/mm.h>% i: F4 k3 U5 g, k; |2 ?( e
- #include <linux/dma-mapping.h>3 t; ~0 A" @, A& g
; M) o3 }, X5 h; e2 V/ g- N0 ~* W0 R% \- #include <mach/memory.h>
5 y9 ^' q" Z4 S' X5 p0 y; x/ r - #include <mach/hardware.h>
4 }2 k9 b" ^( I3 ^% ]) Q% y - #include <mach/irqs.h>, l6 e8 W+ x# z$ c' c9 c
- #include <asm/hardware/edma.h>/ Q* L1 n. q9 ?& |% Y
- / U( G5 s2 B! P' n( d7 y- z! p
- #undef EDMA3_DEBUG* I( U" C6 U3 K8 Z" o# h4 T; w% l
- /*#define EDMA3_DEBUG*/
& N' V: E3 ]- Y: I
; }* U0 g2 ?. G7 Z0 s8 [- #ifdef EDMA3_DEBUG
4 a$ p! l5 \! K- u' U% n# s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) f* a5 m) A) f0 i: _$ K1 @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 h9 m7 a" J# I7 w# i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& K8 R n9 r z7 l& ^# ?' I7 G9 q
- #else
! I/ s2 \8 k4 s, L - #define DMA_PRINTK( x... )
& _& J/ K, q/ O - #define DMA_FN_IN5 Y# r% W* W5 G0 R" C" K
- #define DMA_FN_OUT
$ l* ], t- X/ b. f, F, @ - #endif# }& x8 q# L' Y* C! h
- 1 S2 l- x2 `4 E. X* ]7 l% l7 |* ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 V8 }) P0 J: M* H0 F - #define STATIC_SHIFT 3) |! e: d2 N7 w; U l" ?
- #define TCINTEN_SHIFT 20& o$ @9 w" t" a; O0 }# }
- #define ITCINTEN_SHIFT 219 q O/ ?. `5 c) A6 w1 ]4 L: t
- #define TCCHEN_SHIFT 22
( M- q4 q2 O3 i# T1 ]! }& ? - #define ITCCHEN_SHIFT 23* J5 z! T& U2 L* C/ z: E
" u8 \/ m, y+ [* K. Q: X- static volatile int irqraised1 = 0;9 S9 @: z4 c ~+ s' f. L5 P
- static volatile int irqraised2 = 0;
1 ^8 J: l* I0 A5 V, k& O
+ C. J! e% R# A1 Z$ U: R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 v7 M% b' H4 ]# m1 W3 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' x" t) U1 E2 U0 m. M( C& T5 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 [! l3 [2 x$ N - 2 X$ ^! ~5 B3 ^. l
- dma_addr_t dmaphyssrc1 = 0;
6 D, H! G* Z. C - dma_addr_t dmaphyssrc2 = 0;5 V- Q. ^2 S: |
- dma_addr_t dmaphysdest1 = 0;
# |& @& [& U( F5 C1 h# X3 ]/ f - dma_addr_t dmaphysdest2 = 0;
* W9 q- z3 V6 ~! n o1 y
, u& v8 P% @) U& N" K- {- char *dmabufsrc1 = NULL;
' O& Y5 Y3 b' g, Z7 ~8 S- h& J( y - char *dmabufsrc2 = NULL;
9 n! I' e J" q; ] - char *dmabufdest1 = NULL;# g1 q Y3 U' a7 @4 a$ Z3 y- U$ n) ?
- char *dmabufdest2 = NULL;+ x' o4 X4 T' m8 |7 u
- . d _/ q6 y6 _+ @
- static int acnt = 512;
0 t# j8 B9 x, [. I - static int bcnt = 8;3 @! r# l9 y. N4 k7 N, P9 `
- static int ccnt = 8;
w! ~: Y- A/ u: n
1 o: T {" `0 x% A. T$ f$ I U" D- module_param(acnt, int, S_IRUGO);: |+ t$ N4 }! a) W. b( D9 ]9 L
- module_param(bcnt, int, S_IRUGO);) _, \! Q& C5 K: }$ k" @' Y. x
- module_param(ccnt, int, S_IRUGO);
复制代码 ' w, d1 X5 u ?) d
4 U- i6 S0 @6 \+ _+ H! h! q1 `( ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 X6 |8 A, g2 u& Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& g: T4 G V" n6 ?9 a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 t3 f% B. @& Q7 U% a# E8 Q' c* }4 p% ]' {4 m
+ Z3 l% ~- A2 W' M
|
|