Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.15
      1 /*	$NetBSD: intr.h,v 1.15 2007/03/21 10:56:27 tsutsui Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *        This product includes software developed by the NetBSD
     18  *        Foundation, Inc. and its contributors.
     19  * 4. Neither the name of The NetBSD Foundation nor the names of its
     20  *    contributors may be used to endorse or promote products derived
     21  *    from this software without specific prior written permission.
     22  *
     23  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     24  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     27  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33  * POSSIBILITY OF SUCH DAMAGE.
     34  */
     35 
     36 #ifndef _ATARI_INTR_H_
     37 #define _ATARI_INTR_H_
     38 
     39 #define	IPL_NONE	0		    /* disable no interrupts	    */
     40 #define	IPL_SOFTCLOCK	1
     41 #define	IPL_SOFTNET	2
     42 #define	IPL_SOFTSERIAL	3
     43 #define	IPL_SOFT	4
     44 #define	IPL_BIO		5		    /* disable block I/O interrupts */
     45 #define	IPL_NET		6		    /* disable network interrupts   */
     46 #define	IPL_TTY		7		    /* disable terminal interrupts  */
     47 #define	IPL_LPT		IPL_TTY
     48 #define	IPL_VM		8
     49 #define	IPL_SERIAL	9
     50 #define	IPL_CLOCK	10		    /* disable clock interrupts	    */
     51 #define	IPL_STATCLOCK	IPL_CLOCK
     52 #define	IPL_HIGH	11		    /* disable all interrupts	    */
     53 #define	IPL_SCHED	IPL_HIGH
     54 #define	IPL_LOCK	IPL_HIGH
     55 #define	NIPL		12
     56 
     57 #define	IST_UNUSABLE	-1	/* interrupt cannot be used	*/
     58 #define	IST_NONE	0	/* none (dummy)			*/
     59 #define	IST_PULSE	1	/* pulsed			*/
     60 #define	IST_EDGE	2	/* edge-triggered		*/
     61 #define	IST_LEVEL	3	/* level-triggered		*/
     62 
     63 /*
     64  * spl functions; all but spl0 are done in-line
     65  */
     66 #include <machine/psl.h>
     67 
     68 /* spl0 requires checking for software interrupts */
     69 
     70 #define splnone()		spl0()
     71 
     72 #define splsoft()		splraise1()
     73 #define splsoftclock()		splsoft()
     74 #define splsoftnet()		splsoft()
     75 #define splsoftserial()		splsoft()
     76 
     77 #define splbio()		splraise3()
     78 #define splnet()		splraise3()
     79 #define spltty()		splraise4()
     80 #define splvm()			splraise4()
     81 
     82 #define spllpt()		spltty()
     83 
     84 #define splclock()		splraise6()
     85 #define splstatclock()		splraise6()
     86 #define splhigh()		spl7()
     87 #define splsched()		spl7()
     88 #define spllock()		spl7()
     89 
     90 #define splx(s)			((s) & PSL_IPL ? _spl(s) : spl0())
     91 
     92 #ifdef _KERNEL
     93 int spl0 __P((void));
     94 
     95 typedef int ipl_t;
     96 typedef struct {
     97 	uint16_t _psl;
     98 } ipl_cookie_t;
     99 
    100 ipl_cookie_t makeiplcookie(ipl_t);
    101 
    102 static inline int
    103 splraiseipl(ipl_cookie_t icookie)
    104 {
    105 
    106 	return _splraise(icookie._psl);
    107 }
    108 
    109 #include <m68k/softintr.h>
    110 
    111 #endif /* _KERNEL */
    112 
    113 #endif /* _ATARI_INTR_H_ */
    114