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