PageRenderTime 20ms CodeModel.GetById 8ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/sys/intr.h

http://rtems-atapi.googlecode.com/
C++ Header | 95 lines | 39 code | 16 blank | 40 comment | 0 complexity | 56b0becfdeabbe5bee86aa65fcc4fabf MD5 | raw file
 1/*	$NetBSD: intr.h,v 1.9 2009/11/25 14:28:49 rmind Exp $	*/
 2
 3/*-
 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
 5 * All rights reserved.
 6 *
 7 * This code is derived from software contributed to The NetBSD Foundation
 8 * by Andrew Doran.
 9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _SYS_INTR_H_
33#define	_SYS_INTR_H_
34
35//#include <machine/intr.h>
36
37#ifdef _KERNEL
38
39struct cpu_info;
40
41/* Public interface. */
42void	*softint_establish(u_int, void (*)(void *), void *);
43void	softint_disestablish(void *);
44void	softint_schedule(void *);
45
46/* MI hooks. */
47void	softint_init(struct cpu_info *);
48lwp_t	*softint_picklwp(void);
49void	softint_overlay(void);
50void	softint_block(lwp_t *);
51
52/* MD-MI interface. */
53void	softint_init_md(lwp_t *, u_int, uintptr_t *);
54void	softint_trigger(uintptr_t);
55void	softint_dispatch(lwp_t *, int);
56
57/* Flags for softint_establish(). */
58#define	SOFTINT_BIO	0x0000
59#define	SOFTINT_CLOCK	0x0001
60#define	SOFTINT_SERIAL	0x0002
61#define	SOFTINT_NET	0x0003
62#define	SOFTINT_MPSAFE	0x0100
63
64/* Implementation private flags. */
65#define	SOFTINT_PENDING	0x1000
66#define	SOFTINT_ACTIVE	0x2000
67
68#define	SOFTINT_COUNT	0x0004
69#define	SOFTINT_LVLMASK	0x00ff
70#define	SOFTINT_IMPMASK	0xf000
71
72extern u_int	softint_timing;
73extern int	safepri;
74
75/*
76 * Historical aliases.  XXX Audio devices should run at
77 * IPL_SCHED, but they need to acquire kernel_lock.
78 */
79#define	IPL_BIO		IPL_VM
80#define	IPL_NET		IPL_VM
81#define	IPL_TTY		IPL_VM
82#define	IPL_AUDIO	IPL_VM
83#define	IPL_CLOCK	IPL_SCHED
84#define	IPL_SERIAL	IPL_HIGH
85
86#define	splbio()	splvm()
87//#define	splnet()	splvm()
88#define	spltty()	splvm()
89#define	splaudio()	splvm()
90#define	splclock()	splsched()
91#define	splserial()	splhigh()
92
93#endif	/* _KERNEL */
94
95#endif	/* _SYS_INTR_H_ */