|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Low Power Mode (LPM) register layout for the Renesas RA8D2. More...
Go to the source code of this file.
Functions | |
| static volatile uint32_t * | ra8_lpm_scb_scr (void) |
| Return a typed pointer to the Cortex-M SCB->SCR register. | |
| static volatile uint8_t * | ra8_lpm_sysc_reg8 (ra8_lpm_off_t off) |
| Return a typed pointer to an 8-bit SYSC register. | |
| static volatile uint16_t * | ra8_lpm_sysc_reg16 (ra8_lpm_off_t off) |
| Return a typed pointer to a 16-bit SYSC register. | |
| static volatile uint32_t * | ra8_lpm_icu_reg32 (ra8_lpm_off_t off) |
| Return a typed pointer to a 32-bit ICU/WUPEN register. | |
Low Power Mode (LPM) register layout for the Renesas RA8D2.
Hand-derived register map covering every register the LPM HAL driver in libs/ra8_hal/src/ra8_lpm.c touches. Sources:
Two distinct hardware base addresses are involved:
The LPM driver works in terms of byte offsets relative to those two bases. Every offset enumerator below is byte-accurate against the HUM reference.
Definition in file ra8_lpm_regs.h.
| enum ra8_lpm_addr_t : uintptr_t |
Hardware base addresses used by the LPM HAL driver.
Both bases live inside the 0x4000_0000 peripheral window so the host fake's blanket 8 MiB mmap covers them automatically.
| Enumerator | |
|---|---|
| k_ra8_lpm_sysc_base_addr | SYSC base (HUM Ch 11.2.18 p 456). |
| k_ra8_lpm_icu_base_addr | ICU/WUPEN base (HUM Ch 14.2.19 p 550). |
Definition at line 59 of file ra8_lpm_regs.h.
| enum ra8_lpm_clock_stop_bits_t : uint8_t |
Per-oscillator stop bit (HUM Ch 9.2.13..18 p 343..346).
Every oscillator control register (MOSCCR/HOCOCR/MOCOCR/LOCOCR/ SOSCCR) places its stop bit at bit 0:
| Enumerator | |
|---|---|
| k_ra8_lpm_clock_stop_mask | STOP @ bit 0 in every OCR. |
Definition at line 338 of file ra8_lpm_regs.h.
| enum ra8_lpm_dcssmode_t : uint8_t |
DPSBYCR.DCSSMODE encoding (HUM Ch 11.2.21 p 458).
Selects the wake-up time from Deep Software Standby with DCDC. Encoding 0b00 is "Setting prohibited"; the driver only exposes the three valid encodings.
| Enumerator | |
|---|---|
| k_ra8_lpm_dcssmode_128us | 128 us soft-start (cold-reset default). |
| k_ra8_lpm_dcssmode_256us | 256 us soft-start. |
| k_ra8_lpm_dcssmode_512us | 512 us soft-start. |
Definition at line 207 of file ra8_lpm_regs.h.
| enum ra8_lpm_dpsbycr_bits_t : uint8_t |
DPSBYCR bit fields and reset value (HUM Ch 11.2.21 p 458).
DCSSMODE[1:0] occupies bits 3:2; IOKEEP is bit 6. Reset value is 0x14 – bit 4 reads-as-1 plus DCSSMODE=01b (128 us soft-start).
Definition at line 191 of file ra8_lpm_regs.h.
| enum ra8_lpm_dpsier2_bits_t : uint8_t |
DPSIER2 cancel-source bit positions (HUM Ch 11.2.24 p 460).
Definition at line 383 of file ra8_lpm_regs.h.
| enum ra8_lpm_dpsier3_bits_t : uint8_t |
DPSIER3 cancel-source bit positions (HUM Ch 11.2.25 p 461).
Definition at line 395 of file ra8_lpm_regs.h.
| enum ra8_lpm_dpsier_idx_t : uint8_t |
Selector for DPSIER0..3 / DPSIFR0..3 / DPSIEGR0..2 helpers (HUM Ch 11.2.22..36 p 459..463).
Definition at line 369 of file ra8_lpm_regs.h.
| enum ra8_lpm_ldo_state_t : uint8_t |
LDOCR.SKEEP encoding for ra8_lpm_set_ldo_standby.
SKEEP=1 retains the LDO state across Software Standby; SKEEP=0 disables the LDO during standby for additional power savings.
| Enumerator | |
|---|---|
| k_ra8_lpm_ldo_disabled | LDO stops during standby (SKEEP=0). |
| k_ra8_lpm_ldo_retained | LDO retains state (SKEEP=1). |
Definition at line 319 of file ra8_lpm_regs.h.
| enum ra8_lpm_ldocr_bits_t : uint8_t |
PLL[12]LDOCR / HOCOLDOCR shared bit fields (HUM Ch 11.2.40..42 p 475..476).
| Enumerator | |
|---|---|
| k_ra8_lpm_ldocr_ldostp_mask | LDOSTP @ bit 0 – stop in normal mode. |
| k_ra8_lpm_ldocr_skeep_mask | SKEEP @ bit 1 – retain in standby. |
| k_ra8_lpm_ldocr_skeep_shift | SKEEP starts at bit 1. |
Definition at line 305 of file ra8_lpm_regs.h.
| enum ra8_lpm_lpscr_bits_t : uint8_t |
LPSCR bit fields (HUM Ch 11.2.20 p 457).
| Enumerator | |
|---|---|
| k_ra8_lpm_lpscr_lpmd_mask | LPMD[3:0] occupies bits 3..0. |
Definition at line 236 of file ra8_lpm_regs.h.
| enum ra8_lpm_off_t : uint16_t |
Byte offsets of every LPM-relevant register from its block base.
Citations cite the exact HUM section + page where the offset is documented. Offsets in the SYSC group are relative to k_ra8_lpm_sysc_base_addr; WUPEN offsets are relative to k_ra8_lpm_icu_base_addr.
Definition at line 79 of file ra8_lpm_regs.h.
| enum ra8_lpm_opccr_bits_t : uint8_t |
OPCCR bit fields (HUM Ch 11.2.11 p 451).
| Enumerator | |
|---|---|
| k_ra8_lpm_opccr_opcm_mask | OPCM[1:0] @ bits 1..0 – power mode. |
| k_ra8_lpm_opccr_opcmtsf_msk | OPCMTSF @ bit 4 – mode-transition flag. |
Definition at line 244 of file ra8_lpm_regs.h.
| enum ra8_lpm_pdctr_bits_t : uint8_t |
PDCTRGD power-gating field masks (HUM Ch 11.2.14 p 452).
The graphics power domain covers MIPI DSI, MIPI CSI, VIN, DRW and GLCDC (HUM Ch 11.5.1 Table 11.7 p 480). Its reset value is 0x81 – PDPGSF = 1 (domain gated OFF) and PDDE = 1 (power off the target domain) – so every one of those peripherals is unpowered until firmware clears PDDE. Bench-confirmed on an EK-RA8D2: with PDCTRGD = 0x81 the DRW HWREVISION register reads 0x00000000; after clearing PDDE it reads 0x0FBE0107.
PDDE polarity is inverted relative to the obvious reading: 0 powers the domain ON, 1 powers it OFF.
| Enumerator | |
|---|---|
| k_ra8_lpm_pdctr_pdde_mask | PDDE @ bit 0: 1 = powered OFF. |
| k_ra8_lpm_pdctr_pdcsf_mask | PDCSF @ bit 6: control busy. |
| k_ra8_lpm_pdctr_pdpgsf_mask | PDPGSF @ bit 7: 1 = gated off. |
Definition at line 358 of file ra8_lpm_regs.h.
| enum ra8_lpm_pdramscr0_groups_t : uint16_t |
Useful PDRAMSCR0 RKEEP[12:0] preset masks (HUM Ch 11.2.16 p 453).
Per HUM Table 11.5 the RKEEP bits group as:
Bit 13 reads-as-1; bit 14 reads-as-1; bit 15 reads-as-0. The "all keep" mask therefore sets bits 12..0 plus the read-as-1 bits 14..13, which is the cold-reset value.
Definition at line 282 of file ra8_lpm_regs.h.
| enum ra8_lpm_pdramscr1_bits_t : uint8_t |
PDRAMSCR1 bit positions (HUM Ch 11.2.17 p 455).
| Enumerator | |
|---|---|
| k_ra8_lpm_pdramscr1_rkeep0_mask | RKEEP0 @ bit 0 – CPU0 TCM. |
| k_ra8_lpm_pdramscr1_rkeep1_mask | RKEEP1 @ bit 1 – CPU1 TCM. |
Definition at line 295 of file ra8_lpm_regs.h.
| enum ra8_lpm_prcr_bits_t : uint16_t |
PRCR (write-protect) key + group masks (HUM Ch 11.2.18 p 456).
The protection register is 16 bits wide. The upper byte must be 0xA5 on every write; the lower byte selects which protected groups are unlocked. PRC1 (bit 1) gates LPM/SYSC writes used by this driver.
Definition at line 259 of file ra8_lpm_regs.h.
| enum ra8_lpm_sbycr_bits_t : uint8_t |
SBYCR bit positions and reset value (HUM Ch 11.2.18 p 456).
| Enumerator | |
|---|---|
| k_ra8_lpm_sbycr_ope_mask | OPE @ bit 6 – bus-signal output keep. |
| k_ra8_lpm_sbycr_reset_val | Cold-reset value (OPE=1, all else 0). |
Definition at line 178 of file ra8_lpm_regs.h.
| enum ra8_lpm_scb_field_t : uint32_t |
ARM Cortex-M85 SCB.SCR field bits used for sleep entry.
Only SLEEPDEEP is driven by the LPM driver; sibling bits such as SLEEPONEXIT and SEVONPEND are preserved by read-modify-write.
| Enumerator | |
|---|---|
| k_ra8_lpm_scb_scr_sleepdeep | SCR.SLEEPDEEP @ bit 2. |
Definition at line 494 of file ra8_lpm_regs.h.
| enum ra8_lpm_scb_t : uintptr_t |
ARM Cortex-M System Control Block address used for SLEEPDEEP.
SCB->SCR lives at 0xE000_E000 + 0x10 in the System Control Space; the SLEEPDEEP bit instructs WFI to enter Deep Sleep / Software Standby instead of plain CPU sleep. This is an Arm core register (Armv8-M SCS), not an RA8D2 peripheral, so it carries no HUM citation. The host unit-test build backs the SCS window with RAM (ra8_fake_mmap core region at 0xE0000000), so the driver's read-modify-write sequence runs unchanged on every build.
| Enumerator | |
|---|---|
| k_ra8_lpm_scb_scr_addr | SCB->SCR address (Cortex-M85). |
Definition at line 477 of file ra8_lpm_regs.h.
| enum ra8_lpm_sscr1_bits_t : uint8_t |
SSCR1 bit fields (HUM Ch 11.2.19 p 456).
| Enumerator | |
|---|---|
| k_ra8_lpm_sscr1_ss2fr_mask | SS2FR @ bit 0 – fast return. |
| k_ra8_lpm_sscr1_ss2lp_shift | SS2LP[1:0] starts at bit 2. |
| k_ra8_lpm_sscr1_ss2lp_mask | SS2LP[1:0] mask. |
Definition at line 217 of file ra8_lpm_regs.h.
| enum ra8_lpm_sscr1_ss2lp_t : uint8_t |
SSCR1.SS2LP encoding (HUM Ch 11.2.19 p 456).
| Enumerator | |
|---|---|
| k_ra8_lpm_ss2lp_default | SS2LP_0 – default mode. |
| k_ra8_lpm_ss2lp_low | SS2LP_1 – low power setting 1. |
Definition at line 227 of file ra8_lpm_regs.h.
| enum ra8_lpm_wupen0_bits_t : uint32_t |
WUPEN0 bit masks for common wake-up sources (HUM Ch 14.2.19 p 550).
WUPEN0 packs IRQ0..IRQ15 into bits 15..0 plus assorted peripheral wake-up enables in bits 31..16. The driver provides per-source masks for the bits the firmware actually targets; raw 32-bit writes work for everything else.
Definition at line 416 of file ra8_lpm_regs.h.
| enum ra8_lpm_wupen1_bits_t : uint32_t |
WUPEN1 bit masks for ULPT/I3C/SOSC/PDM/COMP sources (HUM Ch 14.2.20 p 552).
Definition at line 445 of file ra8_lpm_regs.h.
| enum ra8_sleep_mode_t : uint8_t |
Software-selectable sleep modes (LPSCR.LPMD encoding).
Values are the LPSCR.LPMD field encoding from HUM Ch 11.2.20 p 457 plus two pseudo-encodings (k_ra8_sleep_mode_sleep and k_ra8_sleep_mode_deep_sleep) for which LPMD stays at 0 (System Active) and only the Cortex-M85 SCR.SLEEPDEEP bit differs. The numeric values for the standby modes are the literal LPMD bit pattern so the driver can write mode directly into LPSCR.
| Value | Meaning | LPMD | SLEEPDEEP |
|---|---|---|---|
| 0 | Sleep – CPU stop, peripherals run | 0x0 | 0 |
| 2 | Deep Sleep – CPU power-gate eligible | 0x0 | 1 |
| 5 | Software Standby | 0x5 | 1 |
| 8 | Deep Software Standby 1 | 0x8 | 1 |
| 9 | Deep Software Standby 2 | 0x9 | 1 |
| 10 | Deep Software Standby 3 | 0xA | 1 |
The split between Deep Software Standby 1/2/3 follows HUM Ch 11.1 Table 11.3 (p 431..432): variants 2 and 3 progressively stop more domains (LOCO, sub-clock detection, voltage monitors).
Definition at line 160 of file ra8_lpm_regs.h.
|
inlinestatic |
Return a typed pointer to a 32-bit ICU/WUPEN register.
| [in] | off | Byte offset (k_ra8_lpm_wupen0_off or k_ra8_lpm_wupen1_off). |
Definition at line 594 of file ra8_lpm_regs.h.
References k_ra8_lpm_icu_base_addr.
Referenced by ra8_lpm_arm_wupen0_bits(), ra8_lpm_arm_wupen1_bits(), ra8_lpm_clear_wupen0_bits(), ra8_lpm_clear_wupen1_bits(), ra8_lpm_deinit(), ra8_lpm_get_exit_cause(), ra8_lpm_set_wakeup_sources(), and ra8_lpm_snooze_set_request_sources().
|
inlinestatic |
Return a typed pointer to the Cortex-M SCB->SCR register.
SCR is an Arm core register (Armv8-M System Control Space), shared by the LPM driver (SLEEPDEEP toggling around WFI) and the host unit tests (staging / asserting the toggle sequence through the fake mmap core window).
Definition at line 526 of file ra8_lpm_regs.h.
References k_ra8_lpm_scb_scr_addr.
Referenced by internal_set_sleepdeep().
|
inlinestatic |
Return a typed pointer to a 16-bit SYSC register.
| [in] | off | Byte offset (one of k_ra8_lpm_*_off). |
Definition at line 571 of file ra8_lpm_regs.h.
References k_ra8_lpm_sysc_base_addr.
Referenced by ra8_lpm_prcr_relock(), ra8_lpm_prcr_unlock(), and ra8_lpm_set_ram_retention().
|
inlinestatic |
Return a typed pointer to an 8-bit SYSC register.
| [in] | off | Byte offset (one of k_ra8_lpm_*_off). |
Definition at line 548 of file ra8_lpm_regs.h.
References k_ra8_lpm_sysc_base_addr.
Referenced by internal_graphics_clear_pdde(), internal_graphics_enable_moco(), internal_pdctrgd_wait(), ra8_lpm_arm_dpsier(), ra8_lpm_clear_dpsifr(), ra8_lpm_deinit(), ra8_lpm_enter_sleep(), ra8_lpm_get_clock_stop(), ra8_lpm_get_dpsi_state(), ra8_lpm_get_opccr(), ra8_lpm_get_status(), ra8_lpm_graphics_power_on(), ra8_lpm_init(), ra8_lpm_set_clock_stop(), ra8_lpm_set_dpsiegr(), ra8_lpm_set_ldo_standby(), ra8_lpm_set_ram_retention(), ra8_lpm_snooze_set_end_sources(), and ra8_lpm_wait_for_opccr().