intr.h revision 1.17
11.17Sad/* $NetBSD: intr.h,v 1.17 2007/12/03 15:34:25 ad Exp $ */ 21.1Sminoura 31.5Sminoura/*- 41.5Sminoura * Copyright (c) 1998 The NetBSD Foundation, Inc. 51.1Sminoura * All rights reserved. 61.1Sminoura * 71.1Sminoura * This code is derived from software contributed to The NetBSD Foundation 81.1Sminoura * by Minoura Makoto and Jason R. Thorpe. 91.1Sminoura * 101.1Sminoura * Redistribution and use in source and binary forms, with or without 111.1Sminoura * modification, are permitted provided that the following conditions 121.1Sminoura * are met: 131.1Sminoura * 1. Redistributions of source code must retain the above copyright 141.1Sminoura * notice, this list of conditions and the following disclaimer. 151.1Sminoura * 2. Redistributions in binary form must reproduce the above copyright 161.1Sminoura * notice, this list of conditions and the following disclaimer in the 171.1Sminoura * documentation and/or other materials provided with the distribution. 181.1Sminoura * 3. All advertising materials mentioning features or use of this software 191.1Sminoura * must display the following acknowledgement: 201.5Sminoura * This product includes software developed by the NetBSD 211.5Sminoura * Foundation, Inc. and its contributors. 221.5Sminoura * 4. Neither the name of The NetBSD Foundation nor the names of its 231.5Sminoura * contributors may be used to endorse or promote products derived 241.5Sminoura * from this software without specific prior written permission. 251.1Sminoura * 261.5Sminoura * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 271.5Sminoura * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 281.5Sminoura * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 291.5Sminoura * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 301.5Sminoura * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 311.5Sminoura * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 321.5Sminoura * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 331.5Sminoura * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 341.5Sminoura * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 351.5Sminoura * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 361.5Sminoura * POSSIBILITY OF SUCH DAMAGE. 371.1Sminoura */ 381.1Sminoura 391.1Sminoura#ifndef _X68K_INTR_H_ 401.1Sminoura#define _X68K_INTR_H_ 411.1Sminoura 421.1Sminoura#include <machine/psl.h> 431.1Sminoura 441.1Sminoura/* spl0 requires checking for software interrupts */ 451.9Schsvoid spl0(void); 461.1Sminoura 471.17Sad#define splsoftbio() splraise1() 481.17Sad#define splsoftclock() splraise1() 491.17Sad#define splsoftnet() splraise1() 501.17Sad#define splsoftserial() splraise1() 511.13Stsutsui#define splvm() splraise4() 521.17Sad#define splsched() spl7() 531.13Stsutsui#define splhigh() spl7() 541.13Stsutsui 551.10Syamt#define splnone() spl0() 561.10Syamt#define splzs() splraise5() /* disallow serial interrupts */ 571.1Sminoura 581.1Sminoura/* watch out for side effects */ 591.1Sminoura#define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0()) 601.1Sminoura 611.10Syamt#define IPL_NONE 0 621.13Stsutsui#define IPL_SOFTCLOCK 1 631.17Sad#define IPL_SOFTBIO 2 641.17Sad#define IPL_SOFTNET 3 651.17Sad#define IPL_SOFTSERIAL 4 661.17Sad#define IPL_VM 5 671.17Sad#define IPL_SCHED 5 681.17Sad#define IPL_HIGH 6 691.17Sad#define NIPL 7 701.10Syamt 711.11Syamttypedef int ipl_t; 721.11Syamttypedef struct { 731.15Sthorpej uint16_t _psl; 741.11Syamt} ipl_cookie_t; 751.11Syamt 761.13Stsutsuiipl_cookie_t makeiplcookie(ipl_t); 771.11Syamt 781.11Syamtstatic inline int 791.11Syamtsplraiseipl(ipl_cookie_t icookie) 801.11Syamt{ 811.11Syamt 821.13Stsutsui return _splraise(icookie._psl); 831.11Syamt} 841.10Syamt 851.13Stsutsui#endif /* !_X68K_INTR_H_ */ 86