|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % @' Y$ u" S; v
- [code]EDMA sample test application2 Z3 z6 }6 B) L
- /*% Q" v# B/ [9 Q
- * edma_test.c
) k5 Q+ P2 }% Z( R - *
! | X& i$ b! m! V - * brief EDMA3 Test Application2 j/ P2 {4 m1 a: b' G, f8 d
- *
1 r8 R( k8 T3 w) j5 h3 {+ |, D, g& ~ - * This file contains EDMA3 Test code.
5 n5 |3 t" ~8 M, j - * T4 [5 M; L5 Z0 H) ]9 p, j& Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" `4 s$ M4 Z' ]6 U& j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. f: x* {/ k( i/ c3 r1 ~% A - * TO CHANGE.
7 K" S+ e. L2 q& p4 F - *: ]% [! @8 n7 W& E% `5 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Y, l! M' ?5 }% T
- *
2 M; f( Y+ Z+ t& j. l* D" W6 k - * This program is free software; you can redistribute it and/or7 C s' B0 }0 `/ \
- * modify it under the terms of the GNU General Public License as
& K0 l0 f; s( G; ?2 ^ h4 g1 y+ T - * published by the Free Software Foundation version 2.
4 T# ]( k8 v. M; C) Y) ?9 _ - *% R8 G7 ?3 |5 q# a; A2 y& C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ l$ `$ z# x4 ?2 N+ c
- * kind, whether express or implied; without even the implied warranty7 h9 g1 z Z4 \! w3 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 W" U8 l: E1 `5 v2 t - * GNU General Public License for more details.% Y" V' O5 Q3 h
- *// T3 A) m/ }: D S p3 m
- 3 m+ R5 d0 }8 G, ~0 `$ s% N. `; s- ^1 L
- #include <linux/module.h>
* R. m: }5 W0 }3 _: v/ I) T - #include <linux/init.h>
# d$ A0 s: R4 J - #include <linux/errno.h>) s. x6 _2 x: Z" h, X2 B
- #include <linux/types.h>1 X# [- j& F! p7 I1 P
- #include <linux/interrupt.h>
/ ?% g8 Q! j& D0 Y1 c - #include <asm/io.h>: d* f$ B, j4 t& Y
- #include <linux/moduleparam.h>
9 d6 y! B% N3 k1 w# y. v - #include <linux/sysctl.h>4 `% J* m# L$ u
- #include <linux/mm.h>6 |# x% B3 Y( f0 `6 b: _( t1 B2 y* I
- #include <linux/dma-mapping.h>
; E% v5 w# n% O y; z4 q
# E+ A/ H8 ~& I7 D, j- Z- #include <mach/memory.h>/ U1 ?, I5 l# R6 g
- #include <mach/hardware.h>
) Q' x% j3 V# Z$ @ j5 ^6 Y& } - #include <mach/irqs.h>
5 k+ D% ]1 ^; n5 S9 j - #include <asm/hardware/edma.h>
2 T$ a( c( `5 ?1 ~+ H5 m - ) p3 z' q6 u3 D* q* r w! O
- #undef EDMA3_DEBUG) B+ f' r; ~9 A5 E
- /*#define EDMA3_DEBUG*/; V# C# Y0 C i
- " t+ g8 I5 R; \) U0 K
- #ifdef EDMA3_DEBUG
5 y' d9 k/ b# t% r [+ A& j& Z- W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ f, ~* N+ d3 O# h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- _! {& o. R' W/ }/ k8 }; @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 p3 p; ^1 z; V A9 T* Y
- #else, }- p" G7 P- }) t' R% ?4 z* m
- #define DMA_PRINTK( x... )( X. e0 ^4 l2 k8 m8 b
- #define DMA_FN_IN
! `+ x" _; h0 V - #define DMA_FN_OUT" }# l- Y# H2 ]
- #endif; F4 Y9 Y$ G* [) E$ Z7 `8 K
- " @# l) F' i* Y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ o' q" F1 ^% e, u( ~3 k( x* X
- #define STATIC_SHIFT 3
! ]& Z- ` ?5 u: d - #define TCINTEN_SHIFT 20& M' k% y! L3 s1 n' C- Y
- #define ITCINTEN_SHIFT 21/ U/ ?/ N' N( c$ I1 E
- #define TCCHEN_SHIFT 22
5 P' [& q, {8 e" ]$ U. C2 u - #define ITCCHEN_SHIFT 23' H2 [$ O. @: A3 M! b' | ]' W
- 5 }* ]$ S3 Y/ [3 Y! W- ^, E
- static volatile int irqraised1 = 0;
, a0 I _0 q! L0 q3 I& d# m - static volatile int irqraised2 = 0;$ v5 p# b k u: p' @6 H/ J+ ]
- ! S/ s8 `7 M8 t+ I$ b" \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ]( }; E( {# c1 F" [9 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
O+ E4 z! q6 q' g( s5 e# v6 b, c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ O$ x- Y7 I6 s5 h5 Q( J K
8 T$ ^9 A! q6 {% n; [4 L" `2 t- dma_addr_t dmaphyssrc1 = 0;# K, m m: e9 W# r% U6 f9 k& q
- dma_addr_t dmaphyssrc2 = 0;
: i* g4 R) j# S! O7 F3 ^ - dma_addr_t dmaphysdest1 = 0;
8 m4 V% d0 A0 C7 L4 _ - dma_addr_t dmaphysdest2 = 0;8 M1 }( G) R* w' \; ?9 a+ J
: M) m. u/ F d3 @( E% i- char *dmabufsrc1 = NULL;' c/ ?0 e* \& {" U' [8 E5 M
- char *dmabufsrc2 = NULL;. _: R5 m6 \7 y
- char *dmabufdest1 = NULL;
) g0 Y4 Z( z* X6 q, t, R8 X - char *dmabufdest2 = NULL;) u' \$ a* t# D6 @+ B$ d. J- _% z
- ! A" V* T4 d+ B$ E4 u7 P
- static int acnt = 512;
; B8 e- J% b& A# n - static int bcnt = 8;0 D. w i0 i" Z* P1 j
- static int ccnt = 8;
, T9 C: `7 H1 R- G9 l
% y; \$ N3 K* [% X) W- p0 k8 u- module_param(acnt, int, S_IRUGO);
- U% l/ ] a% o$ ]1 U% s - module_param(bcnt, int, S_IRUGO);
. S# y+ R1 U; A0 t - module_param(ccnt, int, S_IRUGO);
复制代码
; N* l$ c) D" E/ k
# Z( L d) L3 Z. |4 @: _& _: n6 [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 D) l: K, M8 v, B$ v4 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* U" B2 s7 C; |6 H1 z. e4 t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 N# i5 Z; T( y+ J0 e' I( c" s
6 e2 y* _) A. o p* J7 c h- u3 o) F6 y1 W7 Z+ \
|
|