icu.h revision 619
14Srgrimes/*-
24Srgrimes * Copyright (c) 1990 The Regents of the University of California.
34Srgrimes * All rights reserved.
44Srgrimes *
54Srgrimes * This code is derived from software contributed to Berkeley by
64Srgrimes * William Jolitz.
74Srgrimes *
84Srgrimes * Redistribution and use in source and binary forms, with or without
94Srgrimes * modification, are permitted provided that the following conditions
104Srgrimes * are met:
114Srgrimes * 1. Redistributions of source code must retain the above copyright
124Srgrimes *    notice, this list of conditions and the following disclaimer.
134Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
144Srgrimes *    notice, this list of conditions and the following disclaimer in the
154Srgrimes *    documentation and/or other materials provided with the distribution.
164Srgrimes * 3. All advertising materials mentioning features or use of this software
174Srgrimes *    must display the following acknowledgement:
184Srgrimes *	This product includes software developed by the University of
194Srgrimes *	California, Berkeley and its contributors.
204Srgrimes * 4. Neither the name of the University nor the names of its contributors
214Srgrimes *    may be used to endorse or promote products derived from this software
224Srgrimes *    without specific prior written permission.
234Srgrimes *
244Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
254Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
264Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
274Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
284Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
294Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
304Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
314Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
324Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
334Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
344Srgrimes * SUCH DAMAGE.
354Srgrimes *
36619Srgrimes *	from: @(#)icu.h	5.6 (Berkeley) 5/9/91
37619Srgrimes *	$Id$
384Srgrimes */
394Srgrimes
404Srgrimes/*
414Srgrimes * AT/386 Interrupt Control constants
424Srgrimes * W. Jolitz 8/89
434Srgrimes */
444Srgrimes
454Srgrimes#ifndef	__ICU__
464Srgrimes#define	__ICU__
474Srgrimes
484Srgrimes#ifndef	LOCORE
494Srgrimes
504Srgrimes/*
514Srgrimes * Interrupt "level" mechanism variables, masks, and macros
524Srgrimes */
534Srgrimesextern	unsigned imen;		/* interrupt mask enable */
544Srgrimesextern	unsigned cpl;		/* current priority level mask */
554Srgrimes
564Srgrimesextern	unsigned highmask;	/* group of interrupts masked with splhigh() */
574Srgrimesextern	unsigned ttymask;	/* group of interrupts masked with spltty() */
584Srgrimesextern	unsigned biomask;	/* group of interrupts masked with splbio() */
594Srgrimesextern	unsigned netmask;	/* group of interrupts masked with splimp() */
604Srgrimes
614Srgrimes#define	INTREN(s)	(imen &= ~(s), SET_ICUS())
624Srgrimes#define	INTRDIS(s)	(imen |= (s), SET_ICUS())
634Srgrimes#define	INTRMASK(msk,s)	(msk |= (s))
644Srgrimes#if 0
654Srgrimes#define SET_ICUS()	(outb(IO_ICU1 + 1, imen), outb(IU_ICU2 + 1, imen >> 8))
664Srgrimes#else
674Srgrimes/*
684Srgrimes * XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to
694Srgrimes * include isa.h, while too many things include icu.h.
704Srgrimes */
714Srgrimes#define SET_ICUS()	(outb(0x21, imen), outb(0xa1, imen >> 8))
724Srgrimes#endif
734Srgrimes
744Srgrimes#endif
754Srgrimes
764Srgrimes/*
774Srgrimes * Interrupt enable bits -- in order of priority
784Srgrimes */
794Srgrimes#define	IRQ0		0x0001		/* highest priority - timer */
804Srgrimes#define	IRQ1		0x0002
814Srgrimes#define	IRQ_SLAVE	0x0004
824Srgrimes#define	IRQ8		0x0100
834Srgrimes#define	IRQ9		0x0200
844Srgrimes#define	IRQ2		IRQ9
854Srgrimes#define	IRQ10		0x0400
864Srgrimes#define	IRQ11		0x0800
874Srgrimes#define	IRQ12		0x1000
884Srgrimes#define	IRQ13		0x2000
894Srgrimes#define	IRQ14		0x4000
904Srgrimes#define	IRQ15		0x8000
914Srgrimes#define	IRQ3		0x0008
924Srgrimes#define	IRQ4		0x0010
934Srgrimes#define	IRQ5		0x0020
944Srgrimes#define	IRQ6		0x0040
954Srgrimes#define	IRQ7		0x0080		/* lowest - parallel printer */
964Srgrimes
974Srgrimes/*
984Srgrimes * Interrupt Control offset into Interrupt descriptor table (IDT)
994Srgrimes */
1004Srgrimes#define	ICU_OFFSET	32		/* 0-31 are processor exceptions */
1014Srgrimes#define	ICU_LEN		16		/* 32-47 are ISA interrupts */
1024Srgrimes
1034Srgrimes#endif	__ICU__
104