/* Copyright 1984 by the Massachusetts Institute of Technology
 *
 * Routines to do the machine dependent timer stuff for the uVAX.
 */

	.globl	_mdt_init
	.globl	_time_int
	.globl	_scb
	.globl	_systick

.set	TIMER_INT,0xc0
.set	ICCS,24				/* Interval clock control */
.set	IPLR,0x12			/* The IPL processor register */
.set	IE,0x40

/* Gets called during system initialization to do any setup that
 * the timer code needs. This basicly means setting the interrupt vector
 * to point to the interrupt handler and enabling the timer itself.
 */
_mdt_init:
	.word	0
	movl	$mdt_int,_scb + TIMER_INT /* set interrupt vector */
	mtpr	$IE,$ICCS		/* set the clock running */
	ret


/* The timer interrupt handler just pushes the registers and calls the C
 * routine which handles the timer functions of the system.  It gets called
 * every 10ms.
 */
.align	2
mdt_int:
	pushr	$0x3fff			/* save registers */
	mtpr	$0x1f,$IPLR		/* disable interrupts */
	calls	$0,_time_int		/* call timer routine */
	popr	$0x3fff			/* restore registers */
	rei
