11.10Sryo/* $NetBSD: intr.h,v 1.10 2021/11/02 11:26:03 ryo Exp $ */ 21.3Such 31.3Such/*- 41.3Such * Copyright (c) 2002 The NetBSD Foundation, Inc. 51.3Such * All rights reserved. 61.3Such * 71.3Such * Redistribution and use in source and binary forms, with or without 81.3Such * modification, are permitted provided that the following conditions 91.3Such * are met: 101.3Such * 1. Redistributions of source code must retain the above copyright 111.3Such * notice, this list of conditions and the following disclaimer. 121.3Such * 2. Redistributions in binary form must reproduce the above copyright 131.3Such * notice, this list of conditions and the following disclaimer in the 141.3Such * documentation and/or other materials provided with the distribution. 151.3Such * 161.3Such * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 171.3Such * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 181.3Such * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 191.3Such * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 201.3Such * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 211.3Such * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 221.3Such * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 231.3Such * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 241.3Such * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 251.3Such * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 261.3Such * POSSIBILITY OF SUCH DAMAGE. 271.3Such */ 281.3Such 291.1Smarcus#ifndef _DREAMCAST_INTR_H_ 301.1Smarcus#define _DREAMCAST_INTR_H_ 311.1Smarcus 321.3Such#include <sh3/intr.h> 331.1Smarcus 341.3Such/* Number of interrupt source */ 351.4Sitohy#define _INTR_N 10 /* TMU0, TMU1, TMU2, SCIF * 4, IRL * 3 */ 361.3Such 371.3Such/* Interrupt priority levels */ 381.8Sad#define IPL_VM 12 391.8Sad#define IPL_SCHED 14 401.8Sad#define IPL_HIGH 15 411.3Such 421.6Sadtypedef uint8_t ipl_t; 431.5Syamttypedef struct { 441.5Syamt ipl_t _ipl; 451.5Syamt} ipl_cookie_t; 461.5Syamt 471.10Sryostatic inline __always_inline ipl_cookie_t 481.5Syamtmakeiplcookie(ipl_t ipl) 491.5Syamt{ 501.5Syamt 511.5Syamt return (ipl_cookie_t){._ipl = ipl << 4}; 521.5Syamt} 531.5Syamt 541.10Sryostatic inline __always_inline int 551.5Syamtsplraiseipl(ipl_cookie_t icookie) 561.5Syamt{ 571.5Syamt 581.5Syamt return _cpu_intr_raise(icookie._ipl); 591.5Syamt} 601.5Syamt 611.5Syamt#include <sys/spl.h> 621.1Smarcus 631.3Such#define spl0() _cpu_intr_resume(0) 641.3Such#define splx(x) _cpu_intr_resume(x) 651.1Smarcus 661.3Such#endif /* !_DREAMCAST_INTR_H_ */ 67