|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
LVD / PVD voltage-monitor status model for ra8_emulator. More...
#include <stdint.h>#include <stdio.h>#include "board_periph_block.h"#include "emu_host_io_internal.h"Go to the source code of this file.
Data Structures | |
| struct | lvd_state_t |
| PVD control-byte shadows (status bytes are synthesised). More... | |
Enumerations | |
| enum | lvd_geom_t : uint64_t { k_lvd_base = 0x4001E0E0UL , k_lvd_span = 0x04UL , k_lvd_off_pvd1cr1 = 0x00UL , k_lvd_off_pvd1sr = 0x01UL , k_lvd_off_pvd2cr1 = 0x02UL , k_lvd_off_pvd2sr = 0x03UL } |
| PVD status-window geometry (ra8_lvd_regs.h). More... | |
| enum | lvd_field_t : uint8_t { k_lvd_sr_det = 0x01U , k_lvd_sr_mon = 0x02U , k_lvd_sr_healthy = 0x02U } |
| PVDmSR field masks + the healthy-rail status value (ra8_lvd.c). More... | |
| enum | lvd_order_t : uint32_t { k_lvd_block_order = 170U } |
| Per-tick order slot for the LVD block (relative order only). More... | |
Functions | |
| static RA8_INTERNAL void | internal_lvd_reset (void) |
| Reset the LVD model to power-on state. | |
| static RA8_INTERNAL uint64_t | internal_lvd_read (uc_engine *uc, uint64_t addr, unsigned size) |
| MMIO read inside the PVD status window. | |
| static RA8_INTERNAL void | internal_lvd_write (uc_engine *uc, uint64_t addr, unsigned size, uint64_t value) |
| MMIO write inside the PVD status window. | |
| static RA8_INTERNAL void | internal_lvd_report (void) |
| End-of-run LVD section: status reads served. | |
| static RA8_INTERNAL void | internal_lvd_block_register (void) |
| Register the LVD status window before main (host constructor). | |
Variables | |
| static lvd_state_t | s_lvd |
| static const board_periph_block_t | s_k_lvd_block |
| LVD status-window descriptor (self-registered with the core). | |
LVD / PVD voltage-monitor status model for ra8_emulator.
Models the RA8D2 low-voltage detection status registers (ra8_lvd_regs.h, ra8_lvd.c) so a VCC monitor reports a healthy rail, instead of the status reading back zero. Against the sparse fallback lvd_monitor_demo configured PVD1 (threshold 2.80 V) but PVD1SR.MON read back 0, so the banner reported mon=below ok=N – the opposite of a healthy 3.3 V board. This block makes PVD1SR.MON (and PVD2SR.MON) read "above threshold" with the latched-crossing flag DET clear, so the banner reports mon=above ok=Y – the reading a correctly-powered EK-RA8D2 gives.
The PVD status registers live inside the R_SYSTEM block; this model claims only the four-byte window holding PVD1CR1 / PVD1SR / PVD2CR1 / PVD2SR (0x4001E0E0..0x4001E0E3), leaving the rest of R_SYSTEM (clock-generator bring-up, etc.) to the sparse fallback. The control bytes (PVD1CR1 / PVD2CR1) shadow their writes so the driver's read-back succeeds; the status bytes (PVD1SR / PVD2SR) always report MON = above, DET = 0. A write to a status byte with DET = 0 is honoured (the driver clears DET write-0-to-clear); MON is read-only live state and stays asserted.
The emulator has no analog rail to compare, so reporting "above" is the faithful steady state for a powered board – the genuine driver path (ra8_lvd_get_status reading PVD1SR.MON / .DET) sees exactly what a healthy 3.3 V supply yields on silicon.
Definition in file board_periph_lvd.c.
| enum lvd_field_t : uint8_t |
PVDmSR field masks + the healthy-rail status value (ra8_lvd.c).
| Enumerator | |
|---|---|
| k_lvd_sr_det | DET latched threshold-crossing (bit 0). |
| k_lvd_sr_mon | MON live "VCC above Vdetm" flag (bit 1). |
| k_lvd_sr_healthy | MON = above, DET = 0: a healthy rail. |
Definition at line 51 of file board_periph_lvd.c.
| enum lvd_geom_t : uint64_t |
PVD status-window geometry (ra8_lvd_regs.h).
Definition at line 41 of file board_periph_lvd.c.
| enum lvd_order_t : uint32_t |
Per-tick order slot for the LVD block (relative order only).
| Enumerator | |
|---|---|
| k_lvd_block_order | After the CAC block; report order. |
Definition at line 58 of file board_periph_lvd.c.
|
static |
Register the LVD status window before main (host constructor).
Definition at line 171 of file board_periph_lvd.c.
References board_periph_register_block(), RA8_INTERNAL, and s_k_lvd_block.
|
static |
MMIO read inside the PVD status window.
MMIO read inside the pvd status window; this step is contained within the board periph lvd model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
| [in] | addr | Guest address involved in the operation. |
| [in] | size | Size of the requested region or access in bytes. |
| value | The operation-specific lvd read value. |
Definition at line 97 of file board_periph_lvd.c.
References k_lvd_base, k_lvd_off_pvd1cr1, k_lvd_off_pvd1sr, k_lvd_off_pvd2cr1, k_lvd_off_pvd2sr, k_lvd_sr_healthy, RA8_INTERNAL, and s_lvd.
|
static |
End-of-run LVD section: status reads served.
End-of-run lvd section: status reads served; this step is contained within the board periph lvd model and uses bounded caller or module-owned storage.
Definition at line 149 of file board_periph_lvd.c.
References priv_emu_io_errf(), RA8_INTERNAL, and s_lvd.
|
static |
Reset the LVD model to power-on state.
Reset the lvd model to power-on state; this step is contained within the board periph lvd model and uses bounded caller or module-owned storage.
Definition at line 79 of file board_periph_lvd.c.
References RA8_INTERNAL, and s_lvd.
|
static |
MMIO write inside the PVD status window.
MMIO write inside the pvd status window; this step is contained within the board periph lvd model and uses bounded caller or module-owned storage.
| [in,out] | uc | Unicorn engine whose emulated state is read or updated. |
| [in] | addr | Guest address involved in the operation. |
| [in] | size | Size of the requested region or access in bytes. |
| [in] | value | Register or payload value involved in the operation. |
Definition at line 128 of file board_periph_lvd.c.
References k_lvd_base, k_lvd_off_pvd1cr1, k_lvd_off_pvd2cr1, and s_lvd.
|
static |
LVD status-window descriptor (self-registered with the core).
Definition at line 158 of file board_periph_lvd.c.
Referenced by internal_lvd_block_register().
|
static |
Definition at line 69 of file board_periph_lvd.c.
Referenced by internal_lvd_read(), internal_lvd_report(), internal_lvd_reset(), and internal_lvd_write().