You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

4 years ago
/*****************************************************************************
* uart.h: Header file for NXP LPC17xx Family Microprocessors
*
* Copyright(C) 2017,SensorControl
* All rights reserved.
*
* History
* 2009.05.27 ver 1.00 Prelimnary version, first Release
*2017.01.10 ver 1.10 rename tick.h tick.c
****************************************************************************************/
#include "tick.h"
struct _s_nos_tick_ s_nos_tick;
/*********************************************************************************************************
* Function Name: timer0Isr
* Description: TIMER0
* Input: ?
* Output: ?
* Return: ?
*********************************************************************************************************/
void L1_tick_init(void)
{
s_nos_tick.jiffies = 0;
s_nos_tick.t_1s = 0;
s_nos_tick.t1s_heartbeat= 0;
s_nos_tick.t_50ms = 0;
4 years ago
}
//JIFFIES回绕问题没有解决 参见 linux time_after宏定义
void L1_tick_tick (void)
{
///65535*65535/3600/24/365=139nian/s=1.39nian/10ms
///相当于1.39年后t_10ms 溢出,对于电池供电的系统而言 完全可以满足
// 4,294,836,225 = 65535*65535 ;3600*24*60*60 = 31,536,000秒/年
//s_nos_tick.t_50ms ++;//D_led_D1_REV(); 20160522验证
s_nos_tick.jiffies++;
//s_nos_tick.t_10ms = 1;
if(s_nos_tick.jiffies % HZ == 0) ///HZ = 10ms
4 years ago
{
// 65535*65535/24/60/60/356/10 =12.7年
s_nos_tick.t_1s ++;
s_nos_tick.t1s_heartbeat = 1;
4 years ago
}
}