Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.12.2.1
      1  1.12.2.1    skrll /*	$NetBSD: intr.h,v 1.12.2.1 2004/08/03 10:33:46 skrll 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.12.2.1    skrll #ifndef	_COBALT_INTR_H_
     29  1.12.2.1    skrll #define	_COBALT_INTR_H_
     30  1.12.2.1    skrll 
     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.2.1    skrll #define	IPL_SERIAL	3	/* Disable serial hardware interrupts. */
     36      1.12  thorpej #define	IPL_VM		4	/* Memory allocation */
     37       1.3    soren #define	IPL_CLOCK	5	/* Disable clock interrupts. */
     38       1.3    soren #define	IPL_STATCLOCK	6	/* Disable profiling interrupts. */
     39       1.3    soren #define	IPL_HIGH	7	/* Disable all interrupts. */
     40       1.3    soren #define NIPL		8
     41       1.1    soren 
     42       1.1    soren /* Interrupt sharing types. */
     43       1.1    soren #define IST_NONE	0	/* none */
     44       1.1    soren #define IST_PULSE	1	/* pulsed */
     45       1.1    soren #define IST_EDGE	2	/* edge-triggered */
     46       1.1    soren #define IST_LEVEL	3	/* level-triggered */
     47       1.1    soren 
     48  1.12.2.1    skrll /* Soft interrupt numbers. */
     49  1.12.2.1    skrll #define	IPL_SOFT	0	/* generic software interrupts */
     50  1.12.2.1    skrll #define	IPL_SOFTSERIAL	1	/* serial software interrupts */
     51  1.12.2.1    skrll #define	IPL_SOFTNET	2	/* network software interrupts */
     52  1.12.2.1    skrll #define	IPL_SOFTCLOCK	3	/* clock software interrupts */
     53  1.12.2.1    skrll #define	_IPL_NSOFT	4
     54  1.12.2.1    skrll 
     55  1.12.2.1    skrll #define	IPL_SOFTNAMES {							\
     56  1.12.2.1    skrll 	"misc",								\
     57  1.12.2.1    skrll 	"serial",							\
     58  1.12.2.1    skrll 	"net",								\
     59  1.12.2.1    skrll 	"clock",							\
     60  1.12.2.1    skrll }
     61       1.5    soren 
     62       1.3    soren #ifdef _KERNEL
     63       1.1    soren #ifndef _LOCORE
     64       1.5    soren 
     65       1.5    soren #include <mips/cpuregs.h>
     66       1.1    soren 
     67       1.1    soren extern int		_splraise(int);
     68  1.12.2.1    skrll extern int		_spllower(int);
     69       1.1    soren extern int		_splset(int);
     70       1.1    soren extern int		_splget(void);
     71       1.1    soren extern void		_splnone(void);
     72       1.1    soren extern void		_setsoftintr(int);
     73       1.1    soren extern void		_clrsoftintr(int);
     74       1.1    soren 
     75       1.1    soren #define splhigh()       _splraise(MIPS_INT_MASK)
     76       1.1    soren #define spl0()          (void)_spllower(0)
     77       1.1    soren #define splx(s)         (void)_splset(s)
     78  1.12.2.1    skrll #define SPLSOFT		(MIPS_SOFT_INT_MASK_0 | MIPS_SOFT_INT_MASK_1)
     79  1.12.2.1    skrll #define SPLBIO		(SPLSOFT | MIPS_INT_MASK_4)
     80  1.12.2.1    skrll #define SPLNET		(SPLBIO | MIPS_INT_MASK_1 | MIPS_INT_MASK_2)
     81  1.12.2.1    skrll #define SPLTTY		(SPLNET | MIPS_INT_MASK_3)
     82  1.12.2.1    skrll #define SPLCLOCK	(SPLTTY | MIPS_INT_MASK_0 | MIPS_INT_MASK_5)
     83  1.12.2.1    skrll #define splbio()	_splraise(SPLBIO)
     84  1.12.2.1    skrll #define splnet()	_splraise(SPLNET)
     85  1.12.2.1    skrll #define spltty()	_splraise(SPLTTY)
     86  1.12.2.1    skrll #define splserial()	_splraise(SPLTTY)
     87  1.12.2.1    skrll #define splclock()	_splraise(SPLCLOCK)
     88       1.9  thorpej #define splvm()		splclock()
     89  1.12.2.1    skrll #define splstatclock()	splclock()
     90       1.3    soren #define spllowersoftclock() _spllower(MIPS_SOFT_INT_MASK_0)
     91       1.7  thorpej 
     92       1.7  thorpej #define	splsched()	splhigh()
     93       1.8  thorpej #define	spllock()	splhigh()
     94       1.1    soren 
     95  1.12.2.1    skrll #define splsoft()	_splraise(MIPS_SOFT_INT_MASK_0)
     96  1.12.2.1    skrll #define splsoftclock()	_splraise(MIPS_SOFT_INT_MASK_0)
     97  1.12.2.1    skrll #define splsoftnet()	_splraise(MIPS_SOFT_INT_MASK_0|MIPS_SOFT_INT_MASK_1)
     98  1.12.2.1    skrll #define splsoftserial()	_splraise(MIPS_SOFT_INT_MASK_0|MIPS_SOFT_INT_MASK_1)
     99  1.12.2.1    skrll 
    100       1.1    soren extern unsigned int	intrcnt[];
    101  1.12.2.1    skrll 
    102  1.12.2.1    skrll struct cobalt_intrhand {
    103  1.12.2.1    skrll 	LIST_ENTRY(cobalt_intrhand) ih_q;
    104  1.12.2.1    skrll 	int (*ih_func)(void *);
    105  1.12.2.1    skrll 	void *ih_arg;
    106  1.12.2.1    skrll 	int cookie_type;
    107  1.12.2.1    skrll #define	COBALT_COOKIE_TYPE_CPU	0x1
    108  1.12.2.1    skrll #define	COBALT_COOKIE_TYPE_ICU	0x2
    109  1.12.2.1    skrll };
    110  1.12.2.1    skrll 
    111  1.12.2.1    skrll #include <mips/softintr.h>
    112  1.12.2.1    skrll 
    113  1.12.2.1    skrll void *cpu_intr_establish(int, int, int (*)(void *), void *);
    114  1.12.2.1    skrll void *icu_intr_establish(int, int, int, int (*)(void *), void *);
    115  1.12.2.1    skrll void cpu_intr_disestablish(void *);
    116  1.12.2.1    skrll void icu_intr_disestablish(void *);
    117       1.1    soren 
    118       1.3    soren #endif /* !_LOCORE */
    119       1.1    soren #endif /* _LOCORE */
    120  1.12.2.1    skrll 
    121  1.12.2.1    skrll #endif	/* !_COBALT_INTR_H_ */
    122