Initial commit

Signed-off-by: Robert Allan James <robert.allan.james@gmail.com>
This commit is contained in:
Robert Allan James
2026-09-01 12:07:32 -04:00
parent d2a0305703
commit 58c59e87e5
11 changed files with 218 additions and 16 deletions
+18
View File
@@ -128,6 +128,24 @@ void console_puts(const char *s);
*/
void console_println(const char *s);
/**
* console_ensure_line_start - Make sure the next console_putc() starts at
* the beginning of a fresh output line, emitting a newline if output is
* currently mid-line (e.g. dangling behind a re-anchored prompt).
* No-op if already at line start. Mirrors console_putc()'s dual
* serial+framebuffer behavior (a bare '\n' reaches both).
*/
void console_ensure_line_start(void);
/**
* console_tx_count - Monotonic count of console_putc() calls delivered to
* either output (serial and/or framebuffer). In use by the REPL to detect
* that an idle bottom half (heartbeat, USB attach/detach) wrote to the
* console while the top-level prompt was showing, so it can re-anchor the
* prompt afterward. Never decreases.
*/
uint64_t console_tx_count(void);
/**
* Read a single character from serial console (non-blocking)
* Returns -1 if no character available
+12 -4
View File
@@ -120,12 +120,20 @@ int sk_console_key_available(void);
* uses internally, so a mid-word EXPECT behaves identically to typing at
* "ok>" itself.
*
* @param buf Destination buffer
* @param size Buffer capacity, including the NUL terminator
* @param active_vm VM whose idle dispatch runs while waiting
* @param buf Destination buffer
* @param size Buffer capacity, including the NUL terminator
* @param active_vm VM whose idle dispatch runs while waiting
* @param reanchor_prompt Nonzero to re-print the "ok> " prompt whenever
* an idle bottom half (heartbeat, USB attach/detach) writes
* to the console while this readline blocks at a bare,
* untyped prompt -- keeps the top-level prompt as the last
* thing shown once the chatter dies down. Callers whose
* prompt line is their own (shim.c's fgets(), i.e.
* QUERY/EXPECT/ACCEPT) pass 0 so "ok> " never gets stamped
* onto their mid-word input context.
* @return number of characters placed in buf, not counting the NUL
*/
int sk_console_readline(char *buf, int size, VM *active_vm);
int sk_console_readline(char* buf, int size, VM* active_vm, int reanchor_prompt);
#ifdef __cplusplus
}