97typedef enum : uint64_t {
103typedef enum : uint64_t {
131typedef enum : uint32_t {
143typedef enum : uint32_t {
148typedef enum : uint32_t {
168typedef enum : uint32_t {
173typedef enum : uint32_t {
181typedef enum : uint32_t {
189typedef enum : uint32_t {
207typedef enum : uint32_t {
219typedef enum : uint32_t {
224typedef enum : uint32_t {
393 const uint32_t code =
505 if ((w == 0U) || (h == 0U) || (
s_drw.pitch == 0U) || (
s_drw.origin == 0U)) {
515 return (
s_drw.control2 & sources) == 0U;
533 if ((w != 0U) && (h != 0U) && (
s_drw.origin != 0U)) {
540 for (uint32_t row = 0U; row < h; ++row) {
541 const uint64_t line =
542 (uint64_t)
s_drw.origin + ((uint64_t)row * (uint64_t)
s_drw.pitch * (uint64_t)bpp);
543 for (uint32_t col = 0U; col < w; ++col) {
544 const uint64_t addr = line + ((uint64_t)col * (uint64_t)bpp);
573 const uint64_t off = addr - (uint64_t)
k_drw_base;
623 s_drw.control2 = val;
638 s_drw.cachectl = val;
691 uint32_t addr = dlist_addr;
694 (void)
emu_mem_read(uc, (uint64_t)addr, &tag,
sizeof(tag));
704 (void)
emu_mem_read(uc, (uint64_t)addr, &val,
sizeof(val));
740 const uint64_t off = addr - (uint64_t)
k_drw_base;
741 const uint32_t val = (uint32_t)value;
790 if ((
s_drw.renders == 0U) && (
s_drw.skipped == 0U)) {
793 if (
s_drw.skipped != 0U) {
797 "%u DECLINED (limiter / FB-cache / textured path unmodelled)\n",
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 uint32_t internal_drw_factor(bool is_alpha, bool invert, uint32_t alpha)
Resolve one blend factor to its 0..255 numerator.
static void internal_drw_render(uc_engine *uc)
Rasterize the programmed bounding box into emulated memory.
drw_order_t
Per-tick order slot for the DRW block (relative order only).
@ k_drw_block_order
After the DOC block; report order.
static uint32_t internal_drw_bpp(void)
Framebuffer bytes per pixel for the programmed WRITEFORMAT.
static uint32_t internal_drw_pack(uint32_t argb, uint32_t bpp)
Narrow an ARGB8888 result to the programmed framebuffer format.
static void internal_drw_write(uc_engine *uc, uint64_t addr, unsigned size, uint64_t value)
MMIO write inside the DRW window; ORIGIN or DLISTSTART renders.
drw_cachectl_t
CACHECTL bit-field constants (HUM Ch 62.2.4 p 3694).
@ k_drw_cachectl_cenablefx
Framebuffer cache enable.
drw_dlr_t
Display-list encoding constants (HUM Ch 62.6; TES D/AVE format).
@ k_drw_dlr_idx_dliststart
DLISTSTART index (jump / stop).
@ k_drw_dlr_bytes_per_word
Register index -> byte offset.
@ k_drw_dlr_arg_wait
Wait pipe+cache, keep reading.
@ k_drw_dlr_b1_boundary
Byte 1 bit 7 -> one-index entry.
@ k_drw_dlr_eol_arg_pos
End-of-list argument position.
@ k_drw_dlr_index_mask
Register index in a tag byte.
@ k_drw_dlr_eol_low
Low byte of an end-of-list word.
@ k_drw_dlr_max_words
NASA Rule 2 fetch bound.
drw_layout_t
ARGB8888 channel layout + fixed-point blend constants.
@ k_drw_byte_mask
One colour channel.
@ k_drw_r_shift
ARGB8888 red byte position.
@ k_drw_rgb565_g_pos
RGB565 green position.
@ k_drw_alpha_full
Blend factor 1.0.
@ k_drw_alpha_round
Round-to-nearest bias.
@ k_drw_argb4444_a_pos
ARGB4444 alpha position.
@ k_drw_r565_shift
8 bpc -> 5 bpc.
@ k_drw_g_shift
ARGB8888 green byte position.
@ k_drw_a_shift
ARGB8888 alpha byte position.
@ k_drw_g565_shift
8 bpc -> 6 bpc.
@ k_drw_size_w_mask
SIZE width / height field.
@ k_drw_rgb565_r_pos
RGB565 red position.
@ k_drw_nibble_shift
8 bpc -> 4 bpc.
@ k_drw_size_h_pos
SIZE height in [31:16].
static bool internal_drw_render_modelled(uint32_t w, uint32_t h)
Decide whether this render is one the model reproduces faithfully.
static const board_periph_block_t s_k_drw_block
DRW block descriptor (self-registered with the core).
drw_wfmt_t
WRITEFORMAT[2:0] codes (HUM Ch 62.2.2 p 3692).
@ k_drw_wfmt_argb8888
32 bpp ARGB8888.
@ k_drw_wfmt_rgb565
16 bpp RGB565.
@ k_drw_wfmt_argb4444
16 bpp ARGB4444.
static drw_state_t s_drw
Module-private DRW model state.
drw_control_t
CONTROL bit-field constants (HUM Ch 62.2.1 p 3689).
@ k_drw_control_limiter_mask
LIM1..LIM6 enable bits [5:0].
static void internal_drw_dlr_exec_reg(uc_engine *uc, uint32_t index, uint32_t val)
Apply one display-list register write; ORIGIN triggers a render.
static bool internal_drw_latch(uint64_t off, uint32_t val)
Latch one shadowed DRW register; returns false for unknown offsets.
static void internal_drw_run_dlist(uc_engine *uc, uint32_t dlist_addr)
Execute a display list the DLR fetches from emulated memory.
static uint32_t internal_drw_chan(uint32_t argb, uint32_t shift)
Extract one 8-bit channel of an ARGB8888 word.
static uint64_t internal_drw_read(uc_engine *uc, uint64_t addr, unsigned size)
MMIO read inside the DRW window.
drw_geom_t
DRW block geometry (ra8_drw_regs.h, HUM Ch 62).
@ k_drw_span
Register window (260 bytes).
@ k_drw_base
DRW Secure base (HUM Ch 62).
drw_hwrev_t
Hardware revision stamp read back from real EK-RA8D2 silicon.
@ k_drw_hwrevision_value
Bench-observed HWREVISION.
static void internal_drw_reset(void)
Reset the DRW model to power-on state.
static void internal_drw_report(void)
End-of-run summary line.
drw_bpp_t
Bytes per framebuffer pixel (HUM Ch 62.3.1.1 p 3707).
@ k_drw_bpp_16
RGB565 / ARGB4444.
static void internal_drw_block_register(void)
Register the DRW block before main (host constructor).
static uint32_t internal_drw_mix(uint32_t src, uint32_t dst, uint32_t fs, uint32_t fd)
Apply one channel of src * fs + dst * fd, rounded and saturated.
drw_walpha_t
WRITEALPHA[1:0] codes (HUM Ch 62.2.2 p 3694, USEACB = 0).
@ k_drw_walpha_zero
Forced 0.0.
@ k_drw_walpha_fb
Alpha from framebuffer.
@ k_drw_walpha_pixel_cov
Source alpha (coverage).
@ k_drw_walpha_color2
Alpha from COLOR2.
drw_c2_t
CONTROL2 bit-field constants (HUM Ch 62.2.2 pp 3691-3694).
@ k_drw_c2_bsfa
Alpha src factor is a.
@ k_drw_c2_wfmt_hi_bit
WRITEFORMAT[2].
@ k_drw_c2_wfmt_lo_mask
WRITEFORMAT[1:0] mask.
@ k_drw_c2_bsf
Colour src factor is a.
@ k_drw_c2_bsi
Colour src factor invert.
@ k_drw_c2_walpha_pos
WRITEALPHA[1:0] @ 22.
@ k_drw_c2_textureenable
Texture source.
@ k_drw_c2_patternenable
Pattern source.
@ k_drw_c2_bdia
Alpha dst factor invert.
@ k_drw_c2_bdfa
Alpha dst factor is a.
@ k_drw_c2_useacb
Alpha channel blending.
@ k_drw_c2_bdf
Colour dst factor is a.
@ k_drw_c2_bdi
Colour dst factor invert.
@ k_drw_c2_bsia
Alpha src factor invert.
@ k_drw_c2_wfmt_lo_pos
WRITEFORMAT[1:0] @ 20.
@ k_drw_c2_walpha_mask
WRITEALPHA[1:0] mask.
static uint32_t internal_drw_shade(uint32_t dst)
Composite COLOR1 over one destination pixel, in ARGB8888 space.
static uint32_t internal_drw_out_alpha(uint32_t src_a, uint32_t dst_a)
Framebuffer alpha byte per the WRITEALPHA mux or the alpha blend.
drw_off_t
Register offsets this model tracks (HUM Ch 62.2, ra8_drw_regs.h).
@ k_drw_off_dliststart
W DLISTSTART: kick display list.
@ k_drw_off_color2
W COLOR2: secondary colour.
@ k_drw_off_size
W SIZE: bounding box W/H.
@ k_drw_off_color1
W COLOR1: base colour.
@ k_drw_off_control
W CONTROL / R STATUS.
@ k_drw_off_pitch
W PITCH: framebuffer pitch.
@ k_drw_off_control2
W CONTROL2 / R HWREVISION.
@ k_drw_off_cachectl
W CACHECTL: cache enable / flush.
@ k_drw_off_origin
W ORIGIN: bbox anchor + trigger.
Module-private graphics power-domain state for the gated blocks.
bool priv_board_pdctr_graphics_powered(void)
Report whether the graphics power domain is currently powered.
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.
uc_err emu_mem_write(uc_engine *uc, uint64_t address, const void *bytes, size_t count)
Write guest memory through the central access seam.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
A modelled peripheral block's self-description for the core registry.
Shadow of the write-only DRW register file plus render statistics.
uint32_t origin
ORIGIN: bounding box anchor.
uint32_t color1
COLOR1: source colour.
uint32_t last_h
Height of the last render.
uint32_t skipped
Renders declined as unmodelled.
uint32_t last_w
Width of the last render.
uint32_t control
CONTROL: limiter enables.
uint32_t pitch
PITCH: framebuffer pitch, pixels.
uint32_t color2
COLOR2: secondary colour.
uint32_t size
SIZE: packed bounding box W/H.
uint32_t control2
CONTROL2: format / blend / alpha.
uint32_t cachectl
CACHECTL: cache enables.
uint32_t renders
Bounding boxes rasterized.