intr.h revision 1.21
11.21Stsutsui/* $NetBSD: intr.h,v 1.21 2008/04/30 08:13:24 tsutsui Exp $ */ 21.1Stsutsui 31.21Stsutsui/*- 41.21Stsutsui * Copyright (c) 1998 The NetBSD Foundation, Inc. 51.1Stsutsui * All rights reserved. 61.1Stsutsui * 71.1Stsutsui * This code is derived from software contributed to The NetBSD Foundation 81.1Stsutsui * by Minoura Makoto and Jason R. Thorpe. 91.1Stsutsui * 101.1Stsutsui * Redistribution and use in source and binary forms, with or without 111.1Stsutsui * modification, are permitted provided that the following conditions 121.1Stsutsui * are met: 131.1Stsutsui * 1. Redistributions of source code must retain the above copyright 141.1Stsutsui * notice, this list of conditions and the following disclaimer. 151.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright 161.1Stsutsui * notice, this list of conditions and the following disclaimer in the 171.1Stsutsui * documentation and/or other materials provided with the distribution. 181.1Stsutsui * 191.21Stsutsui * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 201.21Stsutsui * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 211.21Stsutsui * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 221.21Stsutsui * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 231.21Stsutsui * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 241.21Stsutsui * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 251.21Stsutsui * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 261.21Stsutsui * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 271.21Stsutsui * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 281.21Stsutsui * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 291.21Stsutsui * POSSIBILITY OF SUCH DAMAGE. 301.1Stsutsui */ 311.1Stsutsui 321.1Stsutsui#ifndef _NEWS68K_INTR_H_ 331.1Stsutsui#define _NEWS68K_INTR_H_ 341.1Stsutsui 351.14Stsutsui#include <sys/device.h> 361.14Stsutsui#include <sys/queue.h> 371.1Stsutsui#include <machine/psl.h> 381.5Stsutsui#include <m68k/asm_single.h> 391.1Stsutsui 401.13Syamt#define IPL_NONE 0 411.14Stsutsui#define IPL_SOFTCLOCK 1 421.19Sad#define IPL_SOFTBIO 2 431.19Sad#define IPL_SOFTNET 3 441.19Sad#define IPL_SOFTSERIAL 4 451.19Sad#define IPL_VM 5 461.19Sad#define IPL_SCHED 6 471.19Sad#define IPL_HIGH 6 481.19Sad#define NIPL 7 491.13Syamt 501.20Stsutsuiextern int idepth; 511.20Stsutsui 521.13Syamttypedef int ipl_t; 531.13Syamttypedef struct { 541.18Sthorpej uint16_t _psl; 551.13Syamt} ipl_cookie_t; 561.13Syamt 571.14Stsutsuiipl_cookie_t makeiplcookie(ipl_t); 581.13Syamt 591.13Syamtstatic inline int 601.13Syamtsplraiseipl(ipl_cookie_t icookie) 611.13Syamt{ 621.13Syamt 631.14Stsutsui return _splraise(icookie._psl); 641.13Syamt} 651.13Syamt 661.12Sperrystatic __inline void 671.9Stsutsuisplx(int sr) 681.9Stsutsui{ 691.9Stsutsui 701.11Sperry __asm volatile("movw %0,%%sr" : : "di" (sr)); 711.9Stsutsui} 721.1Stsutsui 731.1Stsutsui/* 741.14Stsutsui * news68k can handle software interrupts by its own hardware 751.14Stsutsui * so has no need to check for any simulated interrupts, etc. 761.14Stsutsui */ 771.14Stsutsui#define spl0() _spl0() 781.14Stsutsui 791.19Sad#define splsoftbio() splraise2() 801.19Sad#define splsoftclock() splraise2() 811.19Sad#define splsoftnet() splraise2() 821.19Sad#define splsoftserial() splraise2() 831.14Stsutsui#define splvm() splraise5() 841.14Stsutsui#define splhigh() spl7() 851.14Stsutsui#define splsched() spl7() 861.1Stsutsui 871.1Stsutsui#endif /* _NEWS68K_INTR_H_ */ 88