intr.h revision 1.8.2.4 1 1.8.2.4 bouyer /* $NetBSD: intr.h,v 1.8.2.4 2001/04/21 17:53:27 bouyer Exp $ */
2 1.8.2.2 bouyer
3 1.8.2.2 bouyer /*
4 1.8.2.2 bouyer * Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
5 1.8.2.2 bouyer *
6 1.8.2.2 bouyer * Redistribution and use in source and binary forms, with or without
7 1.8.2.2 bouyer * modification, are permitted provided that the following conditions
8 1.8.2.2 bouyer * are met:
9 1.8.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
10 1.8.2.2 bouyer * notice, this list of conditions, and the following disclaimer.
11 1.8.2.2 bouyer * 2. Redistributions in binary form must reproduce the above copyright
12 1.8.2.2 bouyer * notice, this list of conditions and the following disclaimer in the
13 1.8.2.2 bouyer * documentation and/or other materials provided with the distribution.
14 1.8.2.2 bouyer *
15 1.8.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 1.8.2.2 bouyer * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 1.8.2.2 bouyer * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 1.8.2.2 bouyer * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 1.8.2.2 bouyer * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 1.8.2.2 bouyer * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 1.8.2.2 bouyer * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 1.8.2.2 bouyer * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 1.8.2.2 bouyer * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 1.8.2.2 bouyer * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 1.8.2.2 bouyer * SUCH DAMAGE.
26 1.8.2.2 bouyer */
27 1.8.2.2 bouyer
28 1.8.2.2 bouyer #define IPL_NONE 0 /* Disable only this interrupt. */
29 1.8.2.2 bouyer #define IPL_BIO 1 /* Disable block I/O interrupts. */
30 1.8.2.2 bouyer #define IPL_NET 2 /* Disable network interrupts. */
31 1.8.2.2 bouyer #define IPL_TTY 3 /* Disable terminal interrupts. */
32 1.8.2.2 bouyer #define IPL_IMP 4 /* Memory allocation */
33 1.8.2.2 bouyer #define IPL_CLOCK 5 /* Disable clock interrupts. */
34 1.8.2.2 bouyer #define IPL_STATCLOCK 6 /* Disable profiling interrupts. */
35 1.8.2.2 bouyer #define IPL_HIGH 7 /* Disable all interrupts. */
36 1.8.2.2 bouyer #define NIPL 8
37 1.8.2.2 bouyer
38 1.8.2.2 bouyer /* Interrupt sharing types. */
39 1.8.2.2 bouyer #define IST_NONE 0 /* none */
40 1.8.2.2 bouyer #define IST_PULSE 1 /* pulsed */
41 1.8.2.2 bouyer #define IST_EDGE 2 /* edge-triggered */
42 1.8.2.2 bouyer #define IST_LEVEL 3 /* level-triggered */
43 1.8.2.2 bouyer
44 1.8.2.2 bouyer /* Soft interrupt masks. */
45 1.8.2.2 bouyer #define SIR_CLOCK 31
46 1.8.2.2 bouyer #define SIR_NET 30
47 1.8.2.2 bouyer #define SIR_CLOCKMASK ((1 << SIR_CLOCK))
48 1.8.2.2 bouyer #define SIR_NETMASK ((1 << SIR_NET) | SIR_CLOCKMASK)
49 1.8.2.2 bouyer #define SIR_ALLMASK (SIR_CLOCKMASK | SIR_NETMASK)
50 1.8.2.2 bouyer
51 1.8.2.2 bouyer #ifdef _KERNEL
52 1.8.2.2 bouyer #ifndef _LOCORE
53 1.8.2.2 bouyer
54 1.8.2.2 bouyer #include <mips/cpuregs.h>
55 1.8.2.2 bouyer
56 1.8.2.2 bouyer extern int _splraise(int);
57 1.8.2.2 bouyer extern int _spllower(int);
58 1.8.2.2 bouyer extern int _splset(int);
59 1.8.2.2 bouyer extern int _splget(void);
60 1.8.2.2 bouyer extern void _splnone(void);
61 1.8.2.2 bouyer extern void _setsoftintr(int);
62 1.8.2.2 bouyer extern void _clrsoftintr(int);
63 1.8.2.2 bouyer
64 1.8.2.2 bouyer #define setsoftclock() _setsoftintr(MIPS_SOFT_INT_MASK_0)
65 1.8.2.2 bouyer #define setsoftnet() _setsoftintr(MIPS_SOFT_INT_MASK_1)
66 1.8.2.2 bouyer #define clearsoftclock() _clrsoftintr(MIPS_SOFT_INT_MASK_0)
67 1.8.2.2 bouyer #define clearsoftnet() _clrsoftintr(MIPS_SOFT_INT_MASK_1)
68 1.8.2.2 bouyer
69 1.8.2.2 bouyer #define splhigh() _splraise(MIPS_INT_MASK)
70 1.8.2.2 bouyer #define spl0() (void)_spllower(0)
71 1.8.2.2 bouyer #define splx(s) (void)_splset(s)
72 1.8.2.2 bouyer #define SPLSOFT MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1
73 1.8.2.2 bouyer #define SPLBIO SPLSOFT | MIPS_INT_MASK_4
74 1.8.2.2 bouyer #define SPLNET SPLBIO | MIPS_INT_MASK_1 | MIPS_INT_MASK_2
75 1.8.2.2 bouyer #define SPLTTY SPLNET | MIPS_INT_MASK_3
76 1.8.2.2 bouyer #define SPLCLOCK SPLTTY | MIPS_INT_MASK_0 | MIPS_INT_MASK_5
77 1.8.2.2 bouyer #define splbio() _splraise(SPLBIO)
78 1.8.2.2 bouyer #define splnet() _splraise(SPLNET)
79 1.8.2.2 bouyer #define spltty() _splraise(SPLTTY)
80 1.8.2.2 bouyer #define splclock() _splraise(SPLCLOCK)
81 1.8.2.3 bouyer #define splvm() splclock()
82 1.8.2.2 bouyer #define splstatclock() splclock()
83 1.8.2.2 bouyer #define splsoftclock() _splraise(MIPS_SOFT_INT_MASK_0)
84 1.8.2.2 bouyer #define splsoftnet() _splraise(MIPS_SOFT_INT_MASK_0|MIPS_SOFT_INT_MASK_1)
85 1.8.2.2 bouyer #define spllowersoftclock() _spllower(MIPS_SOFT_INT_MASK_0)
86 1.8.2.2 bouyer
87 1.8.2.2 bouyer #define splsched() splhigh()
88 1.8.2.2 bouyer #define spllock() splhigh()
89 1.8.2.2 bouyer
90 1.8.2.2 bouyer extern unsigned int intrcnt[];
91 1.8.2.2 bouyer #define SOFTCLOCK_INTR 0
92 1.8.2.2 bouyer #define SOFTNET_INTR 1
93 1.8.2.2 bouyer
94 1.8.2.2 bouyer extern void * cpu_intr_establish(int, int, int (*)(void *), void *);
95 1.8.2.2 bouyer extern void * icu_intr_establish(int, int, int, int (*)(void *), void *);
96 1.8.2.2 bouyer
97 1.8.2.2 bouyer #endif /* !_LOCORE */
98 1.8.2.2 bouyer #endif /* _LOCORE */
99