/*
 *               Copyright (C) 2005, BroadOn Communications Corp.
 *
 *  These coded instructions, statements, and computer programs contain
 *  unpublished  proprietary information of BroadOn Communications Corp.,
 *  and  are protected by Federal copyright law. They may not be disclosed
 *  to  third  parties or copied or duplicated in any form, in whole or in
 *  part, without the prior written consent of BroadOn Communications Corp.
 *
 */

/*---------------------------------------------------------------------------*
 * 
 * Alarm header file
 * 
 *---------------------------------------------------------------------------*/

#ifndef __IOP_ALARM_H__
#define __IOP_ALARM_H__

#include <iostypes.h>
#include "iop_types.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct OSAlarm  OSAlarm;
typedef void          (*OSAlarmHandler)(OSAlarm* alarm, OSContext* context);

#define ALARM_INITIALIZED           1

struct OSAlarm
{
    OSAlarmHandler  handler;
    OSTime          fire;
    OSTime          period;             // Periodic alarm
    OSTime          start;
    IOSTimerId	    timerId;
    int             state;
};

void OSSetAlarm         ( OSAlarm* alarm, OSTime tick, OSAlarmHandler handler );
void OSSetAbsAlarm      ( OSAlarm* alarm, OSTime time, OSAlarmHandler handler );
void OSSetPeriodicAlarm ( OSAlarm* alarm, OSTime start, OSTime period,
                          OSAlarmHandler handler );
void OSCreateAlarm      ( OSAlarm* alarm );
void OSCancelAlarm      ( OSAlarm* alarm );

#ifdef __cplusplus
}
#endif

#endif  // __IOP_ALARM_H__
