intr.h revision 1.7
11.7Sad/*	$NetBSD: intr.h,v 1.7 2007/02/09 21:55:07 ad Exp $	*/
21.5Such
31.5Such/*-
41.5Such * Copyright (c) 2002 The NetBSD Foundation, Inc.
51.5Such * All rights reserved.
61.5Such *
71.5Such * Redistribution and use in source and binary forms, with or without
81.5Such * modification, are permitted provided that the following conditions
91.5Such * are met:
101.5Such * 1. Redistributions of source code must retain the above copyright
111.5Such *    notice, this list of conditions and the following disclaimer.
121.5Such * 2. Redistributions in binary form must reproduce the above copyright
131.5Such *    notice, this list of conditions and the following disclaimer in the
141.5Such *    documentation and/or other materials provided with the distribution.
151.5Such * 3. All advertising materials mentioning features or use of this software
161.5Such *    must display the following acknowledgement:
171.5Such *        This product includes software developed by the NetBSD
181.5Such *        Foundation, Inc. and its contributors.
191.5Such * 4. Neither the name of The NetBSD Foundation nor the names of its
201.5Such *    contributors may be used to endorse or promote products derived
211.5Such *    from this software without specific prior written permission.
221.5Such *
231.5Such * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
241.5Such * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
251.5Such * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
261.5Such * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
271.5Such * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
281.5Such * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
291.5Such * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
301.5Such * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
311.5Such * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
321.5Such * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
331.5Such * POSSIBILITY OF SUCH DAMAGE.
341.5Such */
351.1Sitojun
361.2Smsaitoh#ifndef _MMEYE_INTR_H_
371.2Smsaitoh#define _MMEYE_INTR_H_
381.3Smsaitoh
391.1Sitojun#include <sh3/intr.h>
401.1Sitojun
411.5Such/*
421.5Such * Number of interrupt source
431.5Such * TMU0, TMU1, TMU2
441.5Such * MMEYE(com * 2 + mmeyepcmcia(controller + card) * 2)
451.5Such */
461.5Such#define _INTR_N		9
471.5Such
481.5Such/* Interrupt priority levels */
491.5Such#define	IPL_BIO		9	/* block I/O */
501.5Such#define	IPL_NET		11	/* network */
511.5Such#define	IPL_TTY		12	/* terminal */
521.6Syamt#define	IPL_VM		IPL_TTY
531.5Such#define	IPL_SERIAL	12	/* serial */
541.5Such#define	IPL_CLOCK	14	/* clock */
551.6Syamt#define	IPL_STATCLOCK	IPL_CLOCK
561.6Syamt#define	IPL_SCHED	IPL_CLOCK
571.5Such#define	IPL_HIGH	15	/* everything */
581.6Syamt#define	IPL_LOCK	IPL_HIGH
591.5Such
601.7Sadtypedef uint8_t ipl_t;
611.6Syamttypedef struct {
621.6Syamt	ipl_t _ipl;
631.6Syamt} ipl_cookie_t;
641.6Syamt
651.6Syamtstatic inline ipl_cookie_t
661.6Syamtmakeiplcookie(ipl_t ipl)
671.6Syamt{
681.6Syamt
691.6Syamt	return (ipl_cookie_t){._ipl = ipl << 4};
701.6Syamt}
711.6Syamt
721.6Syamtstatic inline int
731.6Syamtsplraiseipl(ipl_cookie_t icookie)
741.6Syamt{
751.6Syamt
761.6Syamt	return _cpu_intr_raise(icookie._ipl);
771.6Syamt}
781.6Syamt
791.6Syamt#include <sys/spl.h>
801.1Sitojun
811.5Such#define	spl0()			_cpu_intr_resume(0)
821.5Such#define	splx(x)			_cpu_intr_resume(x)
831.2Smsaitoh
841.5Such#define	spllowersoftclock()	_cpu_intr_resume(IPL_SOFTCLOCK << 4)
851.2Smsaitoh
861.5Such#endif /* !_MMEYE_INTR_H_ */
87