24typedef enum : uint64_t {
32typedef enum : uint32_t {
116 const uint32_t format =
118 const uint32_t stride =
120 const uint32_t lines =
123 (stride >=
sizeof(uint16_t));
124 const uint32_t source_width = stride /
sizeof(uint16_t);
128 .width = (uint16_t)((source_width < panel_width) ? source_width : panel_width),
129 .height = (uint16_t)((lines < panel_height) ? lines : panel_height),
161 for (uint16_t row = 0U; row < tile->
height; row++) {
163 (uint64_t)layer->
address + ((uint64_t)(tile->
y + row) * layer->
stride) +
164 ((uint64_t)tile->
x *
sizeof(uint16_t)),
165 &source[(
size_t)row * tile->
width],
166 (
size_t)tile->
width *
sizeof(uint16_t)) != UC_ERR_OK) {
195 uint16_t*
const source = presentation->
scratch;
196 for (uint16_t y0 = 0U; y0 < layer->
height;) {
198 ? (uint16_t)(layer->
height - y0)
200 for (uint16_t x0 = 0U; x0 < layer->
width;) {
202 ? (uint16_t)(layer->
width - x0)
204 const surface_tile_t tile = {.x = x0, .y = y0, .width = width, .height = height};
211 x0 = (uint16_t)(x0 + width);
213 y0 = (uint16_t)(y0 + height);
222 if ((uc ==
nullptr) || (presentation ==
nullptr) || (presentation->
fd < 0)) {
225 const uint16_t background =
270 k_pixels_per_chunk = 128U,
272 uint16_t pixels[k_pixels_per_chunk];
273 uint8_t rgb[k_pixels_per_chunk * 3U];
274 const size_t total_pixels = presentation->
surface_bytes /
sizeof(uint16_t);
275 for (
size_t base = 0U; base < total_pixels; base += k_pixels_per_chunk) {
277 ((total_pixels - base) < k_pixels_per_chunk) ? (total_pixels - base) : k_pixels_per_chunk;
279 base *
sizeof(uint16_t),
281 count *
sizeof(uint16_t))) {
284 for (
size_t index = 0U; index < count; index++) {
285 const uint16_t pixel = pixels[index];
289 rgb[(index * 3U) + 0U] = (uint8_t)((red << 3U) | (red >> 2U));
290 rgb[(index * 3U) + 1U] = (uint8_t)((green << 2U) | (green >> 4U));
291 rgb[(index * 3U) + 2U] = (uint8_t)((blue << 3U) | (blue >> 2U));
302 if ((path ==
nullptr) || (presentation ==
nullptr) || (presentation->
fd < 0)) {
bool board_overlay_draw_sidebar(board_overlay_surface_t *surface, uint16_t panel_w, const board_status_t *st)
Draw the status sidebar through a bounded rectangle sink.
Bounded raw-descriptor I/O seam for the RA8 emulator.
@ k_emu_io_ok
The complete operation succeeded.
emu_io_result_t priv_emu_io_write_exact(int fd, const void *buf, size_t count)
Write exactly count sequential bytes or report fault progress.
emu_io_result_t priv_emu_io_filef(int fd, const char *format,...)
Format bounded text and write it to an explicit raw descriptor.
void priv_emu_io_txn_abort(emu_io_txn_t *txn)
Close and unlink an active sibling transaction without publication.
emu_io_result_t priv_emu_io_txn_commit(emu_io_txn_t *txn)
Sync, close, and atomically rename an active sibling transaction.
emu_io_result_t priv_emu_io_txn_begin(const char *path, emu_io_txn_t *txn)
Create a sibling temporary output for failure-atomic publication.
Shared aliased-memory backing and Unicorn memory-map bindings.
@ k_sdram_base
External SDRAM start.
@ k_sram_end
CPU0 SRAM end used by framebuffer checks.
@ k_dtcm_base
Data TCM start.
@ k_sram_base
On-chip SRAM start.
@ k_dtcm_end
Data TCM end.
@ k_sdram_end
External SDRAM end.
uc_err emu_mem_read(uc_engine *uc, uint64_t address, void *bytes, size_t count)
Read guest memory through the central access seam.
Sparse MMIO model of the Renesas peripheral space.
uint32_t mmio_peek(uint64_t addr)
Side-effect-free read of the last value written to a peripheral reg.
@ k_glcdc_bg_bgc
GLCDC BG.BGC background colour.
bool emu_presentation_read(const emu_presentation_workspace_t *workspace, size_t offset, void *bytes, size_t count)
Read exact RGB565 bytes at a checked surface offset.
@ k_emu_presentation_tile_px
Square rotation tile side.
bool emu_presentation_fill(void *context, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color)
Fill a checked RGB565 rectangle in a raw-fd surface.
Board-view presentation: frames, composition, input routing, panels.
surface_color_t
GLCDC field and RGB conversion constants.
@ k_surface_b_drop
Packed blue truncation.
@ k_surface_rgb_g_shift
RGB888 green shift.
@ k_surface_g_keep
RGB565 green high bits.
@ k_surface_6bit
Six-bit channel mask.
@ k_surface_g565_shift
RGB565 green field shift.
@ k_surface_rgb_mask
Live background color mask.
@ k_surface_g_pos
Packed green position.
@ k_surface_fmt_rgb565
GLCDC RGB565 format code.
@ k_surface_r_keep
RGB565 red high bits.
@ k_surface_high_shift
Stride/count high-half shift.
@ k_surface_r_pos
Packed red position.
@ k_surface_fmt_shift
FORMAT[30:28] shift.
@ k_surface_stride_mask
FLM3 stride mask.
@ k_surface_r565_shift
RGB565 red field shift.
@ k_surface_byte_mask
One RGB888 component.
@ k_surface_5bit
Five-bit channel mask.
@ k_surface_lnnum_mask
FLM5 line count mask.
@ k_surface_fmt_mask
FORMAT mask.
@ k_surface_rgb_r_shift
RGB888 red shift.
static bool internal_address_is_ram(uint32_t address)
True when a source base lies in one emulated RAM region.
static uint16_t internal_rgb888_to_565(uint32_t rgb)
Pack a live 0x00RRGGBB background into RGB565.
surface_glcdc_reg_t
GLCDC layer registers decoded by the streamed renderer.
@ k_surface_gr1_fmt
GR[0].FLM6 pixel format.
@ k_surface_gr1_flm5
GR[0].FLM5 line count.
@ k_surface_gr1_flm3
GR[0].FLM3 line stride.
@ k_surface_gr1_saddr
GR[0].FLM2 framebuffer base.
static bool internal_read_tile(uc_engine *uc, const surface_layer_t *layer, const surface_tile_t *tile, uint16_t *source)
Read one bounded tile of the live layer into the scratch pixels.
static bool internal_write_layer(uc_engine *uc, emu_presentation_workspace_t *presentation, const surface_layer_t *layer)
Read, rotate, and write every active GLCDC tile.
int write_ppm(const char *path, const emu_presentation_workspace_t *presentation)
Write an RGB565 frame to a binary PPM (P6) for headless inspection.
static bool internal_write_ppm_pixels(int fd, const emu_presentation_workspace_t *presentation)
Convert and emit one bounded RGB565 chunk as PPM RGB bytes.
static surface_layer_t internal_layer(uint16_t panel_width, uint16_t panel_height)
Decode and clip the current GLCDC layer without guest-facing reads.
bool priv_emu_view_surface_build(uc_engine *uc, emu_presentation_workspace_t *presentation, const board_status_t *status)
Build one exact fd-backed composite from live engine and status state.
Internal streamed panel/composite builder seam.
Internal bounded RGB565 tile rotation/writer.
bool priv_emu_view_tile_write(emu_presentation_workspace_t *presentation, const uint16_t *source, uint16_t source_x, uint16_t source_y, uint16_t width, uint16_t height)
Rotate and write one native-panel tile into its exact display location.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Non-owning drawing surface used by memory and raw-fd compositors.
Live peripheral snapshot the status sidebar renders each frame.
emu_io_status_t status
Semantic completion status.
Sibling temporary file used for failure-atomic publication.
int fd
Owned temporary descriptor, or -1 when inactive.
One independent owned surface plus non-owning bounded scratch.
uint16_t panel_height
Native panel height.
uint16_t composite_width
Display plus sidebar width.
int fd
Owned unlinked descriptor, or -1.
uint16_t display_height
Rotation-adjusted panel height.
uint16_t composite_height
Display/sidebar maximum height.
uint16_t * scratch
Borrowed RGB565 scratch, or nullptr.
uint16_t display_width
Rotation-adjusted panel width.
size_t surface_bytes
Exact raw-fd RGB565 length.
uint16_t panel_width
Native panel width.
Live GLCDC source layer clipped to native panel geometry.
bool active
Valid RGB565 layer.
uint16_t width
Clipped source pixels.
uint32_t stride
Source row bytes.
uint32_t address
Emulated row-zero address.
uint16_t height
Clipped source rows.
One bounded source tile inside the live GLCDC layer.
uint16_t width
Tile width in source pixels.
uint16_t height
Tile height in source rows.
uint16_t y
Tile origin row in the source layer.
uint16_t x
Tile origin column in the source layer.