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