Expand description
§Interrupt support
This module contains code to configure and handle peripheral interrupts.
§Overview
Peripheral interrupt requests are not handled by the CPU directly. Instead, they are routed through the interrupt matrix, which maps peripheral interrupts to CPU interrupts. There are more peripheral interrupt signals than CPU interrupts, and multiple peripheral interrupts can be routed to the same CPU interrupt. A set of CPU interrupts are configured to run a default handler routine, which polls the interrupt controller and calls the appropriate handlers for the pending peripheral interrupts.
This default handler implements interrupt nesting - meaning a higher Priority interrupt can
preempt a lower priority interrupt handler. The number of priorities is a chip-specific detail.
§Usage
Peripheral drivers manage interrupts for you. Where appropriate, a set_interrupt_handler
function is provided, which allows you to register a function to handle interrupts at a priority
level of your choosing. Interrupt handler functions need to be marked by the [#[handler]]
attribute. These drivers also provide listen and unlisten functions that control whether an
interrupt will be generated for the matching event or not. For more information and examples,
consult the documentation of the specific peripheral drivers.
If you are writing your own peripheral driver, you will need to first register interrupt
handlers using the [peripheral singletons’] bind_X_interrupt functions. You can use the
matching enable and disable functions to control the peripheral interrupt in the interrupt
matrix, or you can, depending on the peripheral, set or clear the appropriate enable bits in the
int_ena register.
[#[handler]]: crate::handler
[peripheral singletons’]: crate::peripherals::I2C0
§Software interrupts
The software module implements software interrupts using peripheral interrupt signals.
Modules§
- software
unstable - Software Interrupts
Structs§
- Interrupt
Handler unstable - An interrupt handler
- Interrupt
Status unstable - Representation of peripheral-interrupt status bits.
- Interrupt
Status Iterator unstable - Iterator over set interrupt status bits
- IsrCallback
unstable - Represents an ISR callback function
- Trap
Frame unstable - Registers saved in trap handler
Enums§
- CpuInterrupt
unstable - Enumeration of available CPU interrupts.
- Direct
Bindable CpuInterrupt - Enumeration of CPU interrupts available for direct binding.
- Elevated
RunLevel - Interrupt run levels.
- Interrupt
Kind unstable - Interrupt kind
- Priority
- Interrupt priority levels.
- Priority
Error unstable - Priority Level Error
- RunLevel
- Represents the priority level of running code.
Constants§
- DEFAULT_
INTERRUPT_ HANDLER unstable - Default (unhandled) interrupt handler
Traits§
- Interrupt
Configurable unstable - Trait implemented by drivers which allow the user to set an InterruptHandler
Functions§
- bind_
handler unstable - Binds the given handler to a peripheral interrupt.
- bound_
handler unstable - Returns the currently bound interrupt handler.
- disable
unstable - Disable the given peripheral interrupt.
- enable
unstable - Enables a peripheral interrupt at a given priority, using vectored CPU interrupts.
- enable_
direct unstable - Enable an interrupt by directly binding it to an available CPU interrupt
- wait_
for_ interrupt unstable - Wait for an interrupt to occur.