|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! q, ~7 [# @' G. U% H+ D& m- [code]EDMA sample test application* @$ Y# I# H: ^- P9 w; l. _2 ~
- /*
0 q2 k" k! V: y/ q5 R- z9 U8 g# T - * edma_test.c; H; m1 ]" u6 b4 K) l
- *
3 Z3 R4 w2 n) {& h; Q! f7 V6 f. A - * brief EDMA3 Test Application
/ `. e' K* b' e9 {9 K/ A& Q7 W6 m" C. ~- I - */ P9 F/ E, E6 J5 u. Z: y1 H7 y
- * This file contains EDMA3 Test code.$ g1 _/ F( r' r5 ?' ?
- *
! ~, ]2 L5 x$ O0 H' c* k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) _! N+ ^: I x2 ]- Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. M! \6 b/ k) z0 S+ s - * TO CHANGE.
8 @+ b9 t- U1 h" N" A - *. {5 T( h, s- g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- [2 y" r8 S/ W - *2 z" }5 l# w e+ |: {/ ]
- * This program is free software; you can redistribute it and/or
: W" X0 o# Z+ W' n9 f3 ?( j3 U7 o) N - * modify it under the terms of the GNU General Public License as T, o. z* p: W
- * published by the Free Software Foundation version 2.2 R$ J6 n5 ~4 @5 r" p0 t7 C
- *
2 j# e: j7 g& s5 V! r# B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 `. C4 m3 G% `8 u0 E - * kind, whether express or implied; without even the implied warranty
" c% O; T5 z8 S/ _5 I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; M( Z* W7 y! [( h R - * GNU General Public License for more details.
0 g7 X8 `, c2 g, ^* {1 L0 ?- p& p5 U - */
# ~5 ~9 D% y) k% m. E) N. g# p
' a8 g5 n1 p( v7 L0 T- #include <linux/module.h>
4 W' `0 ~0 Y. ~ - #include <linux/init.h>
6 l F# {# J [ - #include <linux/errno.h>
+ E. ]* l% y- x Z8 K - #include <linux/types.h>
* q9 I; ?6 i& @! U - #include <linux/interrupt.h>
$ [4 q, i% X+ a9 } - #include <asm/io.h>
6 v; \5 Z$ n4 K$ I C* p - #include <linux/moduleparam.h>2 ? l4 N* _, z/ H. [3 H
- #include <linux/sysctl.h>
) M" N: ^: ?+ p, O - #include <linux/mm.h>3 ?4 l- t. M6 R. |6 z7 P' t7 z
- #include <linux/dma-mapping.h>. m! v' z! X R) E" I$ X
! r s& i& k! @) ?7 K' W( x2 g- #include <mach/memory.h>
: X( _: R& j V1 I! ?' o$ x - #include <mach/hardware.h>
) w( j7 I/ H7 n6 N. j' G0 u L - #include <mach/irqs.h>$ m6 n/ y" j9 q* A8 a0 u# R4 V
- #include <asm/hardware/edma.h>, T% \; j! T- r* R# J
- " H: k+ o. l5 x" o
- #undef EDMA3_DEBUG4 a4 S/ j/ M: T7 C* n
- /*#define EDMA3_DEBUG*/- e E7 ]. q& ^" Y' ?: R: F" Q7 j
; Z- I! |* d- [; F9 |$ N4 f* a- t l- #ifdef EDMA3_DEBUG
2 D# P( Y" R6 L4 N* S% p* D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 C- U/ p* j8 p' e: E) [3 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 Y% h+ t" \1 P' s6 W - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- B% J0 r$ g2 h9 w0 h4 }$ g! M
- #else& s0 \" o0 d/ a1 s' Y( e/ J* V
- #define DMA_PRINTK( x... )5 U X9 N1 m: @' t
- #define DMA_FN_IN
; }# f& U' p; G/ ` - #define DMA_FN_OUT
7 D; n; y$ i! J: D% R - #endif- y) d; k! U4 m$ P* G* L' K
% ^. g j# H; Y7 {( j" j# K1 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* `- l- j6 E1 |* y$ B- f - #define STATIC_SHIFT 3
( }) p( v& O5 a# {$ L3 Z0 E - #define TCINTEN_SHIFT 20) k. X" k" I# E/ B3 x% ]* k2 M0 G
- #define ITCINTEN_SHIFT 21
. Q1 A* d2 C- Z- K - #define TCCHEN_SHIFT 22
' f8 _( |* d9 y9 }4 a - #define ITCCHEN_SHIFT 23
. T$ i' z) D( ]( j1 J
! C& u7 d+ g; ], v- static volatile int irqraised1 = 0;
3 M& L! j; I. @2 c2 o - static volatile int irqraised2 = 0;
9 N j% i& C. J3 `1 {. d - , H( _* j! k g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* W9 z& }6 x& f- u0 O& b: Z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: @ T5 X! E y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h0 m3 W! U1 p Y8 e
- 7 h7 k! B ~, r% a1 p/ M
- dma_addr_t dmaphyssrc1 = 0;
- i. }, [5 Z2 g1 P ~ - dma_addr_t dmaphyssrc2 = 0;
+ g6 O" i5 e) q& R - dma_addr_t dmaphysdest1 = 0;
1 r/ U+ O& j( C - dma_addr_t dmaphysdest2 = 0;
; C; F5 F. N5 a+ ^ - 1 V" L( ?6 ^7 \6 O
- char *dmabufsrc1 = NULL;4 L1 k: s' ?* _6 E2 k* d
- char *dmabufsrc2 = NULL;
/ A: l1 _2 `0 r5 Y& P. i) |2 ^ - char *dmabufdest1 = NULL;
2 ~$ m' I( @3 D. Z5 C, h) U5 ^ - char *dmabufdest2 = NULL;
" F, d8 D' O* X5 m* O
. ~$ j/ r7 {4 X) ]3 D- static int acnt = 512;; p: K1 M- X) z) n' I0 \1 B# X
- static int bcnt = 8;3 X! X) [! p) E: R$ A% u+ d. s
- static int ccnt = 8;* Z* ]9 D- i- a
- f* J& g1 I* ~' K( \
- module_param(acnt, int, S_IRUGO);
' W w- A2 b- ` - module_param(bcnt, int, S_IRUGO);6 F$ V. D, T B _' c# N
- module_param(ccnt, int, S_IRUGO);
复制代码
. Y1 N: K( X, \ ^. ~5 }" j3 F+ o8 H1 X p `9 W8 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' b7 u5 g6 B. Z, i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ^' K0 i* @/ L, M3 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ f0 Y' @4 w8 x% I5 S
5 c$ }8 q. f: r5 A& U( a
% r% f! X! _- Q |
|