52typedef enum : uint64_t {
65typedef enum : uint64_t {
82typedef enum : uint32_t {
94typedef enum : uint8_t {
106typedef enum : uint8_t {
113typedef enum : uint32_t {
123typedef enum : uint32_t {
129typedef enum : uint32_t {
195 const bool in_sdram =
197 return in_dtcm || in_sram || in_sdram;
230 const uint32_t stride =
232 const uint32_t lnnum =
237 const uint32_t height = lnnum + 1U;
238 const uint32_t width = stride / bpp;
239 if ((stride == 0U) || (width == 0U) || (width > (uint32_t)
k_glcdc_max_dim) ||
255 if (out ==
nullptr) {
418 const uint64_t line_bytes = (uint64_t)fb->
width * (uint64_t)bpp;
419 const uint64_t total = line_bytes * (uint64_t)fb->
height;
427 for (uint32_t row = 0U; row < fb->
height; ++row) {
428 const uint64_t row_base = (uint64_t)fb->
base + ((uint64_t)row * (uint64_t)fb->
stride);
430 while (done < line_bytes) {
431 uint64_t want = line_bytes - done;
438 for (uint64_t i = 0U; i < want; ++i) {
483 const char* enab = fb.
enabled ?
"scanning" :
"idle";
485 (void)
priv_emu_io_errf(
" GLCDC : layer%u fb=0x%08X %ux%u %s stride=%u crc=%08X (%s)\n",
495 (void)
priv_emu_io_errf(
" GLCDC : layer%u fb=0x%08X %ux%u %s stride=%u (%s)\n",
507typedef enum : uint32_t {
Register-accurate peripheral-model framework for the board emulator.
Decentralized peripheral-block registry for the board emulator core.
void board_periph_register_block(const board_periph_block_t *block)
Register a peripheral block's descriptor with the core registry.
static RA8_INTERNAL bool internal_glcdc_addr_is_ram(uint32_t addr)
True iff addr is inside an emulated RAM window a framebuffer uses.
static const board_periph_block_t s_k_glcdc_block
GLCDC block descriptor: observe-only snoop over the register window.
static RA8_INTERNAL void internal_glcdc_tick(uc_engine *uc)
Stash the engine each chunk so the report can read framebuffer RAM.
static glcdc_state_t s_glcdc
glcdc_fnv_t
FNV-1a-32 constants (match glcdc_render's framebuffer hash).
@ k_glcdc_fnv_prime
FNV-1a-32 prime.
@ k_glcdc_fnv_offset
FNV-1a-32 offset basis.
glcdc_fmt_t
FLM6.FORMAT codes (ra8_glcdc_pixel_fmt_t; HUM Ch 63 Table 63.11).
@ k_glcdc_fmt_clut1
1-bit CLUT.
@ k_glcdc_fmt_argb1555
16-bit ARGB1555.
@ k_glcdc_fmt_argb8888
32-bit ARGB.
@ k_glcdc_fmt_rgb565
16-bit RGB565.
@ k_glcdc_fmt_clut4
4-bit CLUT.
@ k_glcdc_fmt_argb4444
16-bit ARGB4444.
@ k_glcdc_fmt_rgb888
24-bit RGB.
@ k_glcdc_fmt_clut8
8-bit CLUT.
glcdc_bound_t
Bounds for the report-time framebuffer read (NASA Rule 2).
@ k_glcdc_read_chunk
uc_mem_read batch size, bytes.
@ k_glcdc_max_fb_bytes
8 MiB cap on a hashed framebuffer.
@ k_glcdc_max_dim
Sanity cap on decoded width/height.
static RA8_INTERNAL void internal_glcdc_snoop(uint64_t off, uint32_t value)
Snoop one register write into the matching layer / BG shadow field.
glcdc_order_t
Per-tick / report order slot for the GLCDC block (after DRW).
@ k_glcdc_block_order
After DRW (160), before SRAM-ECC (176).
static RA8_INTERNAL void internal_glcdc_report(void)
End-of-run GLCDC section: the active framebuffer + its content hash.
bool board_periph_glcdc_get_framebuffer(board_glcdc_fb_t *out)
Report the active GLCDC graphics-layer framebuffer, if one is programmed.
static RA8_INTERNAL const char * internal_glcdc_format_name(uint8_t fmt)
Human label for an FLM6.FORMAT code.
static RA8_INTERNAL uint64_t internal_glcdc_read(uc_engine *uc, uint64_t addr, unsigned size)
Read stub: an observe block never owns reads (the sparse model does).
static RA8_INTERNAL uint32_t internal_glcdc_bpp_for_format(uint8_t fmt)
Bytes per pixel for an FLM6.FORMAT code (HUM Ch 63 Table 63.11).
static RA8_INTERNAL bool internal_glcdc_layer_decode(const glcdc_layer_t *layer, uint8_t num, board_glcdc_fb_t *out)
Decode a layer's snooped registers into a framebuffer descriptor.
static RA8_INTERNAL void internal_glcdc_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write snoop inside the GLCDC window (observe-only, never owns).
glcdc_field_t
GLCDC register field shifts / masks the decode applies (HUM Ch 63).
@ k_glcdc_fmt_mask
FORMAT field width (3 bits).
@ k_glcdc_fmt_shift
FLM6.FORMAT[30:28].
@ k_glcdc_bg_en_bit
BG_EN.EN: background operation on.
@ k_glcdc_stride_mask
FLM3.LNOFF is 16 bits.
@ k_glcdc_stride_shift
FLM3.LNOFF lives in bits [31:16].
@ k_glcdc_lnnum_shift
FLM5.LNNUM lives in bits [26:16].
@ k_glcdc_flmrd_renb_bit
FLMRD.RENB: framebuffer read enable.
@ k_glcdc_lnnum_mask
FLM5.LNNUM is 11 bits.
static RA8_INTERNAL void internal_glcdc_reset(void)
Clear the GLCDC model on reset / process start.
glcdc_ram_window_t
Emulated RAM windows a GLCDC framebuffer may legally live in.
@ k_glcdc_dtcm_base
Data TCM start.
@ k_glcdc_sdram_end
External SDRAM end.
@ k_glcdc_sram_base
On-chip SRAM start.
@ k_glcdc_sram_end
On-chip SRAM end.
@ k_glcdc_sdram_base
External SDRAM start.
@ k_glcdc_dtcm_end
Data TCM end.
static RA8_INTERNAL bool internal_glcdc_hash_framebuffer(const board_glcdc_fb_t *fb, uint32_t *out_crc)
FNV-1a-32 over the active framebuffer, read out of emulated RAM.
glcdc_bpp_t
Bytes-per-pixel per FLM6.FORMAT code (CLUT modes round up to 1).
@ k_glcdc_bpp_16
RGB565 / ARGB1555 / ARGB4444.
@ k_glcdc_bpp_32
ARGB8888 / RGB888 fetch width.
@ k_glcdc_bpp_8
CLUT8 / CLUT4 / CLUT1 (rounded).
glcdc_off_t
GLCDC register byte offsets this model snoops (ra8_glcdc_regs.h).
@ k_glcdc_off_gr1_line
GR[0].FLM5: LNNUM (lines - 1).
@ k_glcdc_off_gr2_flmrd
GR[1].FLMRD.RENB.
@ k_glcdc_off_gr1_saddr
GR[0].FLM2.BASE: framebuffer addr.
@ k_glcdc_off_gr1_flmrd
GR[0].FLMRD.RENB: framebuffer read.
@ k_glcdc_off_gr2_fmt
GR[1].FLM6.FORMAT.
@ k_glcdc_off_gr1_fmt
GR[0].FLM6.FORMAT: pixel format.
@ k_glcdc_off_bg_en
BG.EN.EN: output stage enable.
@ k_glcdc_off_gr2_flm3
GR[1].FLM3.LNOFF.
@ k_glcdc_off_gr2_saddr
GR[1].FLM2.BASE.
@ k_glcdc_off_gr1_flm3
GR[0].FLM3.LNOFF: line stride bytes.
@ k_glcdc_off_gr2_line
GR[1].FLM5.
glcdc_geom_t
GLCDC register-window geometry (ra8_glcdc_regs.h).
@ k_glcdc_base
GLCDC block base (HUM Ch 63).
@ k_glcdc_span
Covers CLUTs..SYSCNT_PANEL_CLK 0x1450.
static RA8_INTERNAL void internal_glcdc_block_register(void)
Register the GLCDC block before main (host constructor).
Bounded raw-descriptor I/O seam for the RA8 emulator.
emu_io_result_t priv_emu_io_errf(const char *format,...)
Format bounded text and write it to the injected error descriptor.
uc_err emu_mem_read(uc_engine *uc, uint64_t address, void *bytes, size_t count)
Read guest memory through the central access seam.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Active GLCDC graphics-layer framebuffer descriptor.
uint32_t width
Width in pixels (line stride / bytes-per-pixel).
uint32_t stride
Line stride in bytes (GRn FLM3.LNOFF[31:16]).
uint32_t base
Framebuffer base address (GRn FLM2.BASE).
uint8_t format
Pixel format code (GRn FLM6.FORMAT[30:28]).
uint32_t height
Height in pixels (GRn FLM5.LNNUM + 1).
bool enabled
True when the layer is fetching (FLMRD set + BG EN).
uint8_t layer
Source layer: 1 = GR1 (upper), 2 = GR2 (lower).
A modelled peripheral block's self-description for the core registry.
One graphics layer's snooped descriptor registers.
uint32_t flm3
FLM3.LNOFF (stride in bits [31:16]).
uint32_t flm5
FLM5 (LNNUM lines-1 in bits [26:16]).
uint32_t fmt
FLM6.FORMAT (code in bits [30:28]).
bool flmrd
FLMRD.RENB: layer is fetching pixels.
uint32_t saddr
FLM2.BASE framebuffer base address.
The modelled GLCDC: snooped graphics-layer + background state.
uc_engine * uc
Engine handle stashed for the report.
glcdc_layer_t gr2
Graphics layer 2 (lower).
glcdc_layer_t gr1
Graphics layer 1 (upper).
bool bg_on
BG_EN.EN: output stage enabled.