|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 g2 z O( x9 l' i6 T- [code]EDMA sample test application. o; `0 U0 j& K- _: v; I0 d, L. X
- /*
; O" X# O3 a( l$ m7 w' O - * edma_test.c
' `' y0 I" l5 I0 i! o9 l g! m+ } - *0 l; V- v6 C5 Q3 w
- * brief EDMA3 Test Application( M3 F B9 W: d, ]
- *+ a' H/ F2 G b: A# [+ S
- * This file contains EDMA3 Test code.0 T C% G* ~ x' x
- *
. m. n r1 O0 l2 |* X0 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. g( G7 u- G* C, h1 i* K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ B! f5 f9 Q, j. K
- * TO CHANGE.- k/ }/ J9 ]5 T: N3 q
- *
, e; f# b" g6 f1 ?4 U" f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' ]$ U6 t: {% | - *. ~( T* m. o( p
- * This program is free software; you can redistribute it and/or( _. A5 y5 C& m X2 J4 T
- * modify it under the terms of the GNU General Public License as4 J9 M3 L3 U7 s! l/ X/ l
- * published by the Free Software Foundation version 2.7 R R/ V2 b( n+ N- w( l- Q
- *$ m7 e7 s, ]$ ? M+ c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- h3 R- l' z4 T$ G! h3 R - * kind, whether express or implied; without even the implied warranty
1 |6 P5 w. y7 A1 t, R, s. Z$ j4 s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. C1 K' _3 {% l J - * GNU General Public License for more details.
- i" i8 R; V8 l% N# P; L - */! J6 @/ `3 k* M1 {3 ~4 _7 \
) k' q$ R6 N# m2 S- #include <linux/module.h>
- a# q/ \" s. b+ w - #include <linux/init.h>( \; ?9 A5 |/ ~; Q/ G
- #include <linux/errno.h>+ g( s; g. v. I
- #include <linux/types.h>
1 _; O7 l" [+ G - #include <linux/interrupt.h>
6 O1 g v, E0 P0 w; A3 D* e - #include <asm/io.h>* q3 s6 P3 A. w, B1 k* s. y
- #include <linux/moduleparam.h>7 L) g# a$ }$ j
- #include <linux/sysctl.h>* J7 [2 r0 y6 U) z( X' q# w/ _3 A. o+ r# O
- #include <linux/mm.h>
* Q8 [4 a' ~. b6 y3 C - #include <linux/dma-mapping.h>
# f' {; j2 N4 h: ^* h; x5 T3 C
5 Q9 G- f$ G @$ W5 r( o/ N" W, T- #include <mach/memory.h>
& e1 B) K3 N- X; h7 x+ R V' s - #include <mach/hardware.h>
4 p6 O% K# q* H0 ~% D* D - #include <mach/irqs.h>8 ^( ]% |& e( m+ w) B0 ^
- #include <asm/hardware/edma.h>
% k/ y- H5 `9 t5 b6 \7 ]; b1 o - 3 r. y7 U' D2 {, [
- #undef EDMA3_DEBUG
. `! J( x# o' \9 W. x) t' j - /*#define EDMA3_DEBUG*/
: L2 W. s: q4 f0 U- f/ B- m - # b4 z F2 ], S+ c! A
- #ifdef EDMA3_DEBUG, E1 N8 [' e; I( N8 H/ p2 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' c4 g9 l/ U3 @; i: Q9 S) U3 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# Z' }9 A8 \* y3 C+ o! L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( `6 }& U3 T3 F6 P7 O% ]; T6 g - #else! g% W% q8 J- f3 m
- #define DMA_PRINTK( x... )# w/ I0 R' p' p0 F) g" T: S4 ?
- #define DMA_FN_IN; c1 e; ^; [/ W! `8 J
- #define DMA_FN_OUT
# z' R- \7 D% q. @ - #endif, X% _% ~$ Q [, ?* C9 b" o
. `2 j( V: N: [& H( z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% h6 B, i3 s3 y. r8 W
- #define STATIC_SHIFT 3( P! W7 s- l; t- ~( S, M5 Q9 R8 U
- #define TCINTEN_SHIFT 20
" j1 O% X; ?: f# I2 f4 O - #define ITCINTEN_SHIFT 21
6 H) n9 Q; z4 k - #define TCCHEN_SHIFT 22+ S" d" G8 a+ C$ J9 w
- #define ITCCHEN_SHIFT 23
2 @- M; m: c' ~5 f4 M
$ f8 @8 N0 a9 Q& ^4 \4 m- static volatile int irqraised1 = 0;
( d5 D. e% T P. m4 @ - static volatile int irqraised2 = 0;! p& Q& q7 Y% d7 Q3 V! N4 J8 j
. M$ |- S3 y* W. l4 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E. ]: l' W4 B6 Y0 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B# c. L1 V0 [9 R; u- h( X/ U$ S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) {4 n+ s3 ~- ^
4 _+ U7 W4 U+ E2 s5 ?$ e$ \* _! y1 V5 k- dma_addr_t dmaphyssrc1 = 0;/ t4 y( D! D4 I$ ~1 H
- dma_addr_t dmaphyssrc2 = 0;7 M' ^; `4 u) s0 [: _
- dma_addr_t dmaphysdest1 = 0;* \( f+ {/ D8 A9 G
- dma_addr_t dmaphysdest2 = 0;
5 O6 N) M+ H* ]+ P0 J- H
+ _. L1 s0 V; |- char *dmabufsrc1 = NULL;
" v6 N6 S1 B. t/ u* q - char *dmabufsrc2 = NULL;+ ~/ H7 P& f( S6 P% }* x
- char *dmabufdest1 = NULL;
3 W* Z8 r8 _9 C% |& _; b' o. A! h. ? - char *dmabufdest2 = NULL;
+ G1 U! G; E8 b
v# \3 l0 r& q) |2 [- static int acnt = 512;3 n6 v$ m8 K; V' G. R1 X8 A h
- static int bcnt = 8;
7 |# s7 N1 r5 \6 d6 O6 G - static int ccnt = 8;
8 U Q, |! H: M- r" m - , c2 J7 R3 @! M. [ g
- module_param(acnt, int, S_IRUGO);* B/ _0 n4 D \! z; t4 j+ `1 j
- module_param(bcnt, int, S_IRUGO);
: t) U- a: Y5 l" F" y - module_param(ccnt, int, S_IRUGO);
复制代码 % e# A$ p. u1 R5 w. Y! n: ?
3 B% p2 f' c" g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
G9 p$ F: e0 O0 a! Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, D; t2 k) w8 r+ ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 h3 ?+ d% {2 N8 z. y$ e8 ^* z' @1 O6 i; E$ D
6 n i4 {) o1 L6 h J7 v
|
|