xref: /netbsd-src/share/man/man9/man9.sun3/isr_add.9 (revision 481fca6e59249d8ffcf24fef7cfbe7b131bfb080)
1.\"     $NetBSD: isr_add.9,v 1.4 1998/09/03 01:54:28 jeremy Exp $
2.\"
3.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Jeremy Cooper.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE
29.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd May 21, 1997
38.Dt ISR_ADD 9 sun3
39.Os NetBSD
40.Sh NAME
41.Nm isr_add ,
42.Nm isr_add_autovect ,
43.Nm isr_add_vectored ,
44.Nm isr_add_custom
45.Nd establish interrupt handler
46.Sh SYNOPSIS
47.Fd #include <sun3/autoconf.h>
48.Bd -literal
49
50typedef int (*isr_func_t)(void *);
51.Ed
52.Ft void
53.Fn isr_add_autovect "isr_func_t fun" "void *arg" "int level"
54.Ft void
55.Fn isr_add_vectored "isr_func_t fun" "void *arg" "int pri" "int vec"
56.Ft void
57.Fn isr_add_custom "int level" "void *fun"
58.Sh DESCRIPTION
59The
60.Nm
61functions establish interrupt handlers into the system interrupt dispatch table
62and are typically called from device drivers during the autoconfiguration
63process.
64.Pp
65There are two types of interrupts in the Motorola 68000 architecture,
66which differ in the way that an interrupt request is mapped to a dispatch
67function within the interrupt vector table.
68.Pp
69When the CPU detects an asserted signal on one of its interrupt request lines,
70it suspends normal instruction execution and begins an interrupt acknowledge
71cycle on the system bus.
72During this cycle the interrupting device directs how the CPU is to dispatch
73its interrupt request.
74.Pp
75If the interrupting device is integrated tightly with the system bus,
76it provides an 8-bit interrupt vector number to the CPU and a
77.Sy vectored
78interrupt occurs.
79This vector number points to a vector entry within the interrupt
80vector table to which instruction execution is immediately transfered.
81.Pp
82If the interrupting device cannot provide a vector number,
83it asserts a specialized bus line and an
84.Sy autovectored
85interrupt occurs.
86The vector number to use is determined by adding the interrupt priority
87.Pq 0\(en6
88to an autovector base
89.Pq typically Li 18 hexadecimal .
90.Pp
91.Bl -tag -width isr_add_autovec
92.It Fn isr_add_autovect
93Adds the function
94.Fa fun
95to the list of interrupt handlers to be called during an autovectored interrupt
96of priority
97.Fa level .
98The pointer
99.Fa arg
100is passed to the function as its first argument.
101.It Fn isr_add_vectored
102Adds the function
103.Fa fun
104to the list of interrupt handlers to be called during a vectored interrupts of
105priority
106.Fa pri
107at dispatch vector number
108.Fa vec .
109The pointer
110.Fa arg
111is passed to the function as its first argument.
112.It Fn isr_add_custom
113Establish function
114.Fa fun
115as the interrupt handler for vector
116.Fa level .
117The autovector base number is automatically added to
118.Fa level .
119.Pp
120.Fa fun
121is called directly as the dispatch handler and must handle all of the specifics
122of saving the processor state and returning from a processor exception.
123These requirements generally dictate that
124.Fa fun
125be written in assembler.
126.El
127.Sh "CODE REFERENCES"
128.Pa sys/arch/sun3/sun3/isr.c
129.Sh "REFERENCES"
130MC68030 User's Manual, Third edition, MC68030UM/AD Rev 2, Motorola Inc.
131.Sh "BUGS"
132There is no way to remove a handler once it has been added.
133