/*
 * idle.h
 *
 * [Generated from idle, 25 September 1996]
 */

#if !defined(__CC_NORCROFT) || !defined(__arm)
  #error You must use the Norcroft ARM Compiler for Sapphire programs
#endif

#pragma include_only_once
#pragma force_top_level

#ifndef __idle_h
#define __idle_h

#ifndef __sapphire_h
  #include "sapphire.h"
#endif

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  idle_handler
 *  idle_removeHandler
 *  idle_setAlarm
 *  idle_removeAlarm
 *  idle_removeAllAlarms
 *  idle_init
 */

/* --- idle_handler --- *
 *
 * On entry:	R0 == how frequently to call
 *		R1 == pointer to routine to call
 *		R2 == R10 value to call routine with
 *		R3 == R12 value to call routine with
 *
 * On exit:	May return an error
 *
 * Use:		Adds a routine to the idle handler list. Later added
 *		routines are called first. The idle handing routine
 *		may corrupt R10 and R12.
 */

extern routine idle_handler;

/* --- idle_removeHandler --- *
 *
 * On entry:	R0 == How frequently it was called
 *		R1 == pointer to routine called
 *		R2 == R10 value routine is called with
 *		R3 == R12 value routine is called with
 *
 * On exit:	--
 *
 * Use:		Removes a routine from the idle handler list.
 */

extern routine idle_removeHandler;

/* --- idle_setAlarm --- *
 *
 * On entry:	R3 == Time to call
 *		R1 == pointer to routine to call
 *		R2 == R10 value to call routine with
 *		R3 == R12 value to call routine with
 *
 * On exit:	May return an error
 *
 * Use:		Adds a alarm to be called. The idle handing routine
 *		may corrupt R10 and R12.
 */

extern routine idle_setAlarm;

/* --- idle_removeAlarm --- *
 *
 * On entry:	R0 == When it was to be called
 *		R1 == pointer to routine called
 *		R2 == R10 value routine is called with
 *		R3 == R12 value routine is called with
 *
 * On exit:	--
 *
 * Use:		Removes a routine from the idle handler list. It has
 *		no effect if it doesn't exist.
 */

extern routine idle_removeAlarm;

/* --- idle_removeAllAlarms --- *
 *
 * On entry:	R0 == R10 value to look for
 *
 * On exit:	--
 *
 * Use:		Removes all alarms with the handle that was passed to them
 *		to be put into R10.  You should not remove an alarm within
 *		an alarm handler.
 */

extern routine idle_removeAllAlarms;

/* --- idle_init --- *
 *
 * On entry:	--
 *
 * On exit:	--
 *
 * Use:		Initialises the idle system.
 */

extern routine idle_init;

/*----- That's all, folks -------------------------------------------------*/

#endif
