Annotation of sys/arch/landisk/include/intr.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: intr.h,v 1.6 2007/05/16 19:38:21 thib Exp $ */
2: /* $NetBSD: intr.h,v 1.1 2006/09/01 21:26:18 uwe Exp $ */
3:
4: /*-
5: * Copyright (c) 2002 The NetBSD Foundation, Inc.
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. All advertising materials mentioning features or use of this software
17: * must display the following acknowledgement:
18: * This product includes software developed by the NetBSD
19: * Foundation, Inc. and its contributors.
20: * 4. Neither the name of The NetBSD Foundation nor the names of its
21: * contributors may be used to endorse or promote products derived
22: * from this software without specific prior written permission.
23: *
24: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
25: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
28: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34: * POSSIBILITY OF SUCH DAMAGE.
35: */
36:
37: #ifndef _LANDISK_INTR_H_
38: #define _LANDISK_INTR_H_
39:
40: #include <sh/intr.h>
41:
42: /* Number of interrupt source */
43: #define _INTR_N 16
44:
45: /* Interrupt priority levels */
46: #define IPL_BIO 10 /* block I/O */
47: #define IPL_NET 11 /* network */
48: #define IPL_TTY 12 /* terminal */
49: #define IPL_AUDIO 13 /* serial */
50: #define IPL_CLOCK 14 /* clock */
51: #define IPL_SCHED 14 /* scheduling */
52: #define IPL_HIGH 15 /* everything */
53:
54: #define splsoftclock() _cpu_intr_raise(IPL_SOFTCLOCK << 4)
55: #define splsoftnet() _cpu_intr_raise(IPL_SOFTNET << 4)
56: #define splsoftserial() _cpu_intr_raise(IPL_SOFTSERIAL << 4)
57: #define splbio() _cpu_intr_raise(IPL_BIO << 4)
58: #define splnet() _cpu_intr_raise(IPL_NET << 4)
59: #define spltty() _cpu_intr_raise(IPL_TTY << 4)
60: #define splvm() spltty()
61: #define splaudio() _cpu_intr_raise(IPL_AUDIO << 4)
62: #define splclock() _cpu_intr_raise(IPL_CLOCK << 4)
63: #define splstatclock() splclock()
64: #define splsched() _cpu_intr_raise(IPL_SCHED << 4)
65: #define splhigh() _cpu_intr_suspend()
66: #define spllock() splhigh()
67:
68: #define spl0() _cpu_intr_resume(IPL_NONE << 4)
69: #define splx(x) _cpu_intr_resume(x)
70:
71: #ifdef DIAGNOSTIC
72: /*
73: * Although this function is implemented in MI code, it must be in this MD
74: * header because we don't want this header to include MI includes.
75: */
76: void splassert_fail(int, int, const char *);
77: extern int splassert_ctl;
78: void splassert_check(int, const char *);
79: #define splassert(__wantipl) \
80: do { \
81: if (splassert_ctl > 0) { \
82: splassert_check(__wantipl, __func__); \
83: } \
84: } while (0)
85: #else
86: #define splassert(wantipl) do { /* nothing yet */ } while (0)
87: #endif
88:
89: void intr_init(void);
90: void *extintr_establish(int, int, int (*)(void *), void *, const char *);
91: void extintr_disestablish(void *ih);
92: void extintr_enable(void *ih);
93: void extintr_disable(void *ih);
94: void extintr_disable_by_num(int irq);
95:
96: #endif /* !_LANDISK_INTR_H_ */
CVSweb