Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.14
      1  1.14  tsutsui /*	$NetBSD: intr.h,v 1.14 2003/09/12 15:03:24 tsutsui 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.14  tsutsui #ifndef	_COBALT_INTR_H_
     29  1.14  tsutsui #define	_COBALT_INTR_H_
     30  1.14  tsutsui 
     31   1.1    soren #define	IPL_NONE	0	/* Disable only this interrupt. */
     32   1.1    soren #define	IPL_BIO		1	/* Disable block I/O interrupts. */
     33   1.1    soren #define	IPL_NET		2	/* Disable network interrupts. */
     34   1.1    soren #define	IPL_TTY		3	/* Disable terminal interrupts. */
     35  1.12  thorpej #define	IPL_VM		4	/* Memory allocation */
     36   1.3    soren #define	IPL_CLOCK	5	/* Disable clock interrupts. */
     37   1.3    soren #define	IPL_STATCLOCK	6	/* Disable profiling interrupts. */
     38   1.3    soren #define	IPL_HIGH	7	/* Disable all interrupts. */
     39   1.3    soren #define NIPL		8
     40   1.1    soren 
     41   1.1    soren /* Interrupt sharing types. */
     42   1.1    soren #define IST_NONE	0	/* none */
     43   1.1    soren #define IST_PULSE	1	/* pulsed */
     44   1.1    soren #define IST_EDGE	2	/* edge-triggered */
     45   1.1    soren #define IST_LEVEL	3	/* level-triggered */
     46   1.1    soren 
     47   1.5    soren /* Soft interrupt masks. */
     48  1.13  tsutsui #define SIR_CLOCK	31
     49  1.13  tsutsui #define SIR_NET		30
     50  1.13  tsutsui #define SIR_CLOCKMASK	((1 << SIR_CLOCK))
     51   1.5    soren #define SIR_NETMASK	((1 << SIR_NET) | SIR_CLOCKMASK)
     52   1.5    soren #define SIR_ALLMASK	(SIR_CLOCKMASK | SIR_NETMASK)
     53   1.5    soren 
     54   1.3    soren #ifdef _KERNEL
     55   1.1    soren #ifndef _LOCORE
     56   1.5    soren 
     57   1.5    soren #include <mips/cpuregs.h>
     58   1.1    soren 
     59   1.1    soren extern int		_splraise(int);
     60  1.13  tsutsui extern int		_spllower(int);
     61   1.1    soren extern int		_splset(int);
     62   1.1    soren extern int		_splget(void);
     63   1.1    soren extern void		_splnone(void);
     64   1.1    soren extern void		_setsoftintr(int);
     65   1.1    soren extern void		_clrsoftintr(int);
     66   1.1    soren 
     67   1.1    soren #define setsoftclock()	_setsoftintr(MIPS_SOFT_INT_MASK_0)
     68   1.1    soren #define setsoftnet()	_setsoftintr(MIPS_SOFT_INT_MASK_1)
     69   1.1    soren #define clearsoftclock() _clrsoftintr(MIPS_SOFT_INT_MASK_0)
     70   1.1    soren #define clearsoftnet()	_clrsoftintr(MIPS_SOFT_INT_MASK_1)
     71   1.1    soren 
     72   1.1    soren #define splhigh()       _splraise(MIPS_INT_MASK)
     73   1.1    soren #define spl0()          (void)_spllower(0)
     74   1.1    soren #define splx(s)         (void)_splset(s)
     75   1.2    soren #define SPLSOFT		MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1
     76   1.2    soren #define SPLBIO		SPLSOFT | MIPS_INT_MASK_4
     77   1.1    soren #define SPLNET		SPLBIO | MIPS_INT_MASK_1 | MIPS_INT_MASK_2
     78   1.1    soren #define SPLTTY		SPLNET | MIPS_INT_MASK_3
     79   1.1    soren #define SPLCLOCK	SPLTTY | MIPS_INT_MASK_0 | MIPS_INT_MASK_5
     80   1.1    soren #define splbio()        _splraise(SPLBIO)
     81   1.1    soren #define splnet()        _splraise(SPLNET)
     82   1.1    soren #define spltty()        _splraise(SPLTTY)
     83   1.1    soren #define splclock()      _splraise(SPLCLOCK)
     84   1.9  thorpej #define splvm()		splclock()
     85   1.1    soren #define splstatclock()  splclock()
     86   1.1    soren #define splsoftclock()	_splraise(MIPS_SOFT_INT_MASK_0)
     87   1.4     soda #define splsoftnet()	_splraise(MIPS_SOFT_INT_MASK_0|MIPS_SOFT_INT_MASK_1)
     88   1.3    soren #define spllowersoftclock() _spllower(MIPS_SOFT_INT_MASK_0)
     89   1.7  thorpej 
     90   1.7  thorpej #define	splsched()	splhigh()
     91   1.8  thorpej #define	spllock()	splhigh()
     92   1.1    soren 
     93   1.1    soren extern unsigned int	intrcnt[];
     94   1.1    soren #define SOFTCLOCK_INTR	0
     95  1.13  tsutsui #define SOFTNET_INTR	1
     96   1.1    soren 
     97   1.3    soren #endif /* !_LOCORE */
     98   1.1    soren #endif /* _LOCORE */
     99  1.14  tsutsui 
    100  1.14  tsutsui #endif	/* !_COBALT_INTR_H_ */
    101