intr.h revision 1.5
11.5Stsutsui/*	$NetBSD: intr.h,v 1.5 2000/11/24 14:08:14 tsutsui Exp $	*/
21.1Stsutsui
31.1Stsutsui/*
41.1Stsutsui *
51.1Stsutsui * Copyright (c) 1998 NetBSD Foundation, Inc.
61.1Stsutsui * All rights reserved.
71.1Stsutsui *
81.1Stsutsui * This code is derived from software contributed to The NetBSD Foundation
91.1Stsutsui * by Minoura Makoto and Jason R. Thorpe.
101.1Stsutsui *
111.1Stsutsui * Redistribution and use in source and binary forms, with or without
121.1Stsutsui * modification, are permitted provided that the following conditions
131.1Stsutsui * are met:
141.1Stsutsui * 1. Redistributions of source code must retain the above copyright
151.1Stsutsui *    notice, this list of conditions and the following disclaimer.
161.1Stsutsui * 2. Redistributions in binary form must reproduce the above copyright
171.1Stsutsui *    notice, this list of conditions and the following disclaimer in the
181.1Stsutsui *    documentation and/or other materials provided with the distribution.
191.1Stsutsui * 3. All advertising materials mentioning features or use of this software
201.1Stsutsui *    must display the following acknowledgement:
211.1Stsutsui *      This product includes software developed by The NetBSD Foundation
221.1Stsutsui *	Inc. and its contributers.
231.1Stsutsui * 4. The name of the author may not be used to endorse or promote products
241.1Stsutsui *    derived from this software without specific prior written permission.
251.1Stsutsui *
261.1Stsutsui * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
271.1Stsutsui * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
281.1Stsutsui * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
291.1Stsutsui * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
301.1Stsutsui * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
311.1Stsutsui * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
321.1Stsutsui * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
331.1Stsutsui * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
341.1Stsutsui * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
351.1Stsutsui * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
361.1Stsutsui */
371.1Stsutsui
381.1Stsutsui#ifndef _NEWS68K_INTR_H_
391.1Stsutsui#define	_NEWS68K_INTR_H_
401.1Stsutsui
411.1Stsutsui#include <machine/psl.h>
421.5Stsutsui#include <m68k/asm_single.h>
431.1Stsutsui
441.1Stsutsui#ifdef _KERNEL
451.1Stsutsui/*
461.1Stsutsui * news68k can handle software interrupts by its own hardware
471.1Stsutsui * so has no need to check for any simulated interrupts, etc.
481.1Stsutsui */
491.1Stsutsui#define	spl0()		_spl0()
501.1Stsutsui#define	splx(s)		_spl(s)
511.1Stsutsui
521.1Stsutsui#define	spllowersoftclock()	spl2()
531.1Stsutsui#define	splsoft()	splraise2()
541.1Stsutsui#define	splsoftclock()	splsoft()
551.1Stsutsui#define	splsoftnet()	splsoft()
561.1Stsutsui#define	splbio()	splraise4()
571.1Stsutsui#define	splnet()	splraise4()
581.1Stsutsui#define	spltty()	splraise5()
591.1Stsutsui#define	splimp()	splraise5()
601.1Stsutsui#define	splserial()     splraise5()
611.1Stsutsui#define	splclock()	splraise6()
621.1Stsutsui#define	splstatclock()	splclock()
631.1Stsutsui#define	splvm()		spl6()
641.1Stsutsui#define	splhigh()	spl7()
651.1Stsutsui#define	splsched()	spl7()
661.4Sthorpej#define	spllock()	spl7()
671.1Stsutsui
681.1Stsutsui/*
691.1Stsutsui * simulated software interrupt register
701.1Stsutsui */
711.2Stsutsuiextern u_char ssir;
721.1Stsutsuiextern volatile u_char *ctrl_int2;
731.1Stsutsui
741.1Stsutsui#define	NSIR		(sizeof(ssir) * 8)
751.2Stsutsui#define	SIR_NET		0
761.2Stsutsui#define	SIR_CLOCK	1
771.2Stsutsui#define	NEXT_SIR	2
781.1Stsutsui
791.5Stsutsui#define	siron(x)	single_inst_bset_b((ssir), (x))
801.5Stsutsui#define	siroff(x)	single_inst_bclr_b((ssir), (x))
811.2Stsutsui#define	setsoftint(x)	do {				\
821.3Stsutsui				siron(x);		\
831.2Stsutsui				*ctrl_int2 = 0xff;	\
841.2Stsutsui			} while (0)
851.2Stsutsui#define	setsoftnet()	setsoftint(1 << SIR_NET)
861.2Stsutsui#define	setsoftclock()	setsoftint(1 << SIR_CLOCK)
871.1Stsutsui
881.3Stsutsuiu_char allocate_sir __P((void (*)(void *), void *));
891.1Stsutsuivoid init_sir __P((void));
901.1Stsutsui#endif /* _KERNEL */
911.1Stsutsui
921.1Stsutsui#endif /* _NEWS68K_INTR_H_ */
93