intr.h revision 1.2
11.2Skleink/*	$NetBSD: intr.h,v 1.2 2002/01/14 19:59:31 kleink Exp $	*/
21.2Skleink
31.2Skleink/*
41.2Skleink * Copyright (c) 1988 University of Utah.
51.2Skleink * Copyright (c) 1982, 1986, 1990, 1993
61.2Skleink *	The Regents of the University of California.  All rights reserved.
71.2Skleink *
81.2Skleink * This code is derived from software contributed to Berkeley by
91.2Skleink * the Systems Programming Group of the University of Utah Computer
101.2Skleink * Science Department.
111.2Skleink *
121.2Skleink * Redistribution and use in source and binary forms, with or without
131.2Skleink * modification, are permitted provided that the following conditions
141.2Skleink * are met:
151.2Skleink * 1. Redistributions of source code must retain the above copyright
161.2Skleink *    notice, this list of conditions and the following disclaimer.
171.2Skleink * 2. Redistributions in binary form must reproduce the above copyright
181.2Skleink *    notice, this list of conditions and the following disclaimer in the
191.2Skleink *    documentation and/or other materials provided with the distribution.
201.2Skleink * 3. All advertising materials mentioning features or use of this software
211.2Skleink *    must display the following acknowledgement:
221.2Skleink *	This product includes software developed by the University of
231.2Skleink *	California, Berkeley and its contributors.
241.2Skleink * 4. Neither the name of the University nor the names of its contributors
251.2Skleink *    may be used to endorse or promote products derived from this software
261.2Skleink *    without specific prior written permission.
271.2Skleink *
281.2Skleink * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
291.2Skleink * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
301.2Skleink * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
311.2Skleink * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
321.2Skleink * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
331.2Skleink * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
341.2Skleink * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
351.2Skleink * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
361.2Skleink * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
371.2Skleink * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
381.2Skleink * SUCH DAMAGE.
391.2Skleink *
401.2Skleink * from: Utah $Hdr: machparam.h 1.16 92/12/20$
411.2Skleink *
421.2Skleink *	from: @(#)param.h	8.1 (Berkeley) 6/10/93
431.2Skleink */
441.2Skleink
451.2Skleink#ifndef _CESFIC_INTR_H_
461.2Skleink#define _CESFIC_INTR_H_
471.2Skleink
481.2Skleink/*
491.2Skleink * spl functions; all but spl0 are done in-line
501.2Skleink */
511.2Skleink#include <machine/psl.h>
521.2Skleink
531.2Skleink#if defined(_KERNEL) && !defined(_LOCORE)
541.2Skleink/* spl0 requires checking for software interrupts */
551.2Skleink#define spl1()  _spl(PSL_S|PSL_IPL1)
561.2Skleink#define spl2()  _spl(PSL_S|PSL_IPL2)
571.2Skleink#define spl3()  _spl(PSL_S|PSL_IPL3)
581.2Skleink#define spl4()  _spl(PSL_S|PSL_IPL4)
591.2Skleink#define spl5()  _spl(PSL_S|PSL_IPL5)
601.2Skleink#define spl6()  _spl(PSL_S|PSL_IPL6)
611.2Skleink#define spl7()  _spl(PSL_S|PSL_IPL7)
621.2Skleink
631.2Skleink/*
641.2Skleink * These four globals contain the appropriate PSL_S|PSL_IPL? values
651.2Skleink * to raise interrupt priority to the requested level.
661.2Skleink */
671.2Skleinkextern	unsigned short cesfic_bioipl;
681.2Skleinkextern	unsigned short cesfic_netipl;
691.2Skleinkextern	unsigned short cesfic_ttyipl;
701.2Skleinkextern	unsigned short cesfic_impipl;
711.2Skleink
721.2Skleink/* These spl calls are used by machine-independent code. */
731.2Skleink#define	spllowersoftclock() spl1()
741.2Skleink#define	splsoft()	splraise1()
751.2Skleink#define splsoftclock()	splsoft()
761.2Skleink#define splsoftnet()	splsoft()
771.2Skleink#define splbio()	_splraise(cesfic_bioipl)
781.2Skleink#define splnet()	_splraise(cesfic_netipl)
791.2Skleink#define spltty()	_splraise(cesfic_ttyipl)
801.2Skleink#define splvm()		_splraise(cesfic_impipl)
811.2Skleink#define splclock()	spl6()
821.2Skleink#define splstatclock()	spl6()
831.2Skleink#define splhigh()	spl7()
841.2Skleink#define splsched()	spl7()
851.2Skleink#define spllock()	spl7()
861.2Skleink
871.2Skleink/* watch out for side effects */
881.2Skleink#define splx(s)         (s & PSL_IPL ? _spl(s) : spl0())
891.2Skleink
901.2Skleinkint	spl0 __P((void));
911.2Skleink#endif /* _KERNEL && !_LOCORE */
921.2Skleink
931.2Skleink#endif /* !_CESFIC_INTR_H_ */
94