NetBSD/sys/arch/cobalt/include/intr.h

101 lines
3.7 KiB
C
Raw Normal View History

2003-09-12 19:03:24 +04:00
/* $NetBSD: intr.h,v 1.14 2003/09/12 15:03:24 tsutsui Exp $ */
2000-05-05 07:27:22 +04:00
/*
* Copyright (c) 2000 Soren S. Jorvang. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
2000-03-20 02:07:43 +03:00
2003-09-12 19:03:24 +04:00
#ifndef _COBALT_INTR_H_
#define _COBALT_INTR_H_
2000-03-20 02:07:43 +03:00
#define IPL_NONE 0 /* Disable only this interrupt. */
#define IPL_BIO 1 /* Disable block I/O interrupts. */
#define IPL_NET 2 /* Disable network interrupts. */
#define IPL_TTY 3 /* Disable terminal interrupts. */
2003-06-17 00:00:56 +04:00
#define IPL_VM 4 /* Memory allocation */
2000-03-31 18:51:49 +04:00
#define IPL_CLOCK 5 /* Disable clock interrupts. */
#define IPL_STATCLOCK 6 /* Disable profiling interrupts. */
#define IPL_HIGH 7 /* Disable all interrupts. */
#define NIPL 8
2000-03-20 02:07:43 +03:00
/* Interrupt sharing types. */
#define IST_NONE 0 /* none */
#define IST_PULSE 1 /* pulsed */
#define IST_EDGE 2 /* edge-triggered */
#define IST_LEVEL 3 /* level-triggered */
2000-04-28 19:55:51 +04:00
/* Soft interrupt masks. */
2003-09-12 18:59:11 +04:00
#define SIR_CLOCK 31
#define SIR_NET 30
#define SIR_CLOCKMASK ((1 << SIR_CLOCK))
2000-04-28 19:55:51 +04:00
#define SIR_NETMASK ((1 << SIR_NET) | SIR_CLOCKMASK)
#define SIR_ALLMASK (SIR_CLOCKMASK | SIR_NETMASK)
2000-03-31 18:51:49 +04:00
#ifdef _KERNEL
2000-03-20 02:07:43 +03:00
#ifndef _LOCORE
2000-04-28 19:55:51 +04:00
#include <mips/cpuregs.h>
2000-03-20 02:07:43 +03:00
extern int _splraise(int);
2003-09-12 18:59:11 +04:00
extern int _spllower(int);
2000-03-20 02:07:43 +03:00
extern int _splset(int);
extern int _splget(void);
extern void _splnone(void);
extern void _setsoftintr(int);
extern void _clrsoftintr(int);
#define setsoftclock() _setsoftintr(MIPS_SOFT_INT_MASK_0)
#define setsoftnet() _setsoftintr(MIPS_SOFT_INT_MASK_1)
#define clearsoftclock() _clrsoftintr(MIPS_SOFT_INT_MASK_0)
#define clearsoftnet() _clrsoftintr(MIPS_SOFT_INT_MASK_1)
#define splhigh() _splraise(MIPS_INT_MASK)
#define spl0() (void)_spllower(0)
#define splx(s) (void)_splset(s)
#define SPLSOFT MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1
#define SPLBIO SPLSOFT | MIPS_INT_MASK_4
2000-03-20 02:07:43 +03:00
#define SPLNET SPLBIO | MIPS_INT_MASK_1 | MIPS_INT_MASK_2
#define SPLTTY SPLNET | MIPS_INT_MASK_3
#define SPLCLOCK SPLTTY | MIPS_INT_MASK_0 | MIPS_INT_MASK_5
#define splbio() _splraise(SPLBIO)
#define splnet() _splraise(SPLNET)
#define spltty() _splraise(SPLTTY)
#define splclock() _splraise(SPLCLOCK)
#define splvm() splclock()
2000-03-20 02:07:43 +03:00
#define splstatclock() splclock()
#define splsoftclock() _splraise(MIPS_SOFT_INT_MASK_0)
#define splsoftnet() _splraise(MIPS_SOFT_INT_MASK_0|MIPS_SOFT_INT_MASK_1)
2000-03-31 18:51:49 +04:00
#define spllowersoftclock() _spllower(MIPS_SOFT_INT_MASK_0)
2000-03-20 02:07:43 +03:00
#define splsched() splhigh()
2000-08-22 23:46:26 +04:00
#define spllock() splhigh()
2000-03-20 02:07:43 +03:00
extern unsigned int intrcnt[];
#define SOFTCLOCK_INTR 0
2003-09-12 18:59:11 +04:00
#define SOFTNET_INTR 1
2000-03-20 02:07:43 +03:00
2000-03-31 18:51:49 +04:00
#endif /* !_LOCORE */
2000-03-20 02:07:43 +03:00
#endif /* _LOCORE */
2003-09-12 19:03:24 +04:00
#endif /* !_COBALT_INTR_H_ */