|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . N+ [0 X& i; j; n
- [code]EDMA sample test application! L* y4 C5 l' G/ d
- /*' y# x2 ?) D0 {; d* A
- * edma_test.c4 O. f2 s3 s ]7 t: d% W4 Y
- *
" G" w8 S0 U! [9 D, q* ~( h$ N* p. | - * brief EDMA3 Test Application+ \- n) u. D' c1 l7 Q
- *% R8 `; k, s" X/ |
- * This file contains EDMA3 Test code.7 T6 Y4 c6 Q1 I+ g q+ ?
- *
- D6 M. k Q4 w3 J$ K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' [4 G: P/ D, T5 @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' h+ }- P% k9 m; y" b/ n7 s - * TO CHANGE.
7 F4 `0 v1 w2 b2 z/ ^1 e - *
# f# {+ Q5 N1 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i7 }8 _; \( p+ {
- */ B6 E4 N- F$ Z3 b8 W/ y. T3 d9 y
- * This program is free software; you can redistribute it and/or5 y# @ I X5 r d/ t
- * modify it under the terms of the GNU General Public License as9 D) C0 `0 h. S& p6 y4 u+ Z( a
- * published by the Free Software Foundation version 2.3 [/ N6 U+ k, v3 k/ I9 G7 f
- *- a5 i1 X- W+ C4 _2 L- T4 v% `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 d" O1 s! l1 t1 X( b( k3 ~: k/ @ - * kind, whether express or implied; without even the implied warranty
0 ^, `' }# a- p4 H8 n, p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' Q {& q0 T: J8 }
- * GNU General Public License for more details.
3 y K0 K0 U, `; ?5 [ - */& d! y# n8 i; `+ W- @7 {
2 a4 F$ A' G9 e0 X! j; ]* P- #include <linux/module.h>7 x. l, N) o( T; O- A( Y
- #include <linux/init.h>" H2 @$ j4 [$ I
- #include <linux/errno.h>5 b& q# @* |/ E5 T0 g4 G/ a- ^* {
- #include <linux/types.h>5 z8 c0 n2 K" F# b& n
- #include <linux/interrupt.h>
6 B) s3 K7 Z9 `: I3 G% A - #include <asm/io.h>) S4 ?( G4 m# Y
- #include <linux/moduleparam.h>
: C- e8 F1 \. y - #include <linux/sysctl.h>' k9 l; |8 B0 f- j! {) t& T' V
- #include <linux/mm.h>
~5 n% t( D' M - #include <linux/dma-mapping.h>
9 q# o/ c1 J; d1 L [5 p! \1 x - , F& f9 d" n$ B, G9 C
- #include <mach/memory.h>
% v" h0 o o% D; N! @2 s - #include <mach/hardware.h>
$ u. U S$ T" e% b/ `; L - #include <mach/irqs.h>
, z$ `* o7 _# C6 v3 j - #include <asm/hardware/edma.h>2 t' ?7 U9 w& M; n3 Z
% T( Y0 C" \. H4 ^- #undef EDMA3_DEBUG9 d2 `) _ Y; H7 d5 l3 [# ~5 x
- /*#define EDMA3_DEBUG*/! A8 T# G2 J; @, U
' q5 w6 h; \1 C3 O& [! U1 L- #ifdef EDMA3_DEBUG9 v4 L/ |# ]2 K& W, p# ^) W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 j+ L# K' u# I4 M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' y" i& Z; Q8 R0 A9 \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ X# O% B: a7 g# S: n
- #else1 n9 U M1 X% F- y+ m! t3 x
- #define DMA_PRINTK( x... )
% W D' A1 ?1 X - #define DMA_FN_IN4 b$ M n5 S3 u# U, w [
- #define DMA_FN_OUT' N/ l b/ ]0 T: ]( u0 Y# Y/ M: p
- #endif, {9 X- I- O! K+ U: m* Z
- - A9 |* U" Y5 k" h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" P( ?9 G# \/ C" S
- #define STATIC_SHIFT 3
2 w( S7 ]/ }1 l F% w - #define TCINTEN_SHIFT 20
- Y9 s# c0 R! l. f - #define ITCINTEN_SHIFT 21* _8 S/ B7 u# d0 e7 @ U: \
- #define TCCHEN_SHIFT 223 l1 ? |( W. e# [1 X3 |
- #define ITCCHEN_SHIFT 23
1 W2 }1 K+ N7 l/ k4 E& z2 y& r
( z8 T$ z: b4 b# x; B- static volatile int irqraised1 = 0;
! E; C) X/ S) y& X- {! J n- E - static volatile int irqraised2 = 0;
7 Z( e6 ^% m( m% x
2 I9 l8 d* h4 N3 j- E- {+ l8 A3 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 _& J" D# W4 T4 C) G3 U. t: j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ?" O6 f, {; E6 P- h) U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' h! T, _* o n( K/ A- t
; U$ z( o" e( I3 K! F, |5 G6 ~- dma_addr_t dmaphyssrc1 = 0;
* u+ J+ y* f8 i. x0 `( L - dma_addr_t dmaphyssrc2 = 0;) v4 Y* T1 D3 L+ b0 v1 r
- dma_addr_t dmaphysdest1 = 0;
+ q+ w! F: Q" W" T \ G3 o - dma_addr_t dmaphysdest2 = 0;
$ Z, ~/ q: ^! t& A6 { - & Z8 t- y/ K) c5 K6 L+ `$ g
- char *dmabufsrc1 = NULL;$ e8 j$ m) L* Y8 `9 N+ `
- char *dmabufsrc2 = NULL;! y+ d; N; K' h* N) r% J! Y$ z
- char *dmabufdest1 = NULL;
% Q, i- O. R/ ~( g5 X( M. L- s4 H0 Q - char *dmabufdest2 = NULL;
) B+ d/ v. V0 _" N% |) x# @
' S, D6 R/ y' [( {! ~: C: [- static int acnt = 512;
* Z* D! w. N/ ?# @1 h) Y - static int bcnt = 8;
& [3 J m" `& s - static int ccnt = 8;
0 ^: t: d/ e0 g3 L5 c
0 H! S" n, J. U& g4 t+ Q& F- module_param(acnt, int, S_IRUGO);1 d" q0 _4 {7 I1 |5 D/ ^
- module_param(bcnt, int, S_IRUGO);0 ~+ v7 |3 h5 q5 ]2 K% v2 @) |1 b
- module_param(ccnt, int, S_IRUGO);
复制代码 0 _0 Y9 T6 G8 O% [* U( |
1 a6 x+ Z# D# S! n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) ] A* d5 d0 F1 M0 D/ } 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. |2 E# Q1 A# [3 r1 n5 Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 o9 Q. W: l' r; g9 H
/ W- x0 G+ P/ H: V2 \/ L
) R1 U& B5 s) C* ] |
|