Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.10.12.1
      1  1.10.12.1  thorpej /*	$NetBSD: intr.h,v 1.10.12.1 2002/03/17 23:43:45 thorpej Exp $	*/
      2        1.1     soda 
      3        1.1     soda /*
      4        1.2     soda  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
      5        1.1     soda  *
      6        1.1     soda  * Redistribution and use in source and binary forms, with or without
      7        1.1     soda  * modification, are permitted provided that the following conditions
      8        1.1     soda  * are met:
      9        1.1     soda  * 1. Redistributions of source code must retain the above copyright
     10        1.1     soda  *    notice, this list of conditions and the following disclaimer.
     11        1.1     soda  * 2. Redistributions in binary form must reproduce the above copyright
     12        1.1     soda  *    notice, this list of conditions and the following disclaimer in the
     13        1.1     soda  *    documentation and/or other materials provided with the distribution.
     14        1.1     soda  * 3. All advertising materials mentioning features or use of this software
     15        1.1     soda  *    must display the following acknowledgement:
     16        1.2     soda  *	This product includes software developed by Jonathan Stone for
     17        1.2     soda  *      the NetBSD Project.
     18        1.1     soda  * 4. The name of the author may not be used to endorse or promote products
     19        1.1     soda  *    derived from this software without specific prior written permission.
     20        1.1     soda  *
     21        1.1     soda  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22        1.1     soda  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23        1.1     soda  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24        1.1     soda  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25        1.1     soda  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26        1.1     soda  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27        1.1     soda  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28        1.1     soda  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29        1.1     soda  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30        1.1     soda  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31        1.1     soda  */
     32        1.1     soda 
     33        1.1     soda #ifndef _ARC_INTR_H_
     34        1.1     soda #define _ARC_INTR_H_
     35        1.1     soda 
     36        1.3     soda #define IPL_NONE	0	/* disable only this interrupt */
     37        1.3     soda #define IPL_BIO		1	/* disable block I/O interrupts */
     38        1.3     soda #define IPL_NET		2	/* disable network interrupts */
     39        1.3     soda #define IPL_TTY		3	/* disable terminal interrupts */
     40  1.10.12.1  thorpej #define IPL_VM		4	/* memory allocation */
     41        1.3     soda #define IPL_CLOCK	5	/* disable clock interrupts */
     42        1.3     soda #define IPL_STATCLOCK	6	/* disable profiling interrupts */
     43        1.2     soda #if 0 /* XXX */
     44        1.3     soda #define IPL_SERIAL	7	/* disable serial hardware interrupts */
     45        1.2     soda #endif
     46        1.3     soda #define IPL_HIGH	8	/* disable all interrupts */
     47        1.3     soda #define NIPL		9
     48        1.1     soda 
     49        1.1     soda /* Interrupt sharing types. */
     50        1.3     soda #define IST_NONE	0	/* none */
     51        1.3     soda #define IST_PULSE	1	/* pulsed */
     52        1.3     soda #define IST_EDGE	2	/* edge-triggered */
     53        1.3     soda #define IST_LEVEL	3	/* level-triggered */
     54        1.1     soda 
     55        1.1     soda /* Soft interrupt masks. */
     56        1.2     soda /* XXX - revisit here */
     57        1.3     soda #define SIR_CLOCK	31
     58        1.3     soda #define SIR_NET		30
     59        1.3     soda #define SIR_CLOCKMASK	((1 << SIR_CLOCK))
     60        1.3     soda #define SIR_NETMASK	((1 << SIR_NET) | SIR_CLOCKMASK)
     61        1.3     soda #define SIR_ALLMASK	(SIR_CLOCKMASK | SIR_NETMASK)
     62        1.1     soda 
     63        1.2     soda #ifdef _KERNEL
     64        1.1     soda #ifndef _LOCORE
     65        1.1     soda 
     66        1.2     soda #include <mips/cpuregs.h>
     67        1.2     soda 
     68        1.2     soda extern int _splraise __P((int));
     69        1.2     soda extern int _spllower __P((int));
     70        1.2     soda extern int _splset __P((int));
     71        1.2     soda extern int _splget __P((void));
     72        1.2     soda extern void _splnone __P((void));
     73        1.2     soda extern void _setsoftintr __P((int));
     74        1.2     soda extern void _clrsoftintr __P((int));
     75        1.2     soda 
     76        1.2     soda #define setsoftclock()	_setsoftintr(MIPS_SOFT_INT_MASK_0)
     77        1.2     soda #define setsoftnet()	_setsoftintr(MIPS_SOFT_INT_MASK_1)
     78        1.2     soda #define clearsoftclock() _clrsoftintr(MIPS_SOFT_INT_MASK_0)
     79        1.3     soda #define clearsoftnet()	_clrsoftintr(MIPS_SOFT_INT_MASK_1)
     80        1.3     soda 
     81        1.3     soda /*
     82        1.3     soda  * nesting interrupt masks.
     83        1.3     soda  */
     84        1.3     soda #define MIPS_INT_MASK_SPL_SOFT0	MIPS_SOFT_INT_MASK_0
     85        1.3     soda #define MIPS_INT_MASK_SPL_SOFT1	(MIPS_SOFT_INT_MASK_1|MIPS_INT_MASK_SPL_SOFT0)
     86        1.3     soda #define MIPS_INT_MASK_SPL0	(MIPS_INT_MASK_0|MIPS_INT_MASK_SPL_SOFT1)
     87        1.3     soda #define MIPS_INT_MASK_SPL1	(MIPS_INT_MASK_1|MIPS_INT_MASK_SPL0)
     88        1.3     soda #define MIPS_INT_MASK_SPL2	(MIPS_INT_MASK_2|MIPS_INT_MASK_SPL1)
     89        1.3     soda #define MIPS_INT_MASK_SPL3	(MIPS_INT_MASK_3|MIPS_INT_MASK_SPL2)
     90        1.3     soda #define MIPS_INT_MASK_SPL4	(MIPS_INT_MASK_4|MIPS_INT_MASK_SPL3)
     91        1.3     soda #define MIPS_INT_MASK_SPL5	(MIPS_INT_MASK_5|MIPS_INT_MASK_SPL4)
     92        1.3     soda #define MIPS_INT_MASK_SPLHIGH	MIPS_INT_MASK_SPL5
     93        1.2     soda 
     94        1.2     soda #define spl0()		(void)_spllower(0)
     95        1.2     soda #define splx(s)		(void)_splset(s)
     96        1.2     soda #define splbio()	(_splraise(splvec.splbio))
     97        1.2     soda #define splnet()	(_splraise(splvec.splnet))
     98        1.2     soda #define spltty()	(_splraise(splvec.spltty))
     99        1.8  thorpej #define splvm()		(_splraise(splvec.splvm))
    100        1.2     soda #define splclock()	(_splraise(splvec.splclock))
    101        1.2     soda #define splstatclock()	(_splraise(splvec.splstatclock))
    102        1.3     soda #define splhigh()	_splraise(MIPS_INT_MASK_SPLHIGH)
    103        1.2     soda 
    104        1.3     soda #define splsoftclock()	_splraise(MIPS_INT_MASK_SPL_SOFT0)
    105        1.3     soda #define splsoftnet()	_splraise(MIPS_INT_MASK_SPL_SOFT1)
    106        1.3     soda #define spllowersoftclock() _spllower(MIPS_INT_MASK_SPL_SOFT0)
    107        1.3     soda 
    108        1.5  thorpej #define	splsched()	splhigh()
    109        1.6  thorpej #define	spllock()	splhigh()
    110        1.3     soda #define spllpt()	spltty()		/* lpt driver */
    111        1.2     soda 
    112        1.2     soda struct splvec {
    113        1.2     soda 	int	splbio;
    114        1.2     soda 	int	splnet;
    115        1.2     soda 	int	spltty;
    116        1.8  thorpej 	int	splvm;
    117        1.2     soda 	int	splclock;
    118        1.2     soda 	int	splstatclock;
    119        1.2     soda };
    120        1.2     soda extern struct splvec splvec;
    121        1.2     soda 
    122        1.2     soda /*
    123        1.2     soda  * Index into intrcnt[], which is defined in locore
    124        1.2     soda  */
    125        1.2     soda #define SOFTCLOCK_INTR	0
    126        1.2     soda #define SOFTNET_INTR	1
    127        1.2     soda #define FPU_INTR	2
    128        1.2     soda extern u_long intrcnt[];
    129        1.1     soda 
    130        1.1     soda struct clockframe;
    131       1.10     soda void arc_set_intr __P((int, int(*)(u_int, struct clockframe *), int));
    132        1.1     soda 
    133        1.2     soda /* XXX - revisit here */
    134        1.2     soda int imask[NIPL];
    135        1.1     soda 
    136        1.2     soda #endif /* !_LOCORE */
    137        1.2     soda #endif /* _KERNEL */
    138        1.1     soda 
    139        1.1     soda #endif /* _ARC_INTR_H_ */
    140