|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Internal Voltage Regulator (VREG / DCDC / LDO) register layout for RA8D2. More...
#include <stdint.h>Go to the source code of this file.
Functions | |
| static volatile uint8_t * | ra8_vreg_dcdcctl (void) |
| Get a volatile pointer to the 8-bit DCDCCTL register. | |
| static volatile uint8_t * | ra8_vreg_vccsel (void) |
| Get a volatile pointer to the 8-bit VCCSEL register. | |
| static volatile uint8_t * | ra8_vreg_lvocr (void) |
| Get a volatile pointer to the 8-bit LVOCR register. | |
Internal Voltage Regulator (VREG / DCDC / LDO) register layout for RA8D2.
The RA8D2 supplies its core voltage (VDD) from one of two regulators selected by the OFS2.DCDCEN option byte (factory configuration – not changed at runtime):
The Hardware User's Manual chapter "Internal Voltage Regulator" (HUM Ch 68 p 4032-4034) describes the pin / capacitor topology for those two modes; the runtime control bits live in the SYSC block alongside CGC / LPM and are documented separately in the LPM chapter. Every citation in this file points at the Ch 68 page range so the cite-check stays consistent.
This header mirrors only the VREG-related offsets inside the SYSC window (0x4001E000) so the driver in libs/ra8_hal/src/ra8_vreg.c can stay self-contained without extending the shared ra8_system_regs.h. The offsets are taken from the FSP CMSIS device header R7KA8D2KF_core0.h (R_SYSTEM struct, lines 16168 ff.):
| Offset | Reg | Width | Purpose |
|---|---|---|---|
| 0x440 | DCDCCTL | 8 | DCDC/LDO main control (DCDCON, OCPEN, ...) |
| 0x441 | VCCSEL | 8 | DCDC working-voltage range select (VCCSEL[1:0]) |
| 0xAB0 | LVOCR | 8 | Low-voltage operation control (LVO0E, LVO1E) |
Bit-field layouts mirror FSP R_SYSTEM_DCDCCTL_* / R_SYSTEM_VCCSEL_* / R_SYSTEM_LVOCR_* defines. They are re-derived here as typed enums per CLAUDE.md so no FSP source is copied verbatim.
Definition in file ra8_vreg_regs.h.
| enum ra8_vreg_addr_t : uintptr_t |
SYSC base address that hosts every VREG register.
The VREG control bits share the SYSC block with CGC, LPM, LVD and battery-backup state. They live at fixed offsets in the SYSC window; we re-publish that base here so the VREG driver does not have to pull in ra8_system_regs.h.
| Enumerator | |
|---|---|
| k_ra8_vreg_sysc_base_addr | R_SYSTEM (SYSC) base. |
Definition at line 63 of file ra8_vreg_regs.h.
| enum ra8_vreg_dcdcctl_bit_t : uint8_t |
DCDCCTL bit positions (mirrors FSP R_SYSTEM_DCDCCTL_*_Pos).
Bits 2 and 3 are reserved and must be written 0.
Definition at line 104 of file ra8_vreg_regs.h.
| enum ra8_vreg_dcdcctl_mask_t : uint8_t |
DCDCCTL bit masks.
k_ra8_vreg_mask_dcdcctl_all is the union of every writable bit (0,1,4,5,6,7 = 0xF3) and is used by ra8_vreg_clear_status() to reject malformed masks.
Definition at line 122 of file ra8_vreg_regs.h.
| enum ra8_vreg_dcdcctl_step_t : uint8_t |
Pre-baked DCDCCTL values used by the LDO->DCDC handshake.
The FSP-style DCDC-enable sequence walks DCDCCTL through several intermediate values before settling on the final 0x13 (DCDCON + OCPEN + STOPZA). These constants name those intermediate values so the driver does not have to use raw hex literals.
Definition at line 149 of file ra8_vreg_regs.h.
| enum ra8_vreg_lvocr_mask_t : uint8_t |
LVOCR low-voltage-operation enables.
LVO0E selects "low-voltage profile 0" (relaxed timing for the 1.6-1.8 V VDD window); LVO1E selects profile 1 (1.8-2.0 V). Only one of the two should be set at a time; the driver enforces this via the k_ra8_vreg_lvo_* enum.
| Enumerator | |
|---|---|
| k_ra8_vreg_mask_lvo0e | LVO0E – low-voltage profile 0 enable. |
| k_ra8_vreg_mask_lvo1e | LVO1E – low-voltage profile 1 enable. |
| k_ra8_vreg_mask_lvo_all | Union of every LVOCR writable bit. |
Definition at line 183 of file ra8_vreg_regs.h.
| enum ra8_vreg_off_t : uintptr_t |
Byte offsets of every VREG-related register inside SYSC.
Verified against FSP R_SYSTEM struct (R7KA8D2KF_core0.h):
The chapter we cite is HUM Ch 68 (Internal Voltage Regulator), even though the runtime register descriptions live in the LPM chapter – Ch 68 is the documentation root for the regulator block on RA8D2.
| Enumerator | |
|---|---|
| k_ra8_vreg_off_dcdcctl | DCDCCTL offset. |
| k_ra8_vreg_off_vccsel | VCCSEL offset. |
| k_ra8_vreg_off_lvocr | LVOCR offset. |
Definition at line 82 of file ra8_vreg_regs.h.
| enum ra8_vreg_timing_us_t : uint16_t |
Stabilisation delays prescribed by the LPM chapter for every documented DCDC <-> LDO transition.
The numbers come from the LPM chapter sub-section "Switching between DCDC and LDO power modes" referenced by HUM Ch 68:
The driver does not call R_BSP_SoftwareDelay here – it stages the values so the caller can wrap each step in its own delay provider when running on real silicon.
Definition at line 208 of file ra8_vreg_regs.h.
| enum ra8_vreg_vccsel_t : uint8_t |
VCCSEL[1:0] supply-voltage range selection (DCDC mode only).
From FSP R_SYSTEM_VCCSEL_VCCSEL_Msk (mask 0x03). The chip uses the VCCSEL value to bias the DCDC switching regulator for the supplied VCC range; the firmware picks the range that matches the board's external supply.
Definition at line 166 of file ra8_vreg_regs.h.
|
inlinestatic |
Get a volatile pointer to the 8-bit DCDCCTL register.
On the embedded target this returns a pointer to the actual SYSC memory window; on the host unit-test build the fake mmap (tests/mocks/src/ra8_fake_mmap.c) maps anonymous RAM at the same virtual address so reads / writes through this pointer behave sensibly in test mode.
Definition at line 228 of file ra8_vreg_regs.h.
References k_ra8_vreg_off_dcdcctl, and k_ra8_vreg_sysc_base_addr.
Referenced by internal_dcdc_disable_sequence(), internal_dcdc_enable_sequence(), ra8_vreg_clear_status(), ra8_vreg_deinit(), ra8_vreg_dispatch(), ra8_vreg_exit_standby(), ra8_vreg_get_status(), ra8_vreg_init(), ra8_vreg_set_fast_startup(), ra8_vreg_set_ldo_boost(), and ra8_vreg_set_ocp().
|
inlinestatic |
Get a volatile pointer to the 8-bit LVOCR register.
Definition at line 248 of file ra8_vreg_regs.h.
References k_ra8_vreg_off_lvocr, and k_ra8_vreg_sysc_base_addr.
Referenced by ra8_vreg_deinit(), ra8_vreg_exit_standby(), ra8_vreg_get_status(), ra8_vreg_init(), and ra8_vreg_set_lv_profile().
|
inlinestatic |
Get a volatile pointer to the 8-bit VCCSEL register.
Definition at line 238 of file ra8_vreg_regs.h.
References k_ra8_vreg_off_vccsel, and k_ra8_vreg_sysc_base_addr.
Referenced by ra8_vreg_deinit(), ra8_vreg_exit_standby(), ra8_vreg_get_status(), ra8_vreg_init(), and ra8_vreg_set_vccsel().