timer.c

来自「实现了ucos在s3c2440上的移植」· C语言 代码 · 共 25 行

C
25
字号
//重写  Zhao mingfei 2008.1.16
#include "2440addr.h"
#include "snds.h"
#include "isr.h"
void Timer1_setup()
//This timer is initialized for ucos's timetick
//Pclk will be used in timer and the value of pclk is :Fclk=CPUclk=400000000
//Pclk=50000000,Hclk=100000000,UPLL=UCLK=48000000
//timetick= one stop /5ms => tcnt=250000=>rTCFG0=250 &&rTCFG1=1/8 =>tcnt=125
{
	rTCFG0=0xFA;
	rTCFG1=0x20;
	rTCNTB1=125;
	rTCNTO1=125;
	rTCON|=0xa00;
	pISR_TIMER1=(int)Timer1_inter;  // added timer1 interrupt vector here will be moved to another place ZHAO mingfei 2008.1.16
	rINTMOD&=~0x800;  //IRQ mode
	rINTMSK&=~0X800;  //Eable timer1 interrupt
}
__irq void Timer1_inter()
{
   OSTimeTick();
}

⌨️ 快捷键说明

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