isr.h revision 1.1 1 1.1 nisimura /* $NetBSD: isr.h,v 1.1 2000/01/05 08:49:04 nisimura Exp $ */
2 1.1 nisimura
3 1.1 nisimura /*-
4 1.1 nisimura * Copyright (c) 1996 The NetBSD Foundation, Inc.
5 1.1 nisimura * All rights reserved.
6 1.1 nisimura *
7 1.1 nisimura * This code is derived from software contributed to The NetBSD Foundation
8 1.1 nisimura * by Jason R. Thorpe.
9 1.1 nisimura *
10 1.1 nisimura * Redistribution and use in source and binary forms, with or without
11 1.1 nisimura * modification, are permitted provided that the following conditions
12 1.1 nisimura * are met:
13 1.1 nisimura * 1. Redistributions of source code must retain the above copyright
14 1.1 nisimura * notice, this list of conditions and the following disclaimer.
15 1.1 nisimura * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 nisimura * notice, this list of conditions and the following disclaimer in the
17 1.1 nisimura * documentation and/or other materials provided with the distribution.
18 1.1 nisimura * 3. All advertising materials mentioning features or use of this software
19 1.1 nisimura * must display the following acknowledgement:
20 1.1 nisimura * This product includes software developed by the NetBSD
21 1.1 nisimura * Foundation, Inc. and its contributors.
22 1.1 nisimura * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 nisimura * contributors may be used to endorse or promote products derived
24 1.1 nisimura * from this software without specific prior written permission.
25 1.1 nisimura *
26 1.1 nisimura * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 nisimura * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 nisimura * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 nisimura * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 nisimura * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 nisimura * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 nisimura * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 nisimura * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 nisimura * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 nisimura * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 nisimura * POSSIBILITY OF SUCH DAMAGE.
37 1.1 nisimura */
38 1.1 nisimura
39 1.1 nisimura #include <sys/queue.h>
40 1.1 nisimura
41 1.1 nisimura /*
42 1.1 nisimura * The location and size of the autovectored interrupt portion
43 1.1 nisimura * of the vector table.
44 1.1 nisimura */
45 1.1 nisimura #define ISRAUTOVEC 0x18
46 1.1 nisimura #define NISRAUTOVEC 8
47 1.1 nisimura
48 1.1 nisimura /*
49 1.1 nisimura * The location and size of the vectored interrupt portion
50 1.1 nisimura * of the vector table.
51 1.1 nisimura */
52 1.1 nisimura #define ISRVECTORED 0x40
53 1.1 nisimura #define NISRVECTORED 192
54 1.1 nisimura
55 1.1 nisimura /*
56 1.1 nisimura * Autovectored interupt handler cookie.
57 1.1 nisimura */
58 1.1 nisimura struct isr_autovec {
59 1.1 nisimura LIST_ENTRY(isr_autovec) isr_link;
60 1.1 nisimura int (*isr_func) __P((void *));
61 1.1 nisimura void *isr_arg;
62 1.1 nisimura int isr_ipl;
63 1.1 nisimura int isr_priority;
64 1.1 nisimura };
65 1.1 nisimura
66 1.1 nisimura typedef LIST_HEAD(, isr_autovec) isr_autovec_list_t;
67 1.1 nisimura
68 1.1 nisimura /*
69 1.1 nisimura * Vectored interrupt handler cookie. The handler may request to
70 1.1 nisimura * receive the exception frame as an argument by specifying NULL
71 1.1 nisimura * when establishing the interrupt.
72 1.1 nisimura */
73 1.1 nisimura struct isr_vectored {
74 1.1 nisimura int (*isr_func) __P((void *));
75 1.1 nisimura void *isr_arg;
76 1.1 nisimura int isr_ipl;
77 1.1 nisimura };
78 1.1 nisimura
79 1.1 nisimura /*
80 1.1 nisimura * Autovectored ISR priorities. These are not the same as interrupt levels.
81 1.1 nisimura */
82 1.1 nisimura #define ISRPRI_BIO 0
83 1.1 nisimura #define ISRPRI_NET 1
84 1.1 nisimura #define ISRPRI_TTY 2
85 1.1 nisimura #define ISRPRI_TTYNOBUF 3
86 1.1 nisimura
87 1.1 nisimura void isrinit __P((void));
88 1.1 nisimura void isrlink_autovec __P((int (*)(void *), void *, int, int));
89 1.1 nisimura void isrlink_vectored __P((int (*)(void *), void *, int, int));
90 1.1 nisimura void isrunlink_vectored __P((int));
91 1.1 nisimura void isrdispatch_autovec __P((int));
92 1.1 nisimura void isrdispatch_vectored __P((int, int, void *));
93