Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.9.2.1
      1  1.9.2.1  nathanw /*	$NetBSD: intr.h,v 1.9.2.1 2001/06/21 19:21:09 nathanw Exp $	*/
      2      1.6    soren 
      3      1.6    soren /*
      4      1.6    soren  * Copyright (c) 2000 Soren S. Jorvang.  All rights reserved.
      5      1.6    soren  *
      6      1.6    soren  * Redistribution and use in source and binary forms, with or without
      7      1.6    soren  * modification, are permitted provided that the following conditions
      8      1.6    soren  * are met:
      9      1.6    soren  * 1. Redistributions of source code must retain the above copyright
     10      1.6    soren  *    notice, this list of conditions, and the following disclaimer.
     11      1.6    soren  * 2. Redistributions in binary form must reproduce the above copyright
     12      1.6    soren  *    notice, this list of conditions and the following disclaimer in the
     13      1.6    soren  *    documentation and/or other materials provided with the distribution.
     14      1.6    soren  *
     15      1.6    soren  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     16      1.6    soren  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     17      1.6    soren  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     18      1.6    soren  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     19      1.6    soren  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     20      1.6    soren  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     21      1.6    soren  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     22      1.6    soren  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     23      1.6    soren  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     24      1.6    soren  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     25      1.6    soren  * SUCH DAMAGE.
     26      1.6    soren  */
     27      1.1    soren 
     28      1.1    soren #define	IPL_NONE	0	/* Disable only this interrupt. */
     29      1.1    soren #define	IPL_BIO		1	/* Disable block I/O interrupts. */
     30      1.1    soren #define	IPL_NET		2	/* Disable network interrupts. */
     31      1.1    soren #define	IPL_TTY		3	/* Disable terminal interrupts. */
     32      1.3    soren #define	IPL_IMP		4	/* Memory allocation */
     33      1.3    soren #define	IPL_CLOCK	5	/* Disable clock interrupts. */
     34      1.3    soren #define	IPL_STATCLOCK	6	/* Disable profiling interrupts. */
     35      1.3    soren #define	IPL_HIGH	7	/* Disable all interrupts. */
     36      1.3    soren #define NIPL		8
     37      1.1    soren 
     38      1.1    soren /* Interrupt sharing types. */
     39      1.1    soren #define IST_NONE	0	/* none */
     40      1.1    soren #define IST_PULSE	1	/* pulsed */
     41      1.1    soren #define IST_EDGE	2	/* edge-triggered */
     42      1.1    soren #define IST_LEVEL	3	/* level-triggered */
     43      1.1    soren 
     44      1.5    soren /* Soft interrupt masks. */
     45      1.5    soren #define SIR_CLOCK	31
     46      1.5    soren #define SIR_NET		30
     47      1.5    soren #define SIR_CLOCKMASK	((1 << SIR_CLOCK))
     48      1.5    soren #define SIR_NETMASK	((1 << SIR_NET) | SIR_CLOCKMASK)
     49      1.5    soren #define SIR_ALLMASK	(SIR_CLOCKMASK | SIR_NETMASK)
     50      1.5    soren 
     51      1.3    soren #ifdef _KERNEL
     52      1.1    soren #ifndef _LOCORE
     53      1.5    soren 
     54      1.5    soren #include <mips/cpuregs.h>
     55      1.1    soren 
     56      1.1    soren extern int		_splraise(int);
     57      1.1    soren extern int		_spllower(int);
     58      1.1    soren extern int		_splset(int);
     59      1.1    soren extern int		_splget(void);
     60      1.1    soren extern void		_splnone(void);
     61      1.1    soren extern void		_setsoftintr(int);
     62      1.1    soren extern void		_clrsoftintr(int);
     63      1.1    soren 
     64      1.1    soren #define setsoftclock()	_setsoftintr(MIPS_SOFT_INT_MASK_0)
     65      1.1    soren #define setsoftnet()	_setsoftintr(MIPS_SOFT_INT_MASK_1)
     66      1.1    soren #define clearsoftclock() _clrsoftintr(MIPS_SOFT_INT_MASK_0)
     67      1.1    soren #define clearsoftnet()	_clrsoftintr(MIPS_SOFT_INT_MASK_1)
     68      1.1    soren 
     69      1.1    soren #define splhigh()       _splraise(MIPS_INT_MASK)
     70      1.1    soren #define spl0()          (void)_spllower(0)
     71      1.1    soren #define splx(s)         (void)_splset(s)
     72      1.2    soren #define SPLSOFT		MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1
     73      1.2    soren #define SPLBIO		SPLSOFT | MIPS_INT_MASK_4
     74      1.1    soren #define SPLNET		SPLBIO | MIPS_INT_MASK_1 | MIPS_INT_MASK_2
     75      1.1    soren #define SPLTTY		SPLNET | MIPS_INT_MASK_3
     76      1.1    soren #define SPLCLOCK	SPLTTY | MIPS_INT_MASK_0 | MIPS_INT_MASK_5
     77      1.1    soren #define splbio()        _splraise(SPLBIO)
     78      1.1    soren #define splnet()        _splraise(SPLNET)
     79      1.1    soren #define spltty()        _splraise(SPLTTY)
     80      1.1    soren #define splclock()      _splraise(SPLCLOCK)
     81      1.9  thorpej #define splvm()		splclock()
     82      1.1    soren #define splstatclock()  splclock()
     83      1.1    soren #define splsoftclock()	_splraise(MIPS_SOFT_INT_MASK_0)
     84      1.4     soda #define splsoftnet()	_splraise(MIPS_SOFT_INT_MASK_0|MIPS_SOFT_INT_MASK_1)
     85      1.3    soren #define spllowersoftclock() _spllower(MIPS_SOFT_INT_MASK_0)
     86      1.7  thorpej 
     87      1.7  thorpej #define	splsched()	splhigh()
     88      1.8  thorpej #define	spllock()	splhigh()
     89      1.1    soren 
     90      1.1    soren extern unsigned int	intrcnt[];
     91      1.1    soren #define SOFTCLOCK_INTR	0
     92      1.1    soren #define SOFTNET_INTR	1
     93      1.1    soren 
     94      1.3    soren extern void *	cpu_intr_establish(int, int, int (*)(void *), void *);
     95      1.3    soren extern void *	icu_intr_establish(int, int, int, int (*)(void *), void *);
     96      1.1    soren 
     97      1.3    soren #endif /* !_LOCORE */
     98      1.1    soren #endif /* _LOCORE */
     99