Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / hp700 / include / intr.h
blobff8a860288fa5ead14325682f2311ba74d1d7983
1 /* $NetBSD: intr.h,v 1.14 2009/05/07 08:16:50 skrll Exp $ */
3 /*-
4 * Copyright (c) 1998, 2001, 2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
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
12 * are met:
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 */
46 #define NIPL 8
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 */
54 #ifndef _LOCORE
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.
71 static __inline int
72 splraise(register int ncpl)
74 register int ocpl = cpl;
76 cpl = ocpl | ncpl;
77 __insn_barrier();
79 return (ocpl);
82 /* spllower() is in locore.S */
83 void spllower(int);
86 * Miscellaneous
88 #define spl0() spllower(0)
89 #define splx(x) spllower(x)
91 typedef int ipl_t;
92 typedef struct {
93 ipl_t _ipl;
94 } ipl_cookie_t;
96 static inline ipl_cookie_t
97 makeiplcookie(ipl_t ipl)
100 return (ipl_cookie_t){._ipl = ipl};
103 static inline int
104 splraiseipl(ipl_cookie_t icookie)
107 return splraise(imask[icookie._ipl]);
110 #include <sys/spl.h>
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_ */