1 /* $NetBSD: intr.h,v 1.14 2009/05/07 08:16:50 skrll Exp $ */
4 * Copyright (c) 1998, 2001, 2002 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum, and by Jason R. Thorpe, and by Matthew Fredette.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _HP700_INTR_H_
33 #define _HP700_INTR_H_
35 #include <machine/psl.h>
37 /* Interrupt priority `levels'. */
38 #define IPL_NONE 7 /* nothing */
39 #define IPL_SOFTCLOCK 6 /* timeouts */
40 #define IPL_SOFTBIO 5 /* block I/o */
41 #define IPL_SOFTNET 4 /* protocol stacks */
42 #define IPL_SOFTSERIAL 3 /* serial */
43 #define IPL_VM 2 /* memory allocation, low I/O */
44 #define IPL_SCHED 1 /* clock, medium I/O */
45 #define IPL_HIGH 0 /* everything */
48 /* Interrupt sharing types. */
49 #define IST_NONE 0 /* none */
50 #define IST_PULSE 1 /* pulsed */
51 #define IST_EDGE 2 /* edge-triggered */
52 #define IST_LEVEL 3 /* level-triggered */
56 /* The priority level masks. */
57 extern int imask
[NIPL
];
59 /* The current priority level. */
60 extern volatile int cpl
;
62 /* The asynchronous system trap flag. */
63 extern volatile int astpending
;
65 /* The softnet mask. */
66 extern int softnetmask
;
69 * Add a mask to cpl, and return the old value of cpl.
72 splraise(register int ncpl
)
74 register int ocpl
= cpl
;
82 /* spllower() is in locore.S */
88 #define spl0() spllower(0)
89 #define splx(x) spllower(x)
96 static inline ipl_cookie_t
97 makeiplcookie(ipl_t ipl
)
100 return (ipl_cookie_t
){._ipl
= ipl
};
104 splraiseipl(ipl_cookie_t icookie
)
107 return splraise(imask
[icookie
._ipl
]);
112 #define setsoftast() (astpending = 1)
113 #define setsoftnet() hp700_intr_schedule(softnetmask)
115 void hp700_intr_schedule(int);
117 #endif /* !_LOCORE */
119 #endif /* !_HP700_INTR_H_ */