ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
emu_view.h
Go to the documentation of this file.
1
20
21#pragma once
22
23#include <stdint.h>
24#include <unicorn/unicorn.h>
25
26#include "board_overlay.h"
27#include "emu_presentation.h"
28#include "ra8_attributes.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
35typedef enum : uint8_t {
40
41/* Live-view (--view) and snapshot (--ppm) presentation settings. */
42typedef enum : uint32_t {
46 k_view_max_chunks = 4000000U,
47 k_view_idle_us = 16000U,
48 k_view_frame_us = 16000U,
50 k_us_per_s = 1000000U,
51 k_ns_per_us = 1000U,
54 /* --record settings. One outer chunk advances SysTick once (~1 ms of emulated
55 * time at the firmware's 1 kHz tick), so ~1000 chunks == one emulated second.
56 * Recording dumps a frame every k_record_every chunks for k_record_fps fps. */
61
63typedef enum : uint8_t {
67
77typedef enum : uint32_t {
80 k_rotate_180 = 180U,
81 k_rotate_270 = 270U,
83
84typedef enum : uint32_t {
90
92typedef struct {
94 uint16_t width;
95 uint16_t height;
97
115int write_ppm(const char* path, const emu_presentation_workspace_t* presentation);
116
136void unrotate_click(uint16_t cx,
137 uint16_t cy,
138 uint16_t panel_w,
139 uint16_t panel_h,
140 uint32_t deg,
141 uint16_t* nx,
142 uint16_t* ny);
143
162void set_switch(board_overlay_btn_t btn, bool pressed);
163
184void apply_battery_click(board_overlay_btn_t btn, uint16_t cx, uint16_t disp_w);
185
212 uint16_t cy,
213 uint16_t panel_w,
214 uint16_t panel_h,
215 uint16_t disp_w,
216 uint32_t rotate_deg);
217
238bool build_composite(uc_engine* uc,
239 emu_presentation_workspace_t* presentation,
240 const char* app_name);
241
263bool load_panel(const char* path, board_panel_t* out);
264
279void emu_view_publish(uint32_t pc, uint32_t chunks);
280
294void emu_view_mark_stopped(uint32_t pc);
295
313void emu_view_wheel(int32_t notches);
314
331void emu_view_select_console_tab(uint32_t tab_idx);
332
345void emu_view_reset_console(void);
346
362
377
391bool emu_low_power(void);
392
406void emu_set_low_power(bool on);
407
408#ifdef __cplusplus
409}
410#endif
Composite board-view renderer: panel framebuffer + a status sidebar.
board_overlay_btn_t
On-screen sidebar control a click landed on.
Bounded raw-descriptor presentation surface and scratch workspace.
void emu_set_primary_core(board_primary_core_t core)
Select the primary core (CLI –primary-core).
Definition emu_view.c:639
void apply_battery_click(board_overlay_btn_t btn, uint16_t cx, uint16_t disp_w)
Apply a POWER-section click to the fuel-gauge / core model.
Definition emu_view.c:289
void set_switch(board_overlay_btn_t btn, bool pressed)
Toggle a user switch's pressed level (active-low) for an on-screen button.
Definition emu_view.c:266
emu_sw_pin_t
EK-RA8D2 user-switch GPIO coordinates (active-low): SW1 P009, SW2 P008.
Definition emu_view.h:35
@ k_emu_sw1_pin
SW1 -> P009.
Definition emu_view.h:37
@ k_emu_sw2_pin
SW2 -> P008.
Definition emu_view.h:38
@ k_emu_sw_port
Both user switches sit on PORT0.
Definition emu_view.h:36
void emu_view_select_console_tab(uint32_t tab_idx)
Switch the visible console channel to tab_idx (tab-bar click).
Definition emu_view.c:615
panel_rotate_t
Display rotation (degrees clockwise) applied to the panel for viewing.
Definition emu_view.h:77
@ k_rotate_0
Native orientation.
Definition emu_view.h:78
@ k_rotate_90
90 deg clockwise (-> portrait).
Definition emu_view.h:79
@ k_rotate_270
90 deg counter-clockwise.
Definition emu_view.h:81
@ k_rotate_180
Upside down.
Definition emu_view.h:80
bool emu_low_power(void)
Whether the M33 4:1-slower low-power clock model is active.
Definition emu_view.c:645
panel_limits_t
Definition emu_view.h:84
@ k_panel_name_max
Max panel name (incl NUL).
Definition emu_view.h:87
@ k_panel_dim_max
Sanity cap on a panel dimension.
Definition emu_view.h:88
@ k_panel_line_max
Max panel-config line length.
Definition emu_view.h:86
@ k_strtol_base10
Base-10 radix for strtol parses.
Definition emu_view.h:85
bool load_panel(const char *path, board_panel_t *out)
Load a panel descriptor (name / width / height) from a TOML-ish file.
Definition emu_view.c:550
void emu_view_mark_stopped(uint32_t pc)
Mark the run ended: the held frame shows "parked" at pc.
Definition emu_view.c:591
void emu_set_low_power(bool on)
Set the low-power clock model (CLI –low-power / GUI toggle).
Definition emu_view.c:651
board_primary_core_t
Which core the firmware targets: gates the M85-only instruction seams.
Definition emu_view.h:63
@ k_core_m33
Cortex-M33 primary: the M85-only instruction seams stay off.
Definition emu_view.h:65
@ k_core_m85
Cortex-M85 primary (default): MVE/long-shift seams armed.
Definition emu_view.h:64
void emu_view_publish(uint32_t pc, uint32_t chunks)
Publish the run-loop telemetry the board view shows.
Definition emu_view.c:584
view_cfg_t
Definition emu_view.h:42
@ k_view_default_h
Default window height (EK-RA8D2 panel).
Definition emu_view.h:44
@ k_view_yield_us
Yield this long when a present is skipped.
Definition emu_view.h:49
@ k_record_every
Chunks between recorded frames (1000/20).
Definition emu_view.h:59
@ k_record_fps
Recorded frames per emulated second.
Definition emu_view.h:58
@ k_uart_log_max
Console ring depth (mirrors SCI model).
Definition emu_view.h:52
@ k_view_frame_us
Min wall-us between live presents (~60 Hz).
Definition emu_view.h:48
@ k_view_present_every
Present the frame every Nth chunk.
Definition emu_view.h:45
@ k_view_idle_us
~60 Hz idle pump after the run ends.
Definition emu_view.h:47
@ k_record_ms_per_sec
Emulated ms (= chunks) per second.
Definition emu_view.h:57
@ k_view_max_chunks
Cap in –view; closing the window ends.
Definition emu_view.h:46
@ k_view_default_w
Default window width (EK-RA8D2 panel).
Definition emu_view.h:43
@ k_ns_per_us
Nanoseconds per microsecond.
Definition emu_view.h:51
@ k_us_per_s
Microseconds per second.
Definition emu_view.h:50
@ k_reboot_settle
Chunks to run before a scheduled –reboot.
Definition emu_view.h:53
void emu_view_wheel(int32_t notches)
Page the console scrollback by mouse-wheel notches.
Definition emu_view.c:598
int write_ppm(const char *path, const emu_presentation_workspace_t *presentation)
Write an RGB565 frame to a binary PPM (P6) for headless inspection.
void emu_view_reset_console(void)
Reset the console-scrollback view (warm-reboot support).
Definition emu_view.c:624
bool build_composite(uc_engine *uc, emu_presentation_workspace_t *presentation, const char *app_name)
Stream the panel and status sidebar into a raw-fd surface.
Definition emu_view.c:371
void unrotate_click(uint16_t cx, uint16_t cy, uint16_t panel_w, uint16_t panel_h, uint32_t deg, uint16_t *nx, uint16_t *ny)
Map a click in the rotated displayed panel back to native panel coords.
Definition emu_view.c:242
board_overlay_btn_t route_click(uint16_t cx, uint16_t cy, uint16_t panel_w, uint16_t panel_h, uint16_t disp_w, uint32_t rotate_deg)
Route a composite-space click to the right input model.
Definition emu_view.c:326
board_primary_core_t emu_primary_core(void)
The primary core the firmware targets (label + seam gating).
Definition emu_view.c:633
Annotation-attribute framework macros for ra8-firmware.
Display descriptor loaded from a flat key=value panel file.
Definition emu_view.h:92
uint16_t height
Pixel height.
Definition emu_view.h:95
uint16_t width
Pixel width.
Definition emu_view.h:94
char name[k_panel_name_max]
Name.
Definition emu_view.h:93
One independent owned surface plus non-owning bounded scratch.