timer.c

来自「Boot code for ADM5120 with serial consol」· C语言 代码 · 共 59 行

C
59
字号
/*****************************************************************************;;    Project : ADM5120;    Creator : Dan Everett;    File    : timer.c;    Abstract: ;;*****************************************************************************/#include <ctype.h>#include <mips4kc.h>#include <adm5120.h>static UINT32 timeticks = 0;/********************//* InitTimer:		*//********************/void InitTimer(void){	ADM5120_SW_REG(Timer_int_REG) = SW_TIMER_INT_DISABLE;	ADM5120_SW_REG(Timer_REG) = SW_TIMER_10MS_TICKS;	ADM5120_SW_REG(Timer_int_REG) = SW_TIMER_INT_DISABLE | SW_TIMER_INT;	ADM5120_SW_REG(Timer_REG) = SW_TIMER_10MS_TICKS | SW_TIMER_EN;	timeticks = 1;}/********************//* UpTime:			*//********************/UINT32 UpTime(void){	unsigned long status;	status = ADM5120_SW_REG(Timer_int_REG);	if (status & SW_TIMER_INT) {		/* Acknowledge the timer interrupt */		ADM5120_SW_REG(Timer_int_REG) = status;		timeticks++;	}	return timeticks;}void DisableTimer(void){	/* Entire function body was already commented out - DE */	/*buart_print("\n\rTimer irqdisable..");	irqDisconnect(INT_LVL_TIMER);	IrqDisable(INT_LVL_TIMER);*/	/* return 0; */}

⌨️ 快捷键说明

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