xref: /netbsd-src/share/man/man9/man9.sun3/isr_add.9 (revision fdecd6a253f999ae92b139670d9e15cc9df4497c)
1.\"     $NetBSD: isr_add.9,v 1.2 1997/05/22 02:12:18 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.Nd establish interrupt handler
43.Sh SYNOPSIS
44.Fd #include <machine/autoconf.h>
45.Bd -literal
46
47typedef int (*isr_func_t)(void *);
48.Ed
49.Ft void
50.Fn isr_add_autovect "isr_func_t fun" "void *arg" "int level"
51.Ft void
52.Fn isr_add_vectored "isr_func_t fun" "void *arg" "int pri" "int vec"
53.Ft void
54.Fn isr_add_custom "int level" "void *fun"
55.Sh DESCRIPTION
56The
57.Nm
58functions establish interrupt handlers into the system interrupt dispatch table,
59typically called during the autoconfiguration process for a device.
60.Pp
61There are two types of interrupts in the Motorola 68000 architecture,
62which differ in the way that an interrupt request is mapped to a dispatch
63function within the interrupt vector table.
64.Pp
65When the CPU detects an asserted signal on one of its interrupt request lines,
66it stops normal instruction execution and begins an interrupt acknowledge
67sequence on the system bus.
68During this cycle the interrupting device directs how the CPU is to dispatch
69the interrupt request.
70.Pp
71If the interrupting device is sophisticated enough,
72it provides an 8-bit interrupt vector number to the CPU and a
73.Dq vectored
74interrupt occurs.
75This vector number points to a vector entry within the interrupt
76vector table to which instruction execution is immediately transfered.
77.Pp
78If the interrupting device cannot provide a vector number, it asserts a
79specialized bus line and an
80.Dq autovectored
81interrupt occurs.
82The vector number to use is determined by adding the interrupt priority (0-6)
83to an autovector base (typically 0x18).
84.Pp
85.Bl -tag -width isr_add_autovec
86.It Fn isr_add_autovect
87Adds the function
88.Fa fun
89to the list of interrupt handlers to be called during an autovectored interrupt
90of priority
91.Fa level .
92The pointer
93.Fa arg
94is passed to the function as its first argument.
95.It Fn isr_add_vectored
96Adds the function
97.Fa fun
98to the list of interrupt handlers to be called during a vectored interrupts of
99priority
100.Fa pri
101at dispatch vector number
102.Fa vec .
103The pointer
104.Fa arg
105is passed to the function as its first argument.
106.It Fn isr_add_custom
107Establish function
108.Fa fun
109as the interrupt handler for vector
110.Fa level .
111The autovector base number is automatically added to
112.Fa level .
113.Pp
114.Fa fun
115is called directly as the dispatch handler and must handle all of the specifics
116of saving the processor state and returning from a processor exception.
117These requirements generally dictate that
118.Fa fun
119be written in assembler.
120.El
121.Sh "CODE REFERENCES"
122.Fd src/sys/arch/sun3/sun3/isr.c
123.Sh "REFERENCES"
124MC68030 User's Manual, Third edition, MC68030UM/AD Rev 2, Motorola Inc.
125.Sh "BUGS"
126There is no way to remove a handler once it has been added.
127