/*
 * $Date: $
 * $Source: $
 * $Revision: $
 * $State: $
 *
 * $Log: $
 */

#ifndef _EMU_TIMERS_H
#define _EMU_TIMERS_H

#include <unistd.h>
#include <sys/time.h>

#include "emu_defs.h"

typedef int   emu_timer_t;
typedef void  (* emu_timer_funct)(void);


extern void        timer_init(void);
extern void        timer_reset(void);
extern void        timer_schedule(struct timeval *curtime);
extern emu_timer_t timer_create(emu_timer_funct func, struct timeval *pop_time,
				u_long usecs_inc);
extern emu_timer_t timer_create_countdown(emu_timer_funct func, u_long usecs);
extern emu_timer_t timer_create_popat(emu_timer_funct func,
				      struct timeval pop_time);
extern Boolean     timer_modify_usecs(emu_timer_t timer, u_long usecs);
extern void        timer_block(void);
extern void        timer_unblock(void);

extern void        timer_stats_enable(void);
extern void        timer_stats_disable(void);
extern void        timer_stats_dump(void);
extern void        timer_stats_reset(void);



extern void set_ticks(Bit32u);
extern void timer_int_engine(void);  /* Experimental TIMER-IRQ CHAIN code */

/* this specifies how many microseconds int 0x2f, ax=0x1680, will usleep().
 * we don't really have a "give up time slice" primitive, but something
 * like this works okay...thanks to Andrew Tridgell.
 * same for int 0x15, ax=0x1000 (TopView/DESQview).
 */
#define INT2F_IDLE_USECS	0
#define INT15_IDLE_USECS	0
#define INT28_IDLE_USECS	0

#endif /* _EMU_TIMERS_H */
