icu.h revision 2873
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
372873Sbde *	$Id: icu.h,v 1.4 1994/09/16 13:33:38 davidg Exp $
384Srgrimes */
394Srgrimes
404Srgrimes/*
414Srgrimes * AT/386 Interrupt Control constants
424Srgrimes * W. Jolitz 8/89
434Srgrimes */
444Srgrimes
452873Sbde#ifndef _I386_ISA_ICU_H_
462873Sbde#define	_I386_ISA_ICU_H_
474Srgrimes
484Srgrimes#ifndef	LOCORE
494Srgrimes
504Srgrimes/*
514Srgrimes * Interrupt "level" mechanism variables, masks, and macros
524Srgrimes */
534Srgrimesextern	unsigned imen;		/* interrupt mask enable */
544Srgrimes
552873Sbde#define	INTREN(s)	(imen &= ~(s), SET_ICUS())
562873Sbde#define	INTRDIS(s)	(imen |= (s), SET_ICUS())
574Srgrimes#define	INTRMASK(msk,s)	(msk |= (s))
584Srgrimes#if 0
592873Sbde#define	SET_ICUS()	(outb(IO_ICU1 + 1, imen), outb(IU_ICU2 + 1, imen >> 8))
604Srgrimes#else
614Srgrimes/*
624Srgrimes * XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to
634Srgrimes * include isa.h, while too many things include icu.h.
644Srgrimes */
652873Sbde#define	SET_ICUS()	(outb(0x21, imen), outb(0xa1, imen >> 8))
664Srgrimes#endif
674Srgrimes
684Srgrimes#endif
694Srgrimes
704Srgrimes/*
711321Sdg * Interrupt enable bits - in normal order of priority (which we change)
724Srgrimes */
734Srgrimes#define	IRQ0		0x0001		/* highest priority - timer */
744Srgrimes#define	IRQ1		0x0002
754Srgrimes#define	IRQ_SLAVE	0x0004
764Srgrimes#define	IRQ8		0x0100
774Srgrimes#define	IRQ9		0x0200
784Srgrimes#define	IRQ2		IRQ9
794Srgrimes#define	IRQ10		0x0400
804Srgrimes#define	IRQ11		0x0800
814Srgrimes#define	IRQ12		0x1000
824Srgrimes#define	IRQ13		0x2000
834Srgrimes#define	IRQ14		0x4000
844Srgrimes#define	IRQ15		0x8000
851321Sdg#define	IRQ3		0x0008		/* this is highest after rotation */
864Srgrimes#define	IRQ4		0x0010
874Srgrimes#define	IRQ5		0x0020
884Srgrimes#define	IRQ6		0x0040
894Srgrimes#define	IRQ7		0x0080		/* lowest - parallel printer */
904Srgrimes
914Srgrimes/*
924Srgrimes * Interrupt Control offset into Interrupt descriptor table (IDT)
934Srgrimes */
944Srgrimes#define	ICU_OFFSET	32		/* 0-31 are processor exceptions */
954Srgrimes#define	ICU_LEN		16		/* 32-47 are ISA interrupts */
964Srgrimes
972873Sbde#endif /* !_I386_ISA_ICU_H_ */
98