ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_isr.h
Go to the documentation of this file.
1
62
63#pragma once
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#include <stdint.h>
70
71#include "ra8_elc_regs.h"
72#include "ra8_err.h"
73
74/* =============================================================================
75 * Constants
76 * =============================================================================
77 */
78
92typedef enum : uint16_t {
95
105typedef enum : uint8_t {
109
114typedef enum : uint16_t {
117
128typedef void (*ra8_isr_handler_t)(void* ctx);
129
130/* =============================================================================
131 * Lifecycle
132 * =============================================================================
133 */
134
154[[nodiscard]] ra8_err_t ra8_isr_init(void);
155
156/* =============================================================================
157 * Registration
158 * =============================================================================
159 */
160
205[[nodiscard]] ra8_err_t ra8_isr_register(ra8_elc_event_t event,
206 ra8_isr_handler_t handler,
207 void* ctx,
208 uint8_t priority,
209 uint16_t* out_slot);
210
228[[nodiscard]] ra8_err_t ra8_isr_unregister(ra8_elc_event_t event);
229
230/* =============================================================================
231 * Dispatch
232 * =============================================================================
233 */
234
260void ra8_isr_dispatch(uint16_t slot);
261
262/* =============================================================================
263 * Priority / enable shortcuts
264 * =============================================================================
265 */
266
281[[nodiscard]] ra8_err_t ra8_isr_set_priority(ra8_elc_event_t event, uint8_t priority);
282
300[[nodiscard]] ra8_err_t ra8_isr_lookup_slot(ra8_elc_event_t event, uint16_t* out_slot);
301
345[[nodiscard]] ra8_err_t ra8_isr_set_dtc(uint16_t slot, bool enable);
346
371void ra8_isr_globals_enable(void);
372
396void ra8_isr_globals_disable(void);
397
398#ifdef __cplusplus
399}
400#endif
Event Link Controller (ELC) register layout for the Renesas RA8D2.
ra8_elc_event_t
Partial list of ELC events (populate as drivers need them).
Error Code Definitions for ra8-firmware.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
void ra8_isr_globals_disable(void)
Globally mask maskable interrupts (PRIMASK = 1).
Definition ra8_isr.c:445
ra8_isr_invalid_slot_t
Sentinel for "no slot allocated".
Definition ra8_isr.h:114
@ k_ra8_isr_slot_none
RA8 ISR slot none.
Definition ra8_isr.h:115
void(* ra8_isr_handler_t)(void *ctx)
Driver-supplied callback invoked on interrupt entry.
Definition ra8_isr.h:128
ra8_isr_prio_t
Cortex-M85 NVIC priority range.
Definition ra8_isr.h:105
@ k_ra8_isr_prio_default
Middle priority.
Definition ra8_isr.h:107
@ k_ra8_isr_prio_max
Lowest priority.
Definition ra8_isr.h:106
ra8_err_t ra8_isr_init(void)
Initialise the ra8_isr table.
Definition ra8_isr.c:229
ra8_err_t ra8_isr_lookup_slot(ra8_elc_event_t event, uint16_t *out_slot)
Look up the slot allocated to a registered event.
Definition ra8_isr.c:408
ra8_err_t ra8_isr_set_dtc(uint16_t slot, bool enable)
Enable or disable DTC activation on a registered IELSR slot.
Definition ra8_isr.c:415
void ra8_isr_globals_enable(void)
Globally enable maskable interrupts (PRIMASK = 0).
Definition ra8_isr.c:439
ra8_err_t ra8_isr_register(ra8_elc_event_t event, ra8_isr_handler_t handler, void *ctx, uint8_t priority, uint16_t *out_slot)
Allocate an IELSR slot for an ELC event + handler.
Definition ra8_isr.c:296
ra8_err_t ra8_isr_set_priority(ra8_elc_event_t event, uint8_t priority)
Change the NVIC priority of a registered slot.
Definition ra8_isr.c:394
ra8_err_t ra8_isr_unregister(ra8_elc_event_t event)
Release a previously-allocated IELSR slot.
Definition ra8_isr.c:335
ra8_isr_slot_count_t
Size of the ISR allocator's slot pool – one slot per ICU IELSR route.
Definition ra8_isr.h:92
@ k_ra8_isr_slot_count
One slot per ICU IELSR route (= k_ra8_icu_num_ielsr).
Definition ra8_isr.h:93
void ra8_isr_dispatch(uint16_t slot)
Invoke the handler stored in dispatch-table slot slot.
Definition ra8_isr.c:362