1 /* $NetBSD: ibm4xx_intr.h,v 1.15 2007/12/03 15:34:13 ad Exp $ */
4 * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum.
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 _IBM4XX_INTR_H_
33 #define _IBM4XX_INTR_H_
35 /* Interrupt priority `levels'. */
36 #define IPL_NONE 12 /* nothing */
37 #define IPL_SOFTCLOCK 11 /* software clock interrupt */
38 #define IPL_SOFTNET 10 /* software network interrupt */
39 #define IPL_VM 5 /* memory allocation */
40 #define IPL_SCHED 3 /* clock */
41 #define IPL_HIGH 1 /* everything */
44 #define IPL_SOFTBIO IPL_SOFTNET
45 #define IPL_SOFTSERIAL IPL_SOFTNET
47 /* Interrupt sharing types. */
48 #define IST_NONE 0 /* none */
49 #define IST_PULSE 1 /* pulsed */
50 #define IST_EDGE 2 /* edge-triggered */
51 #define IST_LEVEL 3 /* level-triggered */
55 #define CLKF_BASEPRI(frame) ((frame)->pri == 0)
57 void *intr_establish(int, int, int, int (*)(void *), void *);
58 void intr_disestablish(void *);
60 void ext_intr(void); /* for machdep */
66 extern volatile u_int imask
[NIPL
];
67 extern const int mask_clock
; /* for clock.c */
68 extern const int mask_statclock
; /* for clock.c */
70 #define spllowersoftclock() spllower(imask[IPL_SOFTCLOCK])
77 static inline ipl_cookie_t
78 makeiplcookie(ipl_t ipl
)
81 return (ipl_cookie_t
){._ipl
= ipl
};
85 splraiseipl(ipl_cookie_t icookie
)
88 return splraise(imask
[icookie
._ipl
]);
93 #define spl0() spllower(0)
96 #endif /* !_IBM4XX_INTR_H_ */