/***************************************************************************

	timer.c

	Sucedule CPU and sound timer

***************************************************************************/

#ifndef TIMER_H
#define TIMER_H

#define TIME_NEVER			(1.0e30)
#define TIME_IN_HZ(hz)  	(1.0 / (double)(hz))
#define TIME_IN_USEC(us)	((double)(us) * (1.0 / 1000000.0))

#define CPU_NOTACTIVE	-1
#define CPU_M68000		0
#define CPU_Z80			1
#define MAX_CPU			2

#define SUSPEND_REASON_NOTSUSPEND	3
#define SUSPEND_REASON_DISABLE		1
#define SUSPEND_REASON_HALT			2

void timer_init(void);
void timer_reset(void);
int timer_enable(int which, int enable);
void timer_set(int which, double duration, int param, void (*callback)(int raram));
void timer_adjust(double duration, int param, void (*callback)(int param));
double timer_get_time(void);
double timer_timeelapsed(void);
void timer_suspend_cpu(int cpunum, int state, int reason);
void timer_scedule_cpu(void);

#ifdef SAVE_STATE
void state_save_timer(u8 *state_buf);
void state_load_timer(u8 *state_buf);
#endif

#endif /* TIMER_H */
