libdragon
|
N64 interrupt registering and servicing routines. More...
Files | |
file | interrupt.c |
Interrupt Controller. | |
file | interrupt.h |
Interrupt Controller. | |
Enumerations | |
enum | interrupt_state_t { INTERRUPTS_UNINITIALIZED , INTERRUPTS_DISABLED , INTERRUPTS_ENABLED } |
State of interrupts on the system. More... | |
N64 interrupt registering and servicing routines.
The N64 interrupt controller provides a software interface to register for interrupts from the various systems in the N64. Most interrupts on the N64 coordinate through the MIPS interface (MI) to allow interrupts to be handled at one spot. A notable exception is the timer interrupt which is generated by the MIPS r4300 itself and not the N64 hardware.
The interrupt controller is automatically initialized before main is called. By default, all interrupts are enabled and any registered callback can be called when an interrupt occurs. Each of the N64-generated interrupts is maskable using the various set accessors.
Interrupts can be enabled or disabled as a whole on the N64 using enable_interrupts and disable_interrupts. It is assumed that once the interrupt system is activated, these will always be called in pairs. Calling enable_interrupts without first calling disable_interrupts is considered a violation of this assumption and should be avoided. Calling disable_interrupts when interrupts are already disabled will have no effect interrupts-wise (but should be paired with a enable_interrupts regardless), and in that case the paired enable_interrupts will not enable interrupts either. In this manner, it is safe to nest calls to disable and enable interrupts.
enum interrupt_state_t |