intr.h revision 1.4
11.4Sthorpej/*	$NetBSD: intr.h,v 1.4 2000/08/22 19:46:30 thorpej 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.1Stsutsui
431.1Stsutsui#ifdef _KERNEL
441.1Stsutsui/*
451.1Stsutsui * news68k can handle software interrupts by its own hardware
461.1Stsutsui * so has no need to check for any simulated interrupts, etc.
471.1Stsutsui */
481.1Stsutsui#define	spl0()		_spl0()
491.1Stsutsui#define	splx(s)		_spl(s)
501.1Stsutsui
511.1Stsutsui#define	spllowersoftclock()	spl2()
521.1Stsutsui#define	splsoft()	splraise2()
531.1Stsutsui#define	splsoftclock()	splsoft()
541.1Stsutsui#define	splsoftnet()	splsoft()
551.1Stsutsui#define	splbio()	splraise4()
561.1Stsutsui#define	splnet()	splraise4()
571.1Stsutsui#define	spltty()	splraise5()
581.1Stsutsui#define	splimp()	splraise5()
591.1Stsutsui#define	splserial()     splraise5()
601.1Stsutsui#define	splclock()	splraise6()
611.1Stsutsui#define	splstatclock()	splclock()
621.1Stsutsui#define	splvm()		spl6()
631.1Stsutsui#define	splhigh()	spl7()
641.1Stsutsui#define	splsched()	spl7()
651.4Sthorpej#define	spllock()	spl7()
661.1Stsutsui
671.1Stsutsui/*
681.1Stsutsui * simulated software interrupt register
691.1Stsutsui */
701.2Stsutsuiextern u_char ssir;
711.1Stsutsuiextern volatile u_char *ctrl_int2;
721.1Stsutsui
731.1Stsutsui#define	NSIR		(sizeof(ssir) * 8)
741.2Stsutsui#define	SIR_NET		0
751.2Stsutsui#define	SIR_CLOCK	1
761.2Stsutsui#define	NEXT_SIR	2
771.1Stsutsui
781.3Stsutsui#define	siron(x)	\
791.3Stsutsui	__asm __volatile ("orb %0,%1" : : "di" ((u_char)(x)), "g" (ssir))
801.3Stsutsui#define	siroff(x)	\
811.3Stsutsui	__asm __volatile ("andb %0,%1" : : "di" ((u_char)~(x)), "g" (ssir))
821.2Stsutsui#define	setsoftint(x)	do {				\
831.3Stsutsui				siron(x);		\
841.2Stsutsui				*ctrl_int2 = 0xff;	\
851.2Stsutsui			} while (0)
861.2Stsutsui#define	setsoftnet()	setsoftint(1 << SIR_NET)
871.2Stsutsui#define	setsoftclock()	setsoftint(1 << SIR_CLOCK)
881.1Stsutsui
891.3Stsutsuiu_char allocate_sir __P((void (*)(void *), void *));
901.1Stsutsuivoid init_sir __P((void));
911.1Stsutsui#endif /* _KERNEL */
921.1Stsutsui
931.1Stsutsui#endif /* _NEWS68K_INTR_H_ */
94