Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.4.2.3
      1  1.4.2.3  bouyer /*	$NetBSD: intr.h,v 1.4.2.3 2001/01/18 09:22:59 bouyer Exp $	*/
      2  1.4.2.2  bouyer 
      3  1.4.2.2  bouyer /*
      4  1.4.2.2  bouyer  * Copyright (c) 2000 Soren S. Jorvang
      5  1.4.2.2  bouyer  * All rights reserved.
      6  1.4.2.2  bouyer  *
      7  1.4.2.2  bouyer  * Redistribution and use in source and binary forms, with or without
      8  1.4.2.2  bouyer  * modification, are permitted provided that the following conditions
      9  1.4.2.2  bouyer  * are met:
     10  1.4.2.2  bouyer  * 1. Redistributions of source code must retain the above copyright
     11  1.4.2.2  bouyer  *    notice, this list of conditions and the following disclaimer.
     12  1.4.2.2  bouyer  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.4.2.2  bouyer  *    notice, this list of conditions and the following disclaimer in the
     14  1.4.2.2  bouyer  *    documentation and/or other materials provided with the distribution.
     15  1.4.2.2  bouyer  * 3. All advertising materials mentioning features or use of this software
     16  1.4.2.2  bouyer  *    must display the following acknowledgement:
     17  1.4.2.2  bouyer  *          This product includes software developed for the
     18  1.4.2.2  bouyer  *          NetBSD Project.  See http://www.netbsd.org/ for
     19  1.4.2.2  bouyer  *          information about NetBSD.
     20  1.4.2.2  bouyer  * 4. The name of the author may not be used to endorse or promote products
     21  1.4.2.2  bouyer  *    derived from this software without specific prior written permission.
     22  1.4.2.2  bouyer  *
     23  1.4.2.2  bouyer  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     24  1.4.2.2  bouyer  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     25  1.4.2.2  bouyer  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     26  1.4.2.2  bouyer  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     27  1.4.2.2  bouyer  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     28  1.4.2.2  bouyer  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     29  1.4.2.2  bouyer  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     30  1.4.2.2  bouyer  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     31  1.4.2.2  bouyer  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     32  1.4.2.2  bouyer  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     33  1.4.2.2  bouyer  */
     34  1.4.2.2  bouyer 
     35  1.4.2.2  bouyer #define	IPL_NONE	0	/* Disable only this interrupt. */
     36  1.4.2.2  bouyer #define	IPL_BIO		1	/* Disable block I/O interrupts. */
     37  1.4.2.2  bouyer #define	IPL_NET		2	/* Disable network interrupts. */
     38  1.4.2.2  bouyer #define	IPL_TTY		3	/* Disable terminal interrupts. */
     39  1.4.2.2  bouyer #define	IPL_CLOCK	4	/* Disable clock interrupts. */
     40  1.4.2.2  bouyer #define	IPL_STATCLOCK	5	/* Disable profiling interrupts. */
     41  1.4.2.2  bouyer #ifndef __NO_SOFT_SERIAL_INTERRUPT
     42  1.4.2.2  bouyer #define	IPL_SERIAL	6	/* Disable serial hardware interrupts. */
     43  1.4.2.2  bouyer #endif
     44  1.4.2.2  bouyer #define	IPL_HIGH	7	/* Disable all interrupts. */
     45  1.4.2.2  bouyer #define NIPL		8
     46  1.4.2.2  bouyer 
     47  1.4.2.2  bouyer /* Interrupt sharing types. */
     48  1.4.2.2  bouyer #define IST_NONE	0	/* none */
     49  1.4.2.2  bouyer #define IST_PULSE	1	/* pulsed */
     50  1.4.2.2  bouyer #define IST_EDGE	2	/* edge-triggered */
     51  1.4.2.2  bouyer #define IST_LEVEL	3	/* level-triggered */
     52  1.4.2.2  bouyer 
     53  1.4.2.2  bouyer /* Soft interrupt masks. */
     54  1.4.2.2  bouyer #define SIR_CLOCK	31
     55  1.4.2.2  bouyer #define SIR_NET		30
     56  1.4.2.2  bouyer #define SIR_CLOCKMASK	((1 << SIR_CLOCK))
     57  1.4.2.2  bouyer #define SIR_NETMASK	((1 << SIR_NET) | SIR_CLOCKMASK)
     58  1.4.2.2  bouyer #define SIR_ALLMASK	(SIR_CLOCKMASK | SIR_NETMASK)
     59  1.4.2.2  bouyer 
     60  1.4.2.2  bouyer #ifdef _KERNEL
     61  1.4.2.2  bouyer #ifndef _LOCORE
     62  1.4.2.2  bouyer 
     63  1.4.2.2  bouyer #include <mips/cpuregs.h>
     64  1.4.2.2  bouyer 
     65  1.4.2.2  bouyer extern int		_splraise(int);
     66  1.4.2.2  bouyer extern int		_spllower(int);
     67  1.4.2.2  bouyer extern int		_splset(int);
     68  1.4.2.2  bouyer extern int		_splget(void);
     69  1.4.2.2  bouyer extern void		_splnone(void);
     70  1.4.2.2  bouyer extern void		_setsoftintr(int);
     71  1.4.2.2  bouyer extern void		_clrsoftintr(int);
     72  1.4.2.2  bouyer 
     73  1.4.2.2  bouyer #define setsoftclock()	_setsoftintr(MIPS_SOFT_INT_MASK_0)
     74  1.4.2.2  bouyer #define setsoftnet()	_setsoftintr(MIPS_SOFT_INT_MASK_1)
     75  1.4.2.2  bouyer #define clearsoftclock() _clrsoftintr(MIPS_SOFT_INT_MASK_0)
     76  1.4.2.2  bouyer #define clearsoftnet()	_clrsoftintr(MIPS_SOFT_INT_MASK_1)
     77  1.4.2.2  bouyer 
     78  1.4.2.2  bouyer extern u_int32_t 	biomask;
     79  1.4.2.2  bouyer extern u_int32_t 	netmask;
     80  1.4.2.2  bouyer extern u_int32_t 	ttymask;
     81  1.4.2.2  bouyer extern u_int32_t 	clockmask;
     82  1.4.2.2  bouyer 
     83  1.4.2.2  bouyer #define splhigh()       _splraise(MIPS_INT_MASK)
     84  1.4.2.2  bouyer #define spl0()          (void)_spllower(0)
     85  1.4.2.2  bouyer #define splx(s)         (void)_splset(s)
     86  1.4.2.2  bouyer #define splbio()        _splraise(biomask)
     87  1.4.2.2  bouyer #define splnet()        _splraise(netmask)
     88  1.4.2.2  bouyer #define spltty()        _splraise(ttymask)
     89  1.4.2.2  bouyer #define splimp()        spltty()
     90  1.4.2.3  bouyer #define splvm()         spltty()
     91  1.4.2.2  bouyer #define splclock()      _splraise(clockmask)
     92  1.4.2.2  bouyer #define splstatclock()  splclock()
     93  1.4.2.2  bouyer #define spllowersoftclock() _spllower(MIPS_SOFT_INT_MASK_0)
     94  1.4.2.2  bouyer #define splsoftclock()  _splraise(MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1)
     95  1.4.2.2  bouyer #define splsoftnet()    _splraise(MIPS_SOFT_INT_MASK_1)
     96  1.4.2.2  bouyer 
     97  1.4.2.2  bouyer #define	splsched()	splhigh()
     98  1.4.2.2  bouyer #define	spllock()	splhigh()
     99  1.4.2.2  bouyer #define spllpt()	spltty()
    100  1.4.2.2  bouyer 
    101  1.4.2.2  bouyer extern unsigned int	intrcnt[];
    102  1.4.2.2  bouyer #define SOFTCLOCK_INTR	0
    103  1.4.2.2  bouyer #define SOFTNET_INTR	1
    104  1.4.2.2  bouyer 
    105  1.4.2.2  bouyer extern void *		cpu_intr_establish(int, int, int (*)(void *), void *);
    106  1.4.2.2  bouyer 
    107  1.4.2.2  bouyer #endif /* _LOCORE */
    108  1.4.2.2  bouyer #endif /* _KERNEL */
    109