Cortex-M4 Interrupt Controller HAL Implementation. More...

Macros | |
| #define | MAX_IRQ 128 |
| Maximum number of supported interrupts. | |
Functions | |
| int8_t | hal_enable_interrupt (IRQn_Type interrupt) |
| Enable a specific interrupt. | |
| int8_t | hal_disable_interrupt (IRQn_Type interrupt) |
| Disable a specific interrupt. | |
| void | hal_interrupt_attach_callback (IRQn_Type interrupt, void(*callback)(void)) |
| Attach a callback function to an interrupt. | |
| void | hal_interrupt_detach_callback (IRQn_Type interrupt) |
| Detach a callback function from an interrupt. | |
| void | hal_handle_interrupt (IRQn_Type interrupt) |
| Handle an interrupt by invoking its registered callback. | |
Cortex-M4 Interrupt Controller HAL Implementation.
This file provides interrupt management functions for Cortex-M4 based microcontrollers, including:
The implementation uses the NVIC (Nested Vectored Interrupt Controller) and provides a simple callback mechanism for interrupt handling.
| #define MAX_IRQ 128 |
Maximum number of supported interrupts.
| int8_t hal_disable_interrupt | ( | IRQn_Type | interrupt | ) |
Disable a specific interrupt.
| [in] | interrupt | Interrupt number to disable |
| SUCCESS | Interrupt disabled successfully |
| FAILURE | Invalid interrupt number (Cortex-M internal interrupt) |
Disables the specified interrupt in the NVIC by setting the corresponding bit in the ICER (Interrupt Clear Enable Register).
< Indicates failed operation.
< Indicates successful operation.
| int8_t hal_enable_interrupt | ( | IRQn_Type | interrupt | ) |
Enable a specific interrupt.
| [in] | interrupt | Interrupt number to enable |
| SUCCESS | Interrupt enabled successfully |
| FAILURE | Invalid interrupt number (Cortex-M internal interrupt) |
Enables the specified interrupt in the NVIC by setting the corresponding bit in the ISER (Interrupt Set Enable Register).
< Indicates failed operation.
< Indicates successful operation.
| void hal_handle_interrupt | ( | IRQn_Type | interrupt | ) |
Handle an interrupt by invoking its registered callback.
Central interrupt handler function.
| [in] | interrupt | Interrupt number to handle |
This function should be called from the actual interrupt service routine (ISR) to invoke the user-registered callback function. It performs bounds checking and NULL pointer verification before invoking the callback.
| void hal_interrupt_attach_callback | ( | IRQn_Type | interrupt, |
| void(* | callback )(void) ) |
Attach a callback function to an interrupt.
Attach a callback function to a specific interrupt.
| [in] | interrupt | Interrupt number to attach to |
| [in] | callback | Function pointer to be called when interrupt occurs |
Registers a callback function for the specified interrupt. The callback will be invoked when the interrupt occurs and is handled by hal_handle_interrupt().
| void hal_interrupt_detach_callback | ( | IRQn_Type | interrupt | ) |
Detach a callback function from an interrupt.
Detach a callback function from a specific interrupt.
| [in] | interrupt | Interrupt number to detach from |
Removes any previously registered callback for the specified interrupt.