1 1.4 skrll /* $NetBSD: intr.h,v 1.4 2021/09/24 08:07:40 skrll Exp $ */ 2 1.1 kiyohara 3 1.1 kiyohara /* 4 1.1 kiyohara * Copyright (c) 2001, 2003 Wasabi Systems, Inc. 5 1.1 kiyohara * All rights reserved. 6 1.1 kiyohara * 7 1.1 kiyohara * Written by Jason R. Thorpe for Wasabi Systems, Inc. 8 1.1 kiyohara * 9 1.1 kiyohara * Redistribution and use in source and binary forms, with or without 10 1.1 kiyohara * modification, are permitted provided that the following conditions 11 1.1 kiyohara * are met: 12 1.1 kiyohara * 1. Redistributions of source code must retain the above copyright 13 1.1 kiyohara * notice, this list of conditions and the following disclaimer. 14 1.1 kiyohara * 2. Redistributions in binary form must reproduce the above copyright 15 1.1 kiyohara * notice, this list of conditions and the following disclaimer in the 16 1.1 kiyohara * documentation and/or other materials provided with the distribution. 17 1.1 kiyohara * 3. All advertising materials mentioning features or use of this software 18 1.1 kiyohara * must display the following acknowledgement: 19 1.1 kiyohara * This product includes software developed for the NetBSD Project by 20 1.1 kiyohara * Wasabi Systems, Inc. 21 1.1 kiyohara * 4. The name of Wasabi Systems, Inc. may not be used to endorse 22 1.1 kiyohara * or promote products derived from this software without specific prior 23 1.1 kiyohara * written permission. 24 1.1 kiyohara * 25 1.1 kiyohara * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 26 1.1 kiyohara * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 1.1 kiyohara * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 1.1 kiyohara * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 29 1.1 kiyohara * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 1.1 kiyohara * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 1.1 kiyohara * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 1.1 kiyohara * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 1.1 kiyohara * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 1.1 kiyohara * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 1.1 kiyohara * POSSIBILITY OF SUCH DAMAGE. 36 1.1 kiyohara */ 37 1.1 kiyohara 38 1.1 kiyohara #ifndef _EPOC32_INTR_H_ 39 1.1 kiyohara #define _EPOC32_INTR_H_ 40 1.1 kiyohara 41 1.1 kiyohara #ifdef _KERNEL 42 1.1 kiyohara 43 1.1 kiyohara /* Interrupt priority "levels". */ 44 1.1 kiyohara #define IPL_NONE 0 /* nothing */ 45 1.1 kiyohara #define IPL_SOFTCLOCK 1 /* timeouts */ 46 1.1 kiyohara #define IPL_SOFTBIO 2 /* block I/O */ 47 1.1 kiyohara #define IPL_SOFTNET 3 /* software network interrupt */ 48 1.1 kiyohara #define IPL_SOFTSERIAL 4 /* software serial interrupt */ 49 1.1 kiyohara #define IPL_VM 5 /* memory allocation */ 50 1.1 kiyohara #define IPL_SCHED 6 /* clock interrupt */ 51 1.1 kiyohara #define IPL_HIGH 7 /* everything */ 52 1.1 kiyohara 53 1.1 kiyohara #define NIPL 8 54 1.1 kiyohara 55 1.1 kiyohara /* Interrupt sharing types. */ 56 1.1 kiyohara #define IST_NONE 0 /* none */ 57 1.1 kiyohara #define IST_PULSE 1 /* pulsed */ 58 1.1 kiyohara #define IST_EDGE 2 /* edge-triggered */ 59 1.1 kiyohara #define IST_LEVEL 3 /* level-triggered */ 60 1.1 kiyohara 61 1.1 kiyohara #define __NEWINTR /* enables new hooks in cpu_fork()/cpu_switch() */ 62 1.1 kiyohara 63 1.1 kiyohara #define ARM_IRQ_HANDLER _C_LABEL(epoc32_irq_handler) 64 1.1 kiyohara 65 1.1 kiyohara #ifndef _LOCORE 66 1.1 kiyohara 67 1.1 kiyohara #include <sys/queue.h> 68 1.1 kiyohara 69 1.1 kiyohara #define PIC_MAXSOURCES 16 70 1.1 kiyohara #define PIC_MAXMAXSOURCES 16 71 1.1 kiyohara 72 1.4 skrll #define _splraise pic_splraise 73 1.4 skrll #define _spllower pic_spllower 74 1.4 skrll #define splx pic_splx 75 1.4 skrll 76 1.1 kiyohara #include <arm/pic/picvar.h> 77 1.1 kiyohara 78 1.1 kiyohara typedef uint8_t ipl_t; 79 1.1 kiyohara typedef struct { 80 1.1 kiyohara ipl_t _ipl; 81 1.1 kiyohara } ipl_cookie_t; 82 1.1 kiyohara 83 1.1 kiyohara static inline ipl_cookie_t 84 1.1 kiyohara makeiplcookie(ipl_t ipl) 85 1.1 kiyohara { 86 1.1 kiyohara 87 1.1 kiyohara return (ipl_cookie_t){._ipl = ipl}; 88 1.1 kiyohara } 89 1.1 kiyohara 90 1.1 kiyohara static inline int 91 1.1 kiyohara splraiseipl(ipl_cookie_t icookie) 92 1.1 kiyohara { 93 1.1 kiyohara 94 1.1 kiyohara return _splraise(icookie._ipl); 95 1.1 kiyohara } 96 1.1 kiyohara 97 1.1 kiyohara #define spl0() _spllower(IPL_NONE) 98 1.1 kiyohara 99 1.1 kiyohara #include <sys/spl.h> 100 1.1 kiyohara 101 1.1 kiyohara #endif /* ! _LOCORE */ 102 1.1 kiyohara 103 1.1 kiyohara #endif /* _KERNEL */ 104 1.1 kiyohara 105 1.1 kiyohara #endif /* _EPOC32_INTR_H_ */ 106