|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 N7 O3 d; U2 q! ?2 P2 W
- [code]EDMA sample test application
/ R. h# |0 ^0 w6 M% U2 x - /*
- e% A$ E' q& F0 Z - * edma_test.c
) x2 Y) [$ l6 i3 D$ \; `& Z - *2 K$ p6 Y5 h- @
- * brief EDMA3 Test Application( r9 R; l8 E. l% r- @+ t* x' [! Z
- *2 ?% s( V( Q5 L5 b2 M, Y( Y
- * This file contains EDMA3 Test code.
3 `9 b$ V" A8 b K4 L$ C( F - *
a- y; U* ?0 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) ^+ `% X! t* j7 T& X6 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 M( l/ R8 c; ]5 }- m2 u - * TO CHANGE.
) j# W7 `2 g$ ?( m$ l5 I; ? - *: h% F0 k/ b: w" Y L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ _1 {9 C) P9 @( R
- *1 W& d; ~$ J u# J9 {
- * This program is free software; you can redistribute it and/or' x! ^$ a4 D g
- * modify it under the terms of the GNU General Public License as( P+ v, U( X0 B
- * published by the Free Software Foundation version 2., q0 ?4 o4 h! w# I9 N
- *
. c; _* Q/ F' M6 x; _6 G) ]# i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 M' M+ v5 w; J
- * kind, whether express or implied; without even the implied warranty/ K( B) k+ S0 }
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~7 ^0 v& I x8 r4 m8 z$ C - * GNU General Public License for more details.8 X: b* q3 V4 S* p( x% T+ x
- */! c0 h _2 _4 o! e7 x: a8 \3 J# r& f' }
- 3 Z! W+ }6 v* e2 R+ N5 L
- #include <linux/module.h>4 u/ h. T' U: J# ?) I: I2 H
- #include <linux/init.h>
$ f* ~3 x( V" J) h7 v6 u8 i3 T) b+ W - #include <linux/errno.h>) q. ^4 ^5 v4 i, P
- #include <linux/types.h>0 V# W1 S8 z* w- p, |* L/ Q8 H+ z
- #include <linux/interrupt.h>8 H, {; ]0 Y7 x E9 W1 h
- #include <asm/io.h>
$ h2 F% Y! ~% p- a- X4 H" v( S - #include <linux/moduleparam.h>
+ J: f- T$ j: v8 s - #include <linux/sysctl.h>9 H0 D3 i, I/ e [
- #include <linux/mm.h>
9 q( X; S8 R, Q+ l$ G: ~% M - #include <linux/dma-mapping.h>
1 ]9 ^, _& S! P7 ~; `5 a! \: _ - 7 v q% @9 w& W5 h+ h& x/ V5 Z# S1 }
- #include <mach/memory.h>1 J! S5 B0 ~' u4 a8 X
- #include <mach/hardware.h>9 E0 E5 h) Q r
- #include <mach/irqs.h>) Q7 N; H! J; _2 A
- #include <asm/hardware/edma.h>, z& ?( U4 J! M. U) d" _ S
- $ ]% X/ _" E/ p8 o
- #undef EDMA3_DEBUG8 l" n; L+ p7 X7 p- G
- /*#define EDMA3_DEBUG*/& w( {# n2 q! x5 @9 [5 a
! L6 S; A( e+ \9 j" T4 _: ~* M- #ifdef EDMA3_DEBUG
0 ` Y6 l9 h, k' Q- U1 v& E! W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ W, ~# q' o& I Q# a7 F( c* d5 S* B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 X; D4 O; b! H+ X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# \: I) a- r8 r- o
- #else
8 W" f: e( M; ?+ X# `% f- S - #define DMA_PRINTK( x... )
# Z- V8 n* Q7 u0 D - #define DMA_FN_IN
1 p, Z1 J2 i q5 ~, ~/ S - #define DMA_FN_OUT
9 k7 ^1 M2 \- F+ `3 } - #endif2 O4 v8 _7 e8 A1 [8 Y4 p
- 0 S+ t2 S$ M$ D( `( k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 s. x7 F% b$ c% ?% s' N4 j - #define STATIC_SHIFT 35 H V0 ^- @% q+ t& B, ]
- #define TCINTEN_SHIFT 206 e/ ]0 [0 }; Z/ z6 e1 S! w+ E
- #define ITCINTEN_SHIFT 21
" |5 o' ~4 E( M u' S - #define TCCHEN_SHIFT 22# h- S+ s* U6 i2 E; `' v
- #define ITCCHEN_SHIFT 23' K+ f) N$ U9 ~2 n2 z) ~
- . @, E& [ T4 f* _$ x. l& X
- static volatile int irqraised1 = 0;' d# j5 Q, |0 W/ v, g
- static volatile int irqraised2 = 0;4 q# R6 p7 i, G' j
: k+ b! v: ~$ O; K' c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t/ e+ U, Q; v/ J7 k1 T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, s/ j1 q3 F4 u4 [6 {- ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# v$ C& g( l# e. V8 b* e: k
) r7 F8 a( T# k9 j- dma_addr_t dmaphyssrc1 = 0;
+ x/ d0 V. u2 L# X - dma_addr_t dmaphyssrc2 = 0;
" z( X7 t6 a' z5 t& f, Z - dma_addr_t dmaphysdest1 = 0; ]4 m9 s& e% k1 ] q2 p$ W
- dma_addr_t dmaphysdest2 = 0;0 c( D/ i2 T4 G, o: T/ Q- Z
- 4 R# m7 U& M, M+ i c8 g
- char *dmabufsrc1 = NULL;
% d* F `- q8 A D6 b, m# B - char *dmabufsrc2 = NULL;
$ _2 V/ E; f$ T$ |$ Q - char *dmabufdest1 = NULL;
% q$ _" X" ~" V5 C' S1 ?3 O - char *dmabufdest2 = NULL;
8 L5 K7 J, n; F* a - ) I2 ]: o4 O u2 H6 ~% ~
- static int acnt = 512;2 P& B6 h. `, ]8 _+ {: Q8 T* `
- static int bcnt = 8;
: G) P* ~0 [+ h E - static int ccnt = 8;
9 P) ?3 W+ M3 d5 D# t1 r' {
/ C# T. z( F$ k$ d8 i0 ]- module_param(acnt, int, S_IRUGO);% g8 g( P- @$ B) F, A
- module_param(bcnt, int, S_IRUGO);
- |. q/ A; u+ K8 N. H* [ - module_param(ccnt, int, S_IRUGO);
复制代码 5 u" X4 s G, ~1 |( x7 j
" n- z e1 u' ~- c. f) g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' d: b. ?" Z8 f8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" T+ E& e7 ~; k# i3 Z8 h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% ^3 w7 r2 K) R( e3 w5 k, i9 n: ?- s# N4 A
% Q$ g1 T6 q" w6 B' o" G* E% F
|
|