53 const char*
const e = getenv(name);
58 return (v > 0L) ? (uint32_t)v : dflt;
83 if (view !=
nullptr) {
109 const char*
const e_wall = getenv(
"RA8_EMU_WALL_S");
110 if (e_wall ==
nullptr) {
116 }
else if (v == 0L) {
117 *wall_guard_on =
false;
142 uint32_t* max_chunks)
144 const char*
const record_dir = cfg->
record_dir;
146 if ((record_dir !=
nullptr) && (record_secs > 0U) && (view ==
nullptr)) {
149 if (record_dir !=
nullptr) {
152 "ra8_emulator: recording to %s/frame_NNNNNN.ppm (every %u chunks, ~%u fps)\n",
178 const char* stop_on = getenv(
"RA8_EMU_STOP_ON");
179 if ((stop_on !=
nullptr) && ((stop_on[0] ==
'\0') || (view !=
nullptr))) {
202 const char*
const e_spc = getenv(
"RA8_EMU_STOP_PC");
203 if (e_spc !=
nullptr) {
234 k_prof_idle_insns = 4000U,
235 k_prof_idle_need = 600U,
236 k_prof_idle_arm = 16U,
238 *insns = (uint32_t)k_prof_idle_insns;
239 *need = (uint32_t)k_prof_idle_need;
240 *arm = (uint32_t)k_prof_idle_arm;
241 const char*
const e_pi = getenv(
"RA8_EMU_PROFILE_IDLE_INSNS");
242 const char*
const e_pn = getenv(
"RA8_EMU_PROFILE_IDLE_NEED");
243 const char*
const e_pa = getenv(
"RA8_EMU_PROFILE_IDLE_ARM");
244 if (e_pi !=
nullptr) {
247 if (e_pn !=
nullptr) {
250 if (e_pa !=
nullptr) {
259 const uint32_t click_settle_chunks =
266 uint32_t max_chunks =
269 bool wall_guard_on =
true;
281 uint32_t prof_idle_insns = 0U;
282 uint32_t prof_idle_need = 0U;
283 uint32_t prof_idle_arm = 0U;
287 .click_settle_chunks = click_settle_chunks,
288 .max_chunks = max_chunks,
290 .wall_guard_on = wall_guard_on,
291 .idle_stop_chunks = idle_stop_chunks,
292 .usb_stop_settle = usb_stop_settle,
293 .usbh_stop_settle = usbh_stop_settle,
295 .prof_idle_insns = prof_idle_insns,
296 .prof_idle_need = prof_idle_need,
297 .prof_idle_arm = prof_idle_arm,
struct board_view board_view_t
Opaque desktop-window handle (defined in board_view.m).
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.
Firmware profiler (RA8_EMU_PROFILE): sampling, hooks, reports.
void emu_prof_set_stop_pc(uint32_t pc)
Set the RA8_EMU_STOP_PC early-stop address (0 disables).
The chunked emulation run loop, report and exit-code mapping.
@ k_env_strtol_base
Decimal base for env-var integer parse.
@ k_run_wall_s
Wall-clock safety bound (seconds).
@ k_run_max_chunks
Chunk budget.
@ k_record_dir_mode
mkdir mode for the –record dir.
static RA8_INTERNAL const char * internal_guard_read_stop_on(const board_view_t *view)
Resolve the RA8_EMU_STOP_ON console-banner stop substring.
static RA8_INTERNAL uint32_t internal_guard_env_u32_headless(const char *name, uint32_t dflt, const board_view_t *view)
Read a headless-only RA8_EMU_* positive uint32 knob.
static RA8_INTERNAL void internal_guard_read_prof_idle(uint32_t *insns, uint32_t *need, uint32_t *arm)
Read the profiler compute-idle early-stop tunables.
static RA8_INTERNAL uint32_t internal_guard_env_u32(const char *name, uint32_t dflt)
Read a RA8_EMU_* env var as a positive decimal uint32.
static RA8_INTERNAL void internal_guard_read_wall(double *wall_s, bool *wall_guard_on)
Apply the RA8_EMU_WALL_S CPU-time guard override.
static RA8_INTERNAL void internal_guard_apply_stop_pc(void)
Hand RA8_EMU_STOP_PC (if set) to the profiler stop hook.
run_guards_t run_read_guards(const emu_run_cfg_t *cfg, const board_view_t *view)
Read the run-guard environment knobs (see run_guards_t).
@ k_click_settle_chunks
Extra chunks after the click lands.
static RA8_INTERNAL void internal_guard_setup_record(const emu_run_cfg_t *cfg, const board_view_t *view, uint32_t *max_chunks)
Apply the –record chunk bound and create the frame directory.
Board-view presentation: frames, composition, input routing, panels.
@ k_strtol_base10
Base-10 radix for strtol parses.
@ k_record_every
Chunks between recorded frames (1000/20).
@ k_record_fps
Recorded frames per emulated second.
@ k_record_ms_per_sec
Emulated ms (= chunks) per second.
@ k_view_max_chunks
Cap in –view; closing the window ends.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Everything setup hands the run loop: engine, image, CLI products.
const char * record_dir
–record directory (NULL when unused).
uint32_t record_secs
–record-secs bound (0 = unbounded).
The run-guard knobs (env-tunable budgets + stop conditions).