intr.h revision 1.6.2.3 1 1.6.2.3 bouyer /* $NetBSD: intr.h,v 1.6.2.3 2001/01/18 09:22:12 bouyer Exp $ */
2 1.6.2.2 bouyer
3 1.6.2.2 bouyer /*
4 1.6.2.2 bouyer * Copyright (c) 1998 Jonathan Stone. All rights reserved.
5 1.6.2.2 bouyer *
6 1.6.2.2 bouyer * Redistribution and use in source and binary forms, with or without
7 1.6.2.2 bouyer * modification, are permitted provided that the following conditions
8 1.6.2.2 bouyer * are met:
9 1.6.2.2 bouyer * 1. Redistributions of source code must retain the above copyright
10 1.6.2.2 bouyer * notice, this list of conditions and the following disclaimer.
11 1.6.2.2 bouyer * 2. Redistributions in binary form must reproduce the above copyright
12 1.6.2.2 bouyer * notice, this list of conditions and the following disclaimer in the
13 1.6.2.2 bouyer * documentation and/or other materials provided with the distribution.
14 1.6.2.2 bouyer * 3. All advertising materials mentioning features or use of this software
15 1.6.2.2 bouyer * must display the following acknowledgement:
16 1.6.2.2 bouyer * This product includes software developed by Jonathan Stone for
17 1.6.2.2 bouyer * the NetBSD Project.
18 1.6.2.2 bouyer * 4. The name of the author may not be used to endorse or promote products
19 1.6.2.2 bouyer * derived from this software without specific prior written permission.
20 1.6.2.2 bouyer *
21 1.6.2.2 bouyer * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 1.6.2.2 bouyer * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 1.6.2.2 bouyer * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 1.6.2.2 bouyer * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 1.6.2.2 bouyer * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 1.6.2.2 bouyer * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 1.6.2.2 bouyer * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 1.6.2.2 bouyer * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 1.6.2.2 bouyer * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 1.6.2.2 bouyer * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 1.6.2.2 bouyer */
32 1.6.2.2 bouyer
33 1.6.2.2 bouyer #ifndef _ARC_INTR_H_
34 1.6.2.2 bouyer #define _ARC_INTR_H_
35 1.6.2.2 bouyer
36 1.6.2.2 bouyer #define IPL_NONE 0 /* disable only this interrupt */
37 1.6.2.2 bouyer #define IPL_BIO 1 /* disable block I/O interrupts */
38 1.6.2.2 bouyer #define IPL_NET 2 /* disable network interrupts */
39 1.6.2.2 bouyer #define IPL_TTY 3 /* disable terminal interrupts */
40 1.6.2.2 bouyer #define IPL_IMP 4 /* memory allocation */
41 1.6.2.2 bouyer #define IPL_CLOCK 5 /* disable clock interrupts */
42 1.6.2.2 bouyer #define IPL_STATCLOCK 6 /* disable profiling interrupts */
43 1.6.2.2 bouyer #if 0 /* XXX */
44 1.6.2.2 bouyer #define IPL_SERIAL 7 /* disable serial hardware interrupts */
45 1.6.2.2 bouyer #endif
46 1.6.2.2 bouyer #define IPL_HIGH 8 /* disable all interrupts */
47 1.6.2.2 bouyer #define NIPL 9
48 1.6.2.2 bouyer
49 1.6.2.2 bouyer /* Interrupt sharing types. */
50 1.6.2.2 bouyer #define IST_NONE 0 /* none */
51 1.6.2.2 bouyer #define IST_PULSE 1 /* pulsed */
52 1.6.2.2 bouyer #define IST_EDGE 2 /* edge-triggered */
53 1.6.2.2 bouyer #define IST_LEVEL 3 /* level-triggered */
54 1.6.2.2 bouyer
55 1.6.2.2 bouyer /* Soft interrupt masks. */
56 1.6.2.2 bouyer /* XXX - revisit here */
57 1.6.2.2 bouyer #define SIR_CLOCK 31
58 1.6.2.2 bouyer #define SIR_NET 30
59 1.6.2.2 bouyer #define SIR_CLOCKMASK ((1 << SIR_CLOCK))
60 1.6.2.2 bouyer #define SIR_NETMASK ((1 << SIR_NET) | SIR_CLOCKMASK)
61 1.6.2.2 bouyer #define SIR_ALLMASK (SIR_CLOCKMASK | SIR_NETMASK)
62 1.6.2.2 bouyer
63 1.6.2.2 bouyer #ifdef _KERNEL
64 1.6.2.2 bouyer #ifndef _LOCORE
65 1.6.2.2 bouyer
66 1.6.2.2 bouyer #include <mips/cpuregs.h>
67 1.6.2.2 bouyer
68 1.6.2.2 bouyer extern int _splraise __P((int));
69 1.6.2.2 bouyer extern int _spllower __P((int));
70 1.6.2.2 bouyer extern int _splset __P((int));
71 1.6.2.2 bouyer extern int _splget __P((void));
72 1.6.2.2 bouyer extern void _splnone __P((void));
73 1.6.2.2 bouyer extern void _setsoftintr __P((int));
74 1.6.2.2 bouyer extern void _clrsoftintr __P((int));
75 1.6.2.2 bouyer
76 1.6.2.2 bouyer #define setsoftclock() _setsoftintr(MIPS_SOFT_INT_MASK_0)
77 1.6.2.2 bouyer #define setsoftnet() _setsoftintr(MIPS_SOFT_INT_MASK_1)
78 1.6.2.2 bouyer #define clearsoftclock() _clrsoftintr(MIPS_SOFT_INT_MASK_0)
79 1.6.2.2 bouyer #define clearsoftnet() _clrsoftintr(MIPS_SOFT_INT_MASK_1)
80 1.6.2.2 bouyer
81 1.6.2.2 bouyer /*
82 1.6.2.2 bouyer * nesting interrupt masks.
83 1.6.2.2 bouyer */
84 1.6.2.2 bouyer #define MIPS_INT_MASK_SPL_SOFT0 MIPS_SOFT_INT_MASK_0
85 1.6.2.2 bouyer #define MIPS_INT_MASK_SPL_SOFT1 (MIPS_SOFT_INT_MASK_1|MIPS_INT_MASK_SPL_SOFT0)
86 1.6.2.2 bouyer #define MIPS_INT_MASK_SPL0 (MIPS_INT_MASK_0|MIPS_INT_MASK_SPL_SOFT1)
87 1.6.2.2 bouyer #define MIPS_INT_MASK_SPL1 (MIPS_INT_MASK_1|MIPS_INT_MASK_SPL0)
88 1.6.2.2 bouyer #define MIPS_INT_MASK_SPL2 (MIPS_INT_MASK_2|MIPS_INT_MASK_SPL1)
89 1.6.2.2 bouyer #define MIPS_INT_MASK_SPL3 (MIPS_INT_MASK_3|MIPS_INT_MASK_SPL2)
90 1.6.2.2 bouyer #define MIPS_INT_MASK_SPL4 (MIPS_INT_MASK_4|MIPS_INT_MASK_SPL3)
91 1.6.2.2 bouyer #define MIPS_INT_MASK_SPL5 (MIPS_INT_MASK_5|MIPS_INT_MASK_SPL4)
92 1.6.2.2 bouyer #define MIPS_INT_MASK_SPLHIGH MIPS_INT_MASK_SPL5
93 1.6.2.2 bouyer
94 1.6.2.2 bouyer #define spl0() (void)_spllower(0)
95 1.6.2.2 bouyer #define splx(s) (void)_splset(s)
96 1.6.2.2 bouyer #define splbio() (_splraise(splvec.splbio))
97 1.6.2.2 bouyer #define splnet() (_splraise(splvec.splnet))
98 1.6.2.2 bouyer #define spltty() (_splraise(splvec.spltty))
99 1.6.2.2 bouyer #define splimp() (_splraise(splvec.splimp))
100 1.6.2.3 bouyer #define splvm() (_splraise(splvec.splimp))
101 1.6.2.2 bouyer #define splclock() (_splraise(splvec.splclock))
102 1.6.2.2 bouyer #define splstatclock() (_splraise(splvec.splstatclock))
103 1.6.2.2 bouyer #define splhigh() _splraise(MIPS_INT_MASK_SPLHIGH)
104 1.6.2.2 bouyer
105 1.6.2.2 bouyer #define splsoftclock() _splraise(MIPS_INT_MASK_SPL_SOFT0)
106 1.6.2.2 bouyer #define splsoftnet() _splraise(MIPS_INT_MASK_SPL_SOFT1)
107 1.6.2.2 bouyer #define spllowersoftclock() _spllower(MIPS_INT_MASK_SPL_SOFT0)
108 1.6.2.2 bouyer
109 1.6.2.2 bouyer #define splsched() splhigh()
110 1.6.2.2 bouyer #define spllock() splhigh()
111 1.6.2.2 bouyer #define spllpt() spltty() /* lpt driver */
112 1.6.2.2 bouyer
113 1.6.2.2 bouyer struct splvec {
114 1.6.2.2 bouyer int splbio;
115 1.6.2.2 bouyer int splnet;
116 1.6.2.2 bouyer int spltty;
117 1.6.2.2 bouyer int splimp;
118 1.6.2.2 bouyer int splclock;
119 1.6.2.2 bouyer int splstatclock;
120 1.6.2.2 bouyer };
121 1.6.2.2 bouyer extern struct splvec splvec;
122 1.6.2.2 bouyer
123 1.6.2.2 bouyer /*
124 1.6.2.2 bouyer * Index into intrcnt[], which is defined in locore
125 1.6.2.2 bouyer */
126 1.6.2.2 bouyer #define SOFTCLOCK_INTR 0
127 1.6.2.2 bouyer #define SOFTNET_INTR 1
128 1.6.2.2 bouyer #define FPU_INTR 2
129 1.6.2.2 bouyer extern u_long intrcnt[];
130 1.6.2.2 bouyer
131 1.6.2.2 bouyer struct clockframe;
132 1.6.2.2 bouyer void set_intr __P((int, int(*)(u_int, struct clockframe *), int));
133 1.6.2.2 bouyer
134 1.6.2.2 bouyer /* XXX - revisit here */
135 1.6.2.2 bouyer int imask[NIPL];
136 1.6.2.2 bouyer
137 1.6.2.2 bouyer #endif /* !_LOCORE */
138 1.6.2.2 bouyer #endif /* _KERNEL */
139 1.6.2.2 bouyer
140 1.6.2.2 bouyer #endif /* _ARC_INTR_H_ */
141