Home | History | Annotate | Line # | Download | only in include
intr.h revision 1.19
      1  1.19  thorpej /*	$NetBSD: intr.h,v 1.19 2007/03/11 05:22:25 thorpej Exp $	*/
      2   1.1      dbj 
      3   1.1      dbj /*
      4   1.1      dbj  * Copyright (C) 1997 Scott Reynolds
      5   1.1      dbj  * Copyright (C) 1998 Darrin Jewell
      6   1.1      dbj  * All rights reserved.
      7   1.1      dbj  *
      8   1.1      dbj  * Redistribution and use in source and binary forms, with or without
      9   1.1      dbj  * modification, are permitted provided that the following conditions
     10   1.1      dbj  * are met:
     11   1.1      dbj  * 1. Redistributions of source code must retain the above copyright
     12   1.1      dbj  *    notice, this list of conditions and the following disclaimer.
     13   1.1      dbj  * 2. Redistributions in binary form must reproduce the above copyright
     14   1.1      dbj  *    notice, this list of conditions and the following disclaimer in the
     15   1.1      dbj  *    documentation and/or other materials provided with the distribution.
     16   1.1      dbj  * 3. The name of the author may not be used to endorse or promote products
     17   1.1      dbj  *    derived from this software without specific prior written permission.
     18   1.1      dbj  *
     19   1.1      dbj  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20   1.1      dbj  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21   1.1      dbj  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22   1.1      dbj  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23   1.1      dbj  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24   1.1      dbj  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25   1.1      dbj  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26   1.1      dbj  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27   1.1      dbj  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28   1.1      dbj  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29   1.1      dbj  */
     30   1.1      dbj 
     31   1.1      dbj #ifndef _NEXT68K_INTR_H_
     32   1.1      dbj #define _NEXT68K_INTR_H_
     33   1.1      dbj 
     34   1.1      dbj #include <machine/psl.h>
     35   1.1      dbj 
     36   1.1      dbj /* Probably want to dealwith IPL's here @@@ */
     37   1.1      dbj 
     38   1.1      dbj #ifdef _KERNEL
     39   1.1      dbj 
     40   1.1      dbj /* spl0 requires checking for software interrupts */
     41   1.1      dbj 
     42   1.1      dbj /* watch out for side effects */
     43   1.1      dbj #define splx(s)         ((s) & PSL_IPL ? _spl(s) : spl0())
     44   1.1      dbj 
     45  1.18  tsutsui #define splsoft()	splraise1()
     46  1.18  tsutsui #define splsoftnet()    splsoft()
     47  1.18  tsutsui #define splsoftclock()	splsoft()
     48  1.18  tsutsui #define splsoftserial()	splsoft()
     49  1.18  tsutsui #define splbio()        splraise3()
     50  1.18  tsutsui #define splnet()        splraise3()
     51  1.18  tsutsui #define spltty()        splraise3()
     52  1.18  tsutsui #define splserial()     splraise5()
     53  1.18  tsutsui #define splvm()         splraise6()
     54  1.18  tsutsui #define splclock()      splraise3()	/* ??? */
     55  1.18  tsutsui #define splstatclock()  splclock()
     56  1.18  tsutsui #define splhigh()       spl7()
     57  1.18  tsutsui #define splsched()      spl7()
     58  1.18  tsutsui #define spllock()       spl7()
     59  1.18  tsutsui 
     60  1.18  tsutsui #define spldma()        splraise6()
     61  1.18  tsutsui 
     62   1.1      dbj /****************************************************************/
     63   1.1      dbj 
     64  1.18  tsutsui #define	IPL_NONE	0
     65  1.18  tsutsui #define	IPL_SOFTCLOCK	1
     66  1.18  tsutsui #define	IPL_SOFTNET	2
     67  1.18  tsutsui #define	IPL_SOFTSERIAL	3
     68  1.18  tsutsui #define	IPL_SOFT	4
     69  1.18  tsutsui #define	IPL_BIO		5
     70  1.18  tsutsui #define	IPL_NET		6
     71  1.18  tsutsui #define	IPL_TTY		7
     72  1.18  tsutsui #define	IPL_SERIAL	8
     73  1.18  tsutsui #define	IPL_VM		9
     74  1.18  tsutsui #define	IPL_CLOCK	10
     75  1.16     yamt #define	IPL_STATCLOCK	IPL_CLOCK
     76  1.18  tsutsui #define	IPL_HIGH	11
     77  1.18  tsutsui #define	IPL_LOCK	IPL_HIGH
     78  1.18  tsutsui #define	IPL_SCHED	IPL_HIGH
     79  1.18  tsutsui #define	NIPL		12
     80  1.16     yamt 
     81  1.16     yamt typedef int ipl_t;
     82  1.16     yamt typedef struct {
     83  1.19  thorpej 	uint16_t _psl;
     84  1.16     yamt } ipl_cookie_t;
     85  1.16     yamt 
     86  1.18  tsutsui extern const int ipl2psl_table[NIPL];
     87  1.16     yamt 
     88  1.18  tsutsui ipl_cookie_t makeiplcookie(ipl_t);
     89  1.16     yamt 
     90  1.16     yamt static inline int
     91  1.16     yamt splraiseipl(ipl_cookie_t icookie)
     92  1.16     yamt {
     93  1.16     yamt 
     94  1.18  tsutsui 	return _splraise(icookie._psl);
     95  1.16     yamt }
     96  1.16     yamt 
     97   1.1      dbj /****************************************************************/
     98   1.1      dbj 
     99   1.1      dbj /* locore.s */
    100  1.12      chs int	spl0(void);
    101  1.11  mycroft 
    102  1.11  mycroft extern volatile u_long *intrstat;
    103  1.11  mycroft extern volatile u_long *intrmask;
    104  1.11  mycroft #define INTR_SETMASK(x)		(*intrmask = (x))
    105  1.11  mycroft #define INTR_ENABLE(x)		(*intrmask |= NEXT_I_BIT(x))
    106  1.11  mycroft #define INTR_DISABLE(x)		(*intrmask &= (~NEXT_I_BIT(x)))
    107  1.11  mycroft #define INTR_OCCURRED(x)	(*intrstat & NEXT_I_BIT(x))
    108  1.11  mycroft 
    109  1.18  tsutsui #include <m68k/softintr.h>
    110  1.18  tsutsui 
    111   1.1      dbj #endif /* _KERNEL */
    112   1.1      dbj 
    113   1.1      dbj #endif /* _NEXT68K_INTR_H_ */
    114