|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Interrupt Control Unit driver (IRQ pins, NMI). More...
Go to the source code of this file.
Data Structures | |
| struct | ra8_icu_irq_cfg_t |
| One external-IRQ-pin configuration descriptor. More... | |
Functions | |
| ra8_err_t | ra8_icu_init (void) |
| Reset every ICU-owned register to its post-reset state. | |
| ra8_err_t | ra8_icu_configure_irq_pin (uint8_t irq_num, const ra8_icu_irq_cfg_t *cfg) |
| Programme one IRQCRi register. | |
| ra8_err_t | ra8_icu_read_irqcr (uint8_t irq_num, uint8_t *out_val) |
| Read the raw 8-bit IRQCRi value. | |
| ra8_err_t | ra8_icu_nmi_enable (uint32_t mask) |
| Enable one or more NMI sources by OR'ing into NMIER. | |
| ra8_err_t | ra8_icu_nmi_disable (uint32_t mask) |
| Disable NMI sources by clearing bits in NMIER. | |
| ra8_err_t | ra8_icu_nmi_clear (uint32_t mask) |
| Clear pending NMI status flags via NMICLR (HUM 14.2.15 p 544). | |
| ra8_err_t | ra8_icu_nmi_status (uint32_t *out_status) |
| Read the current NMISR value. | |
Interrupt Control Unit driver (IRQ pins, NMI).
The low-level IELSR event allocator moved to ra8_isr; ra8_icu now owns the remaining ICU functionality:
All register writes go through ra8_icu_irqcr / ra8_icu_nmier accessors from ra8_icu_regs.h (HUM Ch 14 p 524).
Single-threaded init context only.
Definition in file ra8_icu.h.
|
nodiscard |
Programme one IRQCRi register.
Writes the edge-sensitivity, filter-divider, and filter-enable fields per HUM 14.2.12 (p 535). Reserved bits in IRQCRi are always written 0 (the HUM says "should be 0" for the read-zero bits). The driver does NOT touch IELSR or enable the NVIC line – that is the ra8_isr_register responsibility.
| [in] | irq_num | IRQ channel 0..31 (IRQCRa for 0..15, IRQCRb for 16..31). |
| [in] | cfg | Configuration descriptor. |
| k_ra8_ok | Register programmed. |
| k_ra8_err_invalid_arg | irq_num out of range. |
| k_ra8_err_null_ptr | cfg was NULL. |
Definition at line 76 of file ra8_icu.c.
References ra8_icu_irq_cfg_t::filter_div, ra8_icu_irq_cfg_t::filter_en, k_ra8_err_invalid_arg, k_ra8_icu_irqcr_bit_fclksel, k_ra8_icu_irqcr_mask_fclksel, k_ra8_icu_irqcr_mask_flten, k_ra8_icu_irqcr_mask_irqmd, k_ra8_icu_num_irqs, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_icu_irqcr(), ra8_log_info_val, s_tag, and ra8_icu_irq_cfg_t::sense.
Referenced by internal_attach_irq_pin(), internal_icu_extint_demo_arm(), internal_kint_demo_arm(), ra8_board_sw_attach_irq(), ra8_gpio_attach_irq(), and ra8_gpio_detach_irq().
|
nodiscard |
Reset every ICU-owned register to its post-reset state.
Writes 0 to IRQCRa[0..15] and IRQCRb[0..15] (all 32 RA8D2 IRQ channels), NMIER, and WUPEN0/WUPEN1, then clears every NMISR status bit via NMICLR. Does NOT touch IELSR – those slots belong to ra8_isr. Call this from early init before any driver registers an IRQ pin.
Definition at line 45 of file ra8_icu.c.
References k_ra8_icu_nmiclr_all, k_ra8_icu_num_irqs, k_ra8_icu_wupen_clear, k_ra8_ok, ra8_icu_irqcr(), ra8_icu_nmiclr(), ra8_icu_nmier(), ra8_icu_wupen0(), ra8_icu_wupen1(), ra8_log_info, and s_tag.
Referenced by internal_icu_extint_demo_setup_or_halt(), and internal_kint_demo_setup_or_halt().
|
nodiscard |
Clear pending NMI status flags via NMICLR (HUM 14.2.15 p 544).
| [in] | mask | Bit mask of NMICLR bits to set (write-1-to-clear). |
Definition at line 135 of file ra8_icu.c.
References k_ra8_ok, and ra8_icu_nmiclr().
Referenced by ra8_wdt_install_nmi(), and ra8_wdt_uninstall_nmi().
|
nodiscard |
Disable NMI sources by clearing bits in NMIER.
| [in] | mask | Bit mask to clear in NMIER (21 bits, FSP R_ICU_NMIER). |
Definition at line 127 of file ra8_icu.c.
References k_ra8_ok, and ra8_icu_nmier().
Referenced by ra8_wdt_uninstall_nmi().
|
nodiscard |
Enable one or more NMI sources by OR'ing into NMIER.
The NMIER layout is source-specific; pass a mask of the bits that correspond to the sources the caller wants enabled. HUM 14.2.14 (p 542) lists the bit assignments.
| [in] | mask | Bit mask to OR into NMIER. |
Definition at line 119 of file ra8_icu.c.
References k_ra8_ok, and ra8_icu_nmier().
Referenced by ra8_wdt_install_nmi().
|
nodiscard |
Read the current NMISR value.
| [out] | out_status | NMISR value on success (32-bit). |
Definition at line 142 of file ra8_icu.c.
References k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_icu_nmisr(), and s_tag.
|
nodiscard |
Read the raw 8-bit IRQCRi value.
| [in] | irq_num | Pin 0..31. |
| [out] | out_val | On success, the current register value. |
Definition at line 100 of file ra8_icu.c.
References k_ra8_err_invalid_arg, k_ra8_icu_num_irqs, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_icu_irqcr(), and s_tag.
Referenced by main().