ucos_timer.c

来自「ucos_ii基础上加上网络功能」· C语言 代码 · 共 43 行

C
43
字号
/* 
 * $Id: ucos_timer.c,v 1.4 2002/02/07 01:08:53 linfusheng Exp $
 */

#include 	"includes.h"
#include	"ucos_timer.h"

void load_timer2(unsigned int ticks)
{
	/* Set up the timer gate, turn off the speaker */
	UCOS_OUTB((UCOS_INB(PPC_PORTB) & ~PPCB_SPKR) | PPCB_T2GATE, PPC_PORTB);
	UCOS_OUTB(TIMER2_SEL|WORD_ACCESS|MODE0|BINARY_COUNT, TIMER_MODE_PORT);
	UCOS_OUTB(ticks & 0xFF, TIMER2_PORT);
	UCOS_OUTB(ticks >> 8, TIMER2_PORT);
}

int timer2_running(void)
{
	return ((UCOS_INB(PPC_PORTB) & PPCB_T2OUT) == 0);
}

void waiton_timer2(unsigned int ticks)
{
	load_timer2(ticks);
	while ((UCOS_INB(PPC_PORTB) & PPCB_T2OUT) == 0)
		;
}
/* 
 * $Log: ucos_timer.c,v $
 * Revision 1.4  2002/02/07 01:08:53  linfusheng
 * update
 *
 * Revision 1.3  2002/01/28 01:13:52  linfusheng
 * update
 *
 * Revision 1.2  2002/01/28 00:46:25  linfusheng
 * update
 *
 */



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?