105 lines
3.0 KiB
C
105 lines
3.0 KiB
C
/****************************************************************************
|
|
|
|
|
| (C) Copyright 1985, 1991, 1993, 1996 Novell, Inc.
|
|
| All Rights Reserved.
|
|
|
|
|
| This program is free software; you can redistribute it and/or
|
|
| modify it under the terms of version 2 of the GNU General Public
|
|
| License as published by the Free Software Foundation.
|
|
|
|
|
| This program is distributed in the hope that it will be useful,
|
|
| but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| GNU General Public License for more details.
|
|
|
|
|
| You should have received a copy of the GNU General Public License
|
|
| along with this program; if not, contact Novell, Inc.
|
|
|
|
|
| To contact Novell about this file by physical or electronic mail,
|
|
| you may find current contact information at www.novell.com
|
|
|
|
|
|***************************************************************************
|
|
|
|
|
| NetWare Advance File Services (NSS) Initialization module
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
|
|
|
| $Author: taysom $
|
|
| $Date: 2006-11-07 04:09:36 +0530 (Tue, 07 Nov 2006) $
|
|
|
|
|
| $RCSfile$
|
|
| $Revision: 1617 $
|
|
|
|
|
|---------------------------------------------------------------------------
|
|
| This module is used to:
|
|
| Define strutures needed by alarms.
|
|
|
|
|
| WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING!
|
|
|
|
|
| This header file should ONLY be used for NSS internal development.
|
|
| This includes Semantic Agents (SA) and Loadable Storage Services (LSS).
|
|
| Any other use may cause conflicts which NSS will NOT fix.
|
|
+-------------------------------------------------------------------------*/
|
|
#ifndef _ALARM_H_
|
|
#define _ALARM_H_
|
|
|
|
#ifndef _QUE_H_
|
|
# include <library/que.h>
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
typedef struct OneShot_s OneShot_s;
|
|
typedef struct Cyclic_s Cyclic_s;
|
|
|
|
struct OneShot_s
|
|
{
|
|
DQlink_t link;
|
|
NINT firetime;
|
|
void (*function)(OneShot_s *);
|
|
};
|
|
|
|
struct Cyclic_s
|
|
{
|
|
OneShot_s oneShot;
|
|
NINT length;
|
|
void (*function)(Cyclic_s *);
|
|
};
|
|
|
|
extern void fireAlarm(void);
|
|
extern void alarmInit(void);
|
|
extern void alarmStart(void);
|
|
extern void alarmStop(void);
|
|
extern void setOneShot(OneShot_s *alarm, LONG ticks, void (*function)());
|
|
extern void setCyclic(Cyclic_s *alarm, LONG ticks, void (*function)());
|
|
|
|
#define MSEC2TICK(_x) (((_x) * 182) / 10000)
|
|
#define SEC2TICK(_x) (((_x) * 182) / 10)
|
|
#define MIN2TICK(_x) ((_x) * (182 * 6))
|
|
#define MILLISEC_PER_TICK 55
|
|
|
|
#define msecOneShot(_a, _t, _f) setOneShot((_a), MSEC2TICK(_t), (_f))
|
|
#define msecCyclic(_a, _t, _f) setCyclic((_a), MSEC2TICK(_t), (_f))
|
|
#define secOneShot(_a, _t, _f) setOneShot((_a), SEC2TICK(_t), (_f))
|
|
#define secCyclic(_a, _t, _f) setCyclic((_a), SEC2TICK(_t), (_f))
|
|
|
|
#define INIT_ONESHOT(_s) (NULLIFY( &(_s).link))
|
|
#define ONESHOT_SET(_s) (QMEMBER( &(_s).link))
|
|
#define CANCEL_ALARM(_s) \
|
|
{ \
|
|
if (QMEMBER( &(_s).link)) \
|
|
{ \
|
|
DQ_RMV( &(_s), link); \
|
|
} \
|
|
}
|
|
|
|
extern NINT Ticks;
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|