1 /* $NetBSD: intr.h,v 1.11 2007/03/09 06:45:19 thorpej Exp $ */
3 * Copyright (c) 1998, 2000 Ben Harris
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * intr.h - Interrupt stuff for the consumption of MI code.
31 * arm26-specific functions are in irq.h
34 #ifndef _ARM26_INTR_H_
35 #define _ARM26_INTR_H_
38 * These are the different SPL states
40 * Each state has an interrupt mask associated with it which
41 * indicate which interrupts are allowed.
45 #define IPL_SOFTCLOCK 1
47 #define IPL_SOFTBIO IPL_SOFTNET
48 #define IPL_SOFTSERIAL IPL_SOFTNET
52 #define NIPL IPL_HIGH + 1
54 #if defined(_KERNEL) && !defined(_LOCORE)
56 #define splsoftnet() raisespl(IPL_SOFTNET)
57 #define splsoftbio() splsoftnet()
58 #define splsoftserial() splsoftnet()
59 #define splsoftclock() raisespl(IPL_SOFTCLOCK)
60 #define splvm() raisespl(IPL_VM)
61 #define splsched() splhigh()
63 #define spl0() lowerspl(IPL_NONE)
64 #define splx(s) lowerspl(s)
66 extern int splhigh(void);
67 extern int raisespl(int);
68 extern void lowerspl(int);
69 extern int hardsplx(int);
71 typedef uint8_t ipl_t
;
76 static inline ipl_cookie_t
77 makeiplcookie(ipl_t ipl
)
80 return (ipl_cookie_t
){._ipl
= ipl
};
84 splraiseipl(ipl_cookie_t icookie
)
86 ipl_t newipl
= icookie
._ipl
;
88 return ((newipl
) == IPL_HIGH
) ? splhigh() : raisespl(newipl
);
92 * Interrupt sharing types
93 * (not currently used on arm26)
96 #define IST_UNUSABLE -1 /* interrupt cannot be used */
97 #define IST_NONE 0 /* none (dummy) */
98 #define IST_PULSE 1 /* pulsed */
99 #define IST_EDGE 2 /* edge-triggered */
100 #define IST_LEVEL 3 /* level-triggered */
102 #endif /* _KERNEL && !ASSEMBLER */