intr.h revision 1.3
11.3Sthorpej/* $NetBSD: intr.h,v 1.3 1999/08/05 18:08:15 thorpej Exp $ */ 21.1Sminoura 31.1Sminoura/* 41.1Sminoura * 51.1Sminoura * Copyright (c) 1998 NetBSD Foundation, Inc. 61.1Sminoura * All rights reserved. 71.1Sminoura * 81.1Sminoura * This code is derived from software contributed to The NetBSD Foundation 91.1Sminoura * by Minoura Makoto and Jason R. Thorpe. 101.1Sminoura * 111.1Sminoura * Redistribution and use in source and binary forms, with or without 121.1Sminoura * modification, are permitted provided that the following conditions 131.1Sminoura * are met: 141.1Sminoura * 1. Redistributions of source code must retain the above copyright 151.1Sminoura * notice, this list of conditions and the following disclaimer. 161.1Sminoura * 2. Redistributions in binary form must reproduce the above copyright 171.1Sminoura * notice, this list of conditions and the following disclaimer in the 181.1Sminoura * documentation and/or other materials provided with the distribution. 191.1Sminoura * 3. All advertising materials mentioning features or use of this software 201.1Sminoura * must display the following acknowledgement: 211.1Sminoura * This product includes software developed by Charles D. Cranor and 221.1Sminoura * Washington University. 231.1Sminoura * 4. The name of the author may not be used to endorse or promote products 241.1Sminoura * derived from this software without specific prior written permission. 251.1Sminoura * 261.1Sminoura * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 271.1Sminoura * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 281.1Sminoura * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 291.1Sminoura * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 301.1Sminoura * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 311.1Sminoura * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 321.1Sminoura * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 331.1Sminoura * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 341.1Sminoura * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 351.1Sminoura * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 361.1Sminoura */ 371.1Sminoura 381.1Sminoura#ifndef _X68K_INTR_H_ 391.1Sminoura#define _X68K_INTR_H_ 401.1Sminoura 411.1Sminoura#include <machine/psl.h> 421.1Sminoura 431.1Sminoura/* spl0 requires checking for software interrupts */ 441.1Sminouravoid spl0 __P((void)); 451.1Sminoura 461.1Sminoura#define splnone() spl0() 471.3Sthorpej#define spllowersoftclock() spl1() /* disallow softclock */ 481.3Sthorpej#define splsoftclock() splraise1() /* disallow softclock */ 491.3Sthorpej#define splsoftnet() splraise1() /* disallow softnet */ 501.1Sminoura#define splnet() _splraise(PSL_S|PSL_IPL4) /* disallow network */ 511.1Sminoura#define splbio() _splraise(PSL_S|PSL_IPL3) /* disallow block I/O */ 521.1Sminoura#define splimp() _splraise(PSL_S|PSL_IPL4) /* disallow imput */ 531.1Sminoura#define spltty() _splraise(PSL_S|PSL_IPL4) /* disallow tty interrupts */ 541.3Sthorpej#define splzs() splraise5() /* disallow serial interrupts */ 551.3Sthorpej#define splclock() splraise6() /* disallow clock interrupt */ 561.3Sthorpej#define splstatclock() splraise6() /* disallow clock interrupt */ 571.1Sminoura#define splvm() _splraise(PSL_S|PSL_IPL4) /* disallow virtual memory operations */ 581.1Sminoura#define splhigh() spl7() /* disallow everything */ 591.1Sminoura#define splsched() spl7() /* disallow scheduling */ 601.1Sminoura 611.1Sminoura/* watch out for side effects */ 621.1Sminoura#define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0()) 631.1Sminoura 641.1Sminoura/* 651.1Sminoura * simulated software interrupt register 661.1Sminoura */ 671.1Sminouraextern unsigned char ssir; 681.1Sminoura 691.1Sminoura#define SIR_NET 0x1 701.1Sminoura#define SIR_CLOCK 0x2 711.1Sminoura#define SIR_SERIAL 0x4 721.1Sminoura#define SIR_KBD 0x8 731.1Sminoura 741.1Sminoura#define siroff(x) ssir &= ~(x) 751.1Sminoura#define setsoftnet() ssir |= SIR_NET 761.1Sminoura#define setsoftclock() ssir |= SIR_CLOCK 771.1Sminoura#define setsoftserial() ssir |= SIR_SERIAL 781.1Sminoura#define setsoftkbd() ssir |= SIR_KBD 791.1Sminoura 801.1Sminoura#endif 81