/*
 * $Header: /smsa/bsd:include/arm/microtime.h:bsd  1.4  $
 * $Source: /smsa/bsd:include/arm/microtime.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 *
 */

#ifndef	__arm_microtime_h
#define	__arm_microtime_h
#define	__machine_microtime_h	"arm"

/*
 * Macro to give current clock counter reading, as -(microseconds left
 * BEFORE next clock tick) (NB NOT usec since last tick).  This is what
 * mfpr(ICR) on the VAX gives.
 */
#define MICROTIME() (IOC->timer_0.latch_cmd = 0, \
		     -((IOC->timer_0.count_hi << 8 \
			| IOC->timer_0.count_lo   ) >> 1))

/*
 * Macro to decide if clock has wrapped but the interrupt has not yet
 * been serviced (because CPU is at >= PRIO_CLOCK).  This is equivalent
 * to the VAX code ((mfpr(ICCS) & ICCS_INT) != 0)
 */
#define CLOCKINTPENDING() ((IOC->irq_A.status & IRQA_TM0) != 0)

#endif/*__arm_microtime_h*/

/* EOF microtime.h */
