timer.h
来自「用于嵌入式系统的TCP/IP协议栈及若干服务」· C头文件 代码 · 共 90 行
H
90 行
/** Copyright (c) 1998-2001 by NETsilicon Inc.** This software is copyrighted by and is the sole property of* NETsilicon. All rights, title, ownership, or other interests* in the software remain the property of NETsilicon. This* software may only be used in accordance with the corresponding* license agreement. Any unauthorized use, duplication, transmission,* distribution, or disclosure of this software is expressly forbidden.** This Copyright notice may not be removed or modified without prior* written consent of NETsilicon.** NETsilicon, reserves the right to modify this software* without notice.** NETsilicon* 411 Waverley Oaks Road USA 781.647.1234* Suite 227 http://www.netsilicon.com* Waltham, MA 02452 AmericaSales@netsilicon.com*************************************************************************** $Name: Fusion 6.52 Fusion 6.51 $* $Date: 2001/09/20 10:19:25 $* $Source: M:/psisrc/stack/incl/rcs/timer.h $* $Revision: 1.12 $*************************************************************************** File Description: Definitions and macros for dealing with the kernel* `tcb' structure**************************************************************************/#ifndef _TIMER_#define _TIMER_#include "config.h"#include "ccdep.h"#include "q.h"#include "std.h"/* timer control block (TCB) structure */typedef struct tcb { q tc_q; /* linkage to siblings */ u16 tc_flags; /* see below */ int (*tc_pfi)(void * tc_arg); /* function to call-out */ void * tc_arg; /* argument passed to 'tc_pfi' */ u32 tc_period; /* regular firing interval */ i32 tc_interval; /* next firing interval */ u32 tc_elapsed; /* time passed against 'tc_interval' */} tcb;/* flags for tc.tc_flags */#define F_T_ONESHOT (u16)0x0001 /* pfi to be called once only */#define F_T_ALLOCATED (u16)0x0002 /* this tcb was heap allocated */#define F_T_CRITICAL (u16)0x0004 /* call-out in critical section */#define F_T_STOPPED (u16)0x0008 /* don't call the timeout routine */#define F_T_FIRING (u16)0x0010 /* being done right now */#define F_T_ZAPPED (u16)0x0020 /* needs deletion when done firing *//* Timer Constants default values *//* Used in ncdid.c *//* ARP Timer constants */#define ARP_ENTRY_TTL (u32)15 /* ARP Cache Entry TTL (in minutes)*/#define ARP_ASK_INTERVAL (u32)250 /* ARP ASK timeout interval *//* Router Timer constants */#define ROUTER_ASK_INTERVAL (u32)1000 /* router ASK timeout interval *//* interval at which reference counts will be halved */#define AGING_INTERVAL ((u32)30000)/* declarations (imports from "sock/timer.c") *//* macros */#define t_elapsed(tcbp) ((tcbp)->tc_elapsed)#define t_firing(tcbp) ((boolean)((tcbp)->tc_flags & F_T_FIRING))#define t_flags(tcbp) ((tcbp)->tc_flags)#define t_period(tcbp) ((tcbp)->tc_period)#define t_remaining(tcbp) (t_period(tcbp) - t_elapsed(tcbp))#define t_stopped(tcbp) ((boolean)((tcbp)->tc_flags & F_T_STOPPED))/* visible data structures */import u32 t_clicks; /* # of MS_PER_TICK-clicks since initialization */import u32 t_time; /* # of milliseconds since midnight GMT */#endif /*_TIMER_*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?