intr.h revision 1.9 1 1.9 thorpej /* $NetBSD: intr.h,v 1.9 2001/01/14 02:00:41 thorpej Exp $ */
2 1.1 dbj
3 1.1 dbj /*
4 1.1 dbj * Copyright (C) 1997 Scott Reynolds
5 1.1 dbj * Copyright (C) 1998 Darrin Jewell
6 1.1 dbj * All rights reserved.
7 1.1 dbj *
8 1.1 dbj * Redistribution and use in source and binary forms, with or without
9 1.1 dbj * modification, are permitted provided that the following conditions
10 1.1 dbj * are met:
11 1.1 dbj * 1. Redistributions of source code must retain the above copyright
12 1.1 dbj * notice, this list of conditions and the following disclaimer.
13 1.1 dbj * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 dbj * notice, this list of conditions and the following disclaimer in the
15 1.1 dbj * documentation and/or other materials provided with the distribution.
16 1.1 dbj * 3. The name of the author may not be used to endorse or promote products
17 1.1 dbj * derived from this software without specific prior written permission.
18 1.1 dbj *
19 1.1 dbj * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 1.1 dbj * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 1.1 dbj * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 1.1 dbj * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 1.1 dbj * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 1.1 dbj * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 1.1 dbj * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 1.1 dbj * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 1.1 dbj * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 1.1 dbj * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 1.1 dbj */
30 1.1 dbj
31 1.1 dbj #ifndef _NEXT68K_INTR_H_
32 1.1 dbj #define _NEXT68K_INTR_H_
33 1.1 dbj
34 1.1 dbj #include <machine/psl.h>
35 1.1 dbj
36 1.1 dbj /* Probably want to dealwith IPL's here @@@ */
37 1.1 dbj
38 1.1 dbj #ifdef _KERNEL
39 1.1 dbj
40 1.1 dbj /* spl0 requires checking for software interrupts */
41 1.1 dbj
42 1.1 dbj /* watch out for side effects */
43 1.1 dbj #define splx(s) ((s) & PSL_IPL ? _spl(s) : spl0())
44 1.1 dbj
45 1.1 dbj /****************************************************************/
46 1.1 dbj
47 1.4 dbj #define splhigh() spl7()
48 1.4 dbj #define splserial() _splraise(PSL_S|PSL_IPL5)
49 1.7 thorpej #define splsched() spl7()
50 1.8 thorpej #define spllock() spl7()
51 1.4 dbj #define splclock() _splraise(PSL_S|PSL_IPL6)
52 1.4 dbj #define splstatclock() splclock()
53 1.4 dbj #define splimp() _splraise(PSL_S|PSL_IPL6)
54 1.9 thorpej #define splvm() _splraise(PSL_S|PSL_IPL6)
55 1.4 dbj #define spltty() _splraise(PSL_S|PSL_IPL3)
56 1.4 dbj #define splbio() _splraise(PSL_S|PSL_IPL3)
57 1.4 dbj #define splnet() _splraise(PSL_S|PSL_IPL3)
58 1.4 dbj #define splsoftnet() _splraise(PSL_S|PSL_IPL2)
59 1.6 thorpej #define splsoftclock() splraise1()
60 1.6 thorpej #define spllowersoftclock() spl1()
61 1.1 dbj
62 1.4 dbj #define spldma() _splraise(PSL_S|PSL_IPL6)
63 1.1 dbj
64 1.1 dbj /****************************************************************/
65 1.1 dbj
66 1.1 dbj /*
67 1.1 dbj * simulated software interrupt register
68 1.1 dbj */
69 1.1 dbj extern volatile u_int8_t ssir;
70 1.1 dbj
71 1.1 dbj #define SIR_NET 0x01
72 1.1 dbj #define SIR_CLOCK 0x02
73 1.1 dbj #define SIR_SERIAL 0x04
74 1.1 dbj #define SIR_DTMGR 0x08
75 1.1 dbj #define SIR_ADB 0x10
76 1.1 dbj
77 1.1 dbj #define siron(mask) \
78 1.3 kleink __asm __volatile ( "orb %1,%0" : "=m" (ssir) : "i" (mask))
79 1.1 dbj #define siroff(mask) \
80 1.3 kleink __asm __volatile ( "andb %1,%0" : "=m" (ssir) : "ir" (~(mask)));
81 1.1 dbj
82 1.1 dbj #define setsoftnet() siron(SIR_NET)
83 1.1 dbj #define setsoftclock() siron(SIR_CLOCK)
84 1.1 dbj #define setsoftserial() siron(SIR_SERIAL)
85 1.1 dbj #define setsoftdtmgr() siron(SIR_DTMGR)
86 1.1 dbj #define setsoftadb() siron(SIR_ADB)
87 1.2 dbj
88 1.5 dbj extern u_long allocate_sir __P((void (*)(void *),void *));
89 1.2 dbj extern void init_sir __P((void));
90 1.1 dbj
91 1.1 dbj /* locore.s */
92 1.1 dbj int spl0 __P((void));
93 1.1 dbj #endif /* _KERNEL */
94 1.1 dbj
95 1.1 dbj #define INTR_SETMASK(x) ((*(volatile u_long *)IIOV(NEXT_P_INTRMASK))=(x))
96 1.1 dbj #define INTR_ENABLE(x) ((*(volatile u_long *)IIOV(NEXT_P_INTRMASK))|=NEXT_I_BIT(x))
97 1.1 dbj #define INTR_DISABLE(x) ((*(volatile u_long *)IIOV(NEXT_P_INTRMASK))&=(~NEXT_I_BIT(x)))
98 1.1 dbj #define INTR_OCCURRED(x) ((*(volatile u_long *)IIOV(NEXT_P_INTRSTAT))& NEXT_I_BIT(x))
99 1.1 dbj
100 1.1 dbj #endif /* _NEXT68K_INTR_H_ */
101