NetBSD/share/man/man9/man9.sun3/isr_add.9

132 lines
4.7 KiB
Groff

.\" $NetBSD: isr_add.9,v 1.8 2003/04/16 13:35:37 wiz Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Jeremy Cooper.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the NetBSD
.\" Foundation, Inc. and its contributors.
.\" 4. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd May 21, 1997
.Dt ISR_ADD 9 sun3
.Os
.Sh NAME
.Nm isr_add ,
.Nm isr_add_autovect ,
.Nm isr_add_vectored ,
.Nm isr_add_custom
.Nd establish interrupt handler
.Sh SYNOPSIS
.In sun3/autoconf.h
.Bd -literal
typedef int (*isr_func_t)(void *);
.Ed
.Ft void
.Fn isr_add_autovect "isr_func_t fun" "void *arg" "int level"
.Ft void
.Fn isr_add_vectored "isr_func_t fun" "void *arg" "int pri" "int vec"
.Ft void
.Fn isr_add_custom "int level" "void *fun"
.Sh DESCRIPTION
The
.Nm
functions establish interrupt handlers into the system interrupt dispatch table
and are typically called from device drivers during the autoconfiguration
process.
.Pp
There are two types of interrupts in the Motorola 68000 architecture,
which differ in the way that an interrupt request is mapped to a dispatch
function within the interrupt vector table.
.Pp
When the CPU detects an asserted signal on one of its interrupt request lines,
it suspends normal instruction execution and begins an interrupt acknowledge
cycle on the system bus.
During this cycle the interrupting device directs how the CPU is to dispatch
its interrupt request.
.Pp
If the interrupting device is integrated tightly with the system bus,
it provides an 8-bit interrupt vector number to the CPU and a
.Sy vectored
interrupt occurs.
This vector number points to a vector entry within the interrupt
vector table to which instruction execution is immediately transfered.
.Pp
If the interrupting device cannot provide a vector number,
it asserts a specialized bus line and an
.Sy autovectored
interrupt occurs.
The vector number to use is determined by adding the interrupt priority
.Pq 0\(en6
to an autovector base
.Pq typically Li 18 hexadecimal .
.Pp
.Bl -tag -width isr_add_autovec
.It Fn isr_add_autovect
Adds the function
.Fa fun
to the list of interrupt handlers to be called during an autovectored interrupt
of priority
.Fa level .
The pointer
.Fa arg
is passed to the function as its first argument.
.It Fn isr_add_vectored
Adds the function
.Fa fun
to the list of interrupt handlers to be called during a vectored interrupts of
priority
.Fa pri
at dispatch vector number
.Fa vec .
The pointer
.Fa arg
is passed to the function as its first argument.
.It Fn isr_add_custom
Establish function
.Fa fun
as the interrupt handler for vector
.Fa level .
The autovector base number is automatically added to
.Fa level .
.Pp
.Fa fun
is called directly as the dispatch handler and must handle all of the specifics
of saving the processor state and returning from a processor exception.
These requirements generally dictate that
.Fa fun
be written in assembler.
.El
.Sh CODE REFERENCES
.Pa sys/arch/sun3/sun3/isr.c
.Sh REFERENCES
MC68030 User's Manual, Third edition, MC68030UM/AD Rev 2, Motorola Inc.
.Sh BUGS
There is no way to remove a handler once it has been added.