intrenable, intrdisable – enable (disable) an interrupt handler
void intrenable(int v, void (*f)(Ureg*, void*), void* a, int tbdf, char *name)
void intrdisable(int v, void (*f)(Ureg*, void*), void* a, int tbdf, char *name)
to be called by the kernel’s interrupt controller driver each time
an interrupt denoted by
occurs, and unmasks the corresponding interrupt in the interrupt controller.
The encoding of
is platform-dependent; it is often an interrupt vector number, but
can be more complex.
is a platform-dependent value that might further qualify
It might for instance
denote the type of bus, bus instance, device number and function
(following the PCI device indexing scheme), hence its name,
but can have platform-dependent meaning.
is a string that should uniquely identify the corresponding device (eg, "uart0");
again it is usually platform-dependent.
supports sharing of interrupt levels when the hardware does.
is a function defined in a device driver to carry out the device-specific work associated with a given interrupt.
is passed to
typically it points to the driver’s data for a given device or controller.
It also passes
contains the registers saved by the interrupt handler (the
contents are platform specific;
see the platform’s include file
is invoked by underlying code in the kernel that is invoked directly from the hardware vectors.
It is therefore not running in any process (see
indeed, on many platforms
the current process pointer
will be nil.
There are many restrictions on kernel functions running outside a process, but a fundamental one is that
they must not
although they often call
to signal the occurrence of an event associated with the interrupt.
and other manual pages note which functions are safe for
The interrupt controller driver does whatever is
required to acknowledge or dismiss the interrupt signal in the interrupt controller,
for edge-triggered interrupts,
and after calling
for level-triggered ones.
is responsible for dealing with the cause of the interrupt in the device, including any
acknowledgement required in the device, before it returns.
removes any registration previously made by
with matching parameters, and if no other
interrupt is active on
it masks the interrupt in the controller.
Device drivers that are not dynamically configured tend to call
during reset or initialisation (see
but can call it at any appropriate time, and
instead of calling
they can simply enable or disable interrupts in the device as required.