icu.h revision 18095
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 3718095Sasami * $Id: icu.h,v 1.7 1994/10/01 02:56:11 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 553258Sdg#define INTREN(s) (imen &= ~(s), SET_ICUS()) 563258Sdg#define INTRDIS(s) (imen |= (s), SET_ICUS()) 573258Sdg#define INTRMASK(msk,s) (msk |= (s)) 583258Sdg#define INTRUNMASK(msk,s) (msk &= ~(s)) 594Srgrimes#if 0 6018095Sasami#ifdef PC98 6118095Sasami#define SET_ICUS() (outb(IO_ICU1 + 2, imen), outb(IU_ICU2 + 2, imen >> 8)) 6218095Sasami#else /* IBM-PC */ 632873Sbde#define SET_ICUS() (outb(IO_ICU1 + 1, imen), outb(IU_ICU2 + 1, imen >> 8)) 6418095Sasami#endif /* PC98 */ 654Srgrimes#else 664Srgrimes/* 674Srgrimes * XXX - IO_ICU* are defined in isa.h, not icu.h, and nothing much bothers to 684Srgrimes * include isa.h, while too many things include icu.h. 694Srgrimes */ 7018095Sasami#ifdef PC98 7118095Sasami#define SET_ICUS() (outb(0x02, imen), outb(0x0a, imen >> 8)) 7218095Sasami#else 732873Sbde#define SET_ICUS() (outb(0x21, imen), outb(0xa1, imen >> 8)) 744Srgrimes#endif 7518095Sasami#endif 764Srgrimes 772874Sbde#endif /* LOCORE */ 784Srgrimes 794Srgrimes/* 801321Sdg * Interrupt enable bits - in normal order of priority (which we change) 814Srgrimes */ 824Srgrimes#define IRQ0 0x0001 /* highest priority - timer */ 834Srgrimes#define IRQ1 0x0002 844Srgrimes#define IRQ_SLAVE 0x0004 854Srgrimes#define IRQ8 0x0100 864Srgrimes#define IRQ9 0x0200 874Srgrimes#define IRQ2 IRQ9 884Srgrimes#define IRQ10 0x0400 894Srgrimes#define IRQ11 0x0800 904Srgrimes#define IRQ12 0x1000 914Srgrimes#define IRQ13 0x2000 924Srgrimes#define IRQ14 0x4000 934Srgrimes#define IRQ15 0x8000 941321Sdg#define IRQ3 0x0008 /* this is highest after rotation */ 954Srgrimes#define IRQ4 0x0010 964Srgrimes#define IRQ5 0x0020 974Srgrimes#define IRQ6 0x0040 984Srgrimes#define IRQ7 0x0080 /* lowest - parallel printer */ 994Srgrimes 10018095Sasami#ifdef PC98 10118095Sasami#undef IRQ2 10218095Sasami#define IRQ2 0x0004 10318095Sasami#undef IRQ_SLAVE 10418095Sasami#define IRQ_SLAVE 0x0080 10518095Sasami#endif 10618095Sasami 1074Srgrimes/* 1084Srgrimes * Interrupt Control offset into Interrupt descriptor table (IDT) 1094Srgrimes */ 1104Srgrimes#define ICU_OFFSET 32 /* 0-31 are processor exceptions */ 1114Srgrimes#define ICU_LEN 16 /* 32-47 are ISA interrupts */ 1124Srgrimes 1132873Sbde#endif /* !_I386_ISA_ICU_H_ */ 114