|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& p8 Q" ?# [5 V2 p/ w# v8 Z- [code]EDMA sample test application/ H0 A: A0 L. B8 w, X8 P
- /*# @3 p2 ^, q, E2 Q
- * edma_test.c
) X: E6 F% S. q& I { - *
7 `/ l* U# @# k9 Y - * brief EDMA3 Test Application" E1 n" u- ]6 x& Q# g' m m
- *
; L; o2 d2 E5 D - * This file contains EDMA3 Test code.
( p4 P" K8 p9 Q7 _6 b - *
4 X/ L) c4 U9 N2 M4 N' `& Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# b) i: H2 U- K4 [/ l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 C. {. ], k* g0 {7 j - * TO CHANGE.! B" Y E( y8 N) U) u6 U
- *3 h$ |7 R! @% [! W( d* F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% I1 ?" L2 K" `! N ?
- *# l i2 X4 l5 k z. l
- * This program is free software; you can redistribute it and/or
, Z. z, E+ S# F1 I0 s1 Z - * modify it under the terms of the GNU General Public License as
$ z- q, Q" L, y( d; W) \# V - * published by the Free Software Foundation version 2.9 W1 p; [ x5 n, l
- *
( W- b# {) O3 |, |, \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 T& x7 _/ E( |; Y% h$ f5 l1 J - * kind, whether express or implied; without even the implied warranty4 y3 G- T! I' q3 z5 H6 a; f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 Z5 |- Y0 N& m p: R4 B6 ? - * GNU General Public License for more details.
. t7 R& v( q( ]3 j6 J! o. ` - */
; p. d! m! h8 m2 f5 W1 h2 l
. p4 r$ v) B1 H- f/ m# @- #include <linux/module.h>! r! C3 f; O8 k5 v0 X( |
- #include <linux/init.h>4 d. `5 g* g, ~+ _- D
- #include <linux/errno.h>
( Z/ X, I+ A, g( }! z0 Y - #include <linux/types.h>
" i2 F& |$ z. Z1 U' M4 K# V - #include <linux/interrupt.h>6 {. ^& _- l& e- I
- #include <asm/io.h>
8 W$ a) _! G! E/ l/ {4 p; h8 y - #include <linux/moduleparam.h>
`& A1 S4 @( U9 n( E - #include <linux/sysctl.h>2 O6 g5 v7 g( n' ^
- #include <linux/mm.h>
( D" C# @/ L5 v/ z' B4 M- P4 Z - #include <linux/dma-mapping.h> J& M# r+ U4 R6 j0 u1 ]
- p/ h- A3 O& S W
- #include <mach/memory.h>
! Y5 f% a* f* B0 ` - #include <mach/hardware.h>
2 n d. u6 O7 b0 m; F - #include <mach/irqs.h>
: Q! P7 H6 | `% d4 h! j# L$ q - #include <asm/hardware/edma.h>2 P. P2 I% @# z
- % V0 D; n' n" Y h: \/ t
- #undef EDMA3_DEBUG' S# Z& ?8 l# Y8 x- K9 L
- /*#define EDMA3_DEBUG*/5 i% v* z8 @) S
]( B7 V- a% k; B# U3 j# u- #ifdef EDMA3_DEBUG
6 M1 L7 r$ R4 M- @! D6 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' s& F7 h0 T* Q2 r. |) l: f# X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( G; L$ z6 D# A% L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ X- Y( F2 h, F( [5 \ g, V2 X! |5 G
- #else
) D& Y% @- U$ _) Q9 t - #define DMA_PRINTK( x... ) r! ?$ w) L- F9 O8 C
- #define DMA_FN_IN# E0 ?# |5 ~! A: m4 \ E
- #define DMA_FN_OUT
$ j0 ^9 Z# U. A; W6 S - #endif
" _; ]7 t9 a7 I D+ ]9 I8 q
* x. D& t/ E. P. L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 d$ }3 R' o5 F; { - #define STATIC_SHIFT 3
8 Q" `% ?5 X; N - #define TCINTEN_SHIFT 20
G M) U& x' x) r7 y - #define ITCINTEN_SHIFT 21
9 T5 b0 g2 b$ t) q( r, t - #define TCCHEN_SHIFT 22
/ B9 \4 W4 z" R! C( r - #define ITCCHEN_SHIFT 23
/ Z) q X6 e% ^- f/ x' q/ v6 h - 0 @# t+ K' S9 w0 U
- static volatile int irqraised1 = 0;4 s: H6 s( \9 }& d# q
- static volatile int irqraised2 = 0;
+ w! v' l7 A. |+ _# A
4 p$ Y2 S: C* }- `7 R7 u* S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 {3 r/ ?; A9 g8 r- d/ _" p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f1 r- {; s: V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 R; @8 v, B' m( I) ?
- . z% m0 `8 j. t- l/ w
- dma_addr_t dmaphyssrc1 = 0;) T8 E5 g' E5 B- D& W! o- K
- dma_addr_t dmaphyssrc2 = 0;0 s% o a0 z" h2 l% @3 R$ L( O
- dma_addr_t dmaphysdest1 = 0; H$ L; X( S8 V7 h' e$ o/ _: R
- dma_addr_t dmaphysdest2 = 0;; f7 t# t( d. I
- / `5 {) V) b8 ?6 X2 `
- char *dmabufsrc1 = NULL;* P7 h8 ] H; `: k# r
- char *dmabufsrc2 = NULL;- G4 m6 l! H4 a8 I
- char *dmabufdest1 = NULL;' q) T$ @1 U" [! O7 j' `% i$ c
- char *dmabufdest2 = NULL;
4 X0 H9 g* T7 U- x
* }- |! O: g+ l$ W% \- static int acnt = 512;
1 Q/ X2 j0 Y! |/ { ? - static int bcnt = 8;6 B& T$ }. r2 L# K$ A, r/ A
- static int ccnt = 8;
( \8 \' }& j/ x. L
9 p9 }$ V7 ]# ]9 e) u; ]+ x- module_param(acnt, int, S_IRUGO);
/ v( a8 h# s9 p" h - module_param(bcnt, int, S_IRUGO);
3 F* V" |$ j% w+ L - module_param(ccnt, int, S_IRUGO);
复制代码 : U, Q: s& z" `0 h
) u( ^9 |# M) P8 v. t& n" T( x4 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' M" O- x J7 p1 q7 I% n$ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' E# f! M7 m, C1 F6 F; D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' W3 v% X" Y! ]& ^, |
8 O6 k" f% b4 ^, ?( v6 n( I0 ^4 T! \5 l1 R
|
|