|
ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
|
ICARUS OS Terminal Display Implementation. More...
#include "bsp/display.h"#include "icarus/kernel.h"#include "icarus/scheduler.h"#include <string.h>#include <inttypes.h>Go to the source code of this file.
Macros | |
| #define | ANSI_GOTO(row, col) (void)printf("\033[%d;%dH", (row), (col)) |
| Move cursor to specified row and column (1-indexed) | |
| #define | ANSI_SHOW_CURSOR() (void)printf("\033[?25h") |
| Show terminal cursor. | |
| #define | ANSI_HIDE_CURSOR() (void)printf("\033[?25l") |
| Hide terminal cursor. | |
| #define | ANSI_RESET "\033[0m" |
| Reset all text attributes. | |
| #define | ANSI_BOLD "\033[1m" |
| Bold text attribute. | |
| #define | ANSI_DIM "\033[2m" |
| Dim text attribute. | |
| #define | ANSI_GREEN "\033[32m" |
| Green foreground color. | |
| #define | ANSI_YELLOW "\033[33m" |
| Yellow foreground color. | |
| #define | ANSI_MAGENTA "\033[35m" |
| Magenta foreground color. | |
| #define | ANSI_CYAN "\033[36m" |
| Cyan foreground color. | |
| #define | ANSI_WHITE "\033[37m" |
| White foreground color. | |
| #define | ANSI_BG_GREEN "\033[42m" |
| Green background color. | |
| #define | ANSI_BG_MAGENTA "\033[45m" |
| Magenta background color. | |
Functions | |
| void | msg_history_init (msg_history_t *hist) |
| Initialize a message history buffer. | |
| void | msg_history_add (msg_history_t *hist, const uint8_t *data, uint8_t len, uint8_t source_id, bool is_send) |
| Add a message to the history buffer. | |
| void | display_render_msg_history (uint8_t row, uint8_t col, msg_history_t *hist, const char *label) |
| Render message history as a rolling window display. | |
| void | display_render_bar (uint8_t row, const char *task_name, uint32_t elapsed_ticks, uint32_t period_ticks) |
| Render a horizontal progress bar for task visualization. | |
| void | display_render_banner (uint8_t row, const char *task_name, bool is_on) |
| Render a flashing banner indicator (heartbeat display) | |
| void | display_render_vbar (uint8_t start_row, uint8_t col, uint32_t count, uint32_t max_count) |
| Render a vertical bar showing semaphore fill level. | |
| void | display_render_pipe (uint8_t start_row, uint8_t col, const char *label, uint8_t count, uint8_t max_count, uint8_t last_sent, uint8_t last_recv, bool show_sent, bool show_recv) |
| Render a message queue (pipe) visualization panel. | |
| void | display_render_producer (uint8_t row, const char *task_name, uint32_t elapsed_ticks, uint32_t period_ticks, uint8_t msg_value, bool show_msg) |
| Render a producer task progress bar with message indicator. | |
| void | display_render_consumer (uint8_t row, const char *task_name, uint32_t elapsed_ticks, uint32_t period_ticks, uint8_t msg_value, bool show_msg) |
| Render a consumer task progress bar with message indicator. | |
| void | display_init (void) |
| Initialize terminal display subsystem. | |
ICARUS OS Terminal Display Implementation.
Implements ANSI terminal-based visualization for real-time kernel monitoring. Provides progress bars, semaphore indicators, message queue visualizations, and rolling message history displays.
Definition in file display.c.
| void display_init | ( | void | ) |
Initialize terminal display subsystem.
Initialize terminal display - clear screen and print header.
Performs one-time initialization of the terminal display:
* ┌──────────────────────────────────────────────────────────────┐ * │ ██╗ ██████╗ █████╗ ██████╗ ██╗ ██╗ ██████╗ │ * │ ██║██╔════╝ ██╔══██╗██╔══██╗██║ ██║██╔════╝ │ * │ ██║██║ ███████║██████╔╝██║ ██║╚█████╗ │ * │ ██║██║ ██╔══██║██╔══██╗██║ ██║ ╚═══██╗ │ * │ ██║╚██████╗ ██║ ██║██║ ██║╚██████╔╝██████╔╝ │ * │ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═════╝ │ * │ Preemptive Kernel • ARMv7E-M • STM32H750 │ * └──────────────────────────────────────────────────────────────┘ *
Definition at line 654 of file display.c.
References ANSI_GOTO, ANSI_HIDE_CURSOR, display_render_banner(), display_render_bar(), os_get_num_created_tasks(), os_get_task_name(), ROW_HEADER, ROW_HEARTBEAT, ROW_SEPARATOR, ROW_TASK_A, ROW_TASK_C, TASK_A_PERIOD_TICKS, TASK_B_PERIOD_TICKS, and TASK_C_PERIOD_TICKS.
Referenced by os_idle_task().
| void display_render_banner | ( | uint8_t | row, |
| const char * | task_name, | ||
| bool | is_on | ||
| ) |
Render a flashing banner indicator (heartbeat display)
Render a simple flashing banner (on/off indicator)
Displays or clears a star-filled banner synchronized with the heartbeat LED. Used to provide visual confirmation that the kernel scheduler is running.
| [in] | row | Terminal row (1-indexed) |
| [in] | task_name | Task name to display at banner edges |
| [in] | is_on | true = show banner (LED on), false = clear line (LED off) |
* [>ICARUS_HEARTBEAT<] ★★★★★★★★★★★★★★★★★★★★ [>ICARUS_HEARTBEAT<] *
Definition at line 306 of file display.c.
References ANSI_GOTO, and BAR_WIDTH.
Referenced by display_init(), and os_heartbeat_task().
| void display_render_bar | ( | uint8_t | row, |
| const char * | task_name, | ||
| uint32_t | elapsed_ticks, | ||
| uint32_t | period_ticks | ||
| ) |
Render a horizontal progress bar for task visualization.
Render a progress bar on a fixed row.
Displays a fixed-width progress bar showing task execution progress within its current period. Uses Unicode block characters for smooth fill animation.
| [in] | row | Terminal row (1-indexed) |
| [in] | task_name | Task name string (from TCB, max 16 chars displayed) |
| [in] | elapsed_ticks | Ticks elapsed in current period |
| [in] | period_ticks | Total ticks for this period (must be > 0) |
* [task_name] ████████████──────────────── 160 / 2000 ticks *
Definition at line 247 of file display.c.
References ANSI_GOTO, and BAR_WIDTH.
Referenced by display_init().
| void display_render_consumer | ( | uint8_t | row, |
| const char * | task_name, | ||
| uint32_t | elapsed_ticks, | ||
| uint32_t | period_ticks, | ||
| uint8_t | msg_value, | ||
| bool | show_msg | ||
| ) |
Render a consumer task progress bar with message indicator.
Render a consumer task bar with received message indicator.
Displays a magenta-colored progress bar for consumer tasks with an animated arrow indicator showing the last received message value.
| [in] | row | Terminal row (1-indexed) |
| [in] | task_name | Task name string |
| [in] | elapsed_ticks | Ticks elapsed in current period |
| [in] | period_ticks | Total ticks for this period |
| [in] | msg_value | Last message value received (0-255) |
| [in] | show_msg | true to show message indicator with flash effect |
* [consumer] ████████████──────── 160/2000 ←[42] *
| void display_render_msg_history | ( | uint8_t | row, |
| uint8_t | col, | ||
| msg_history_t * | hist, | ||
| const char * | label | ||
| ) |
Render message history as a rolling window display.
Render message history as a rolling window.
Displays the last MSG_HISTORY_LEN messages in a bordered panel. Uses ASCII box drawing characters for terminal compatibility. Color-codes entries: green for sends, magenta for receives.
| [in] | row | Starting terminal row (1-indexed) |
| [in] | col | Column position for left edge of panel |
| [in] | hist | Pointer to history buffer to render |
| [in] | label | Short label for panel header (e.g., "SS", "SM") |
* +---SS---+ * |>P0: 42| <- Producer 0 sent 42 * |<C0: 42| <- Consumer 0 received 42 * |>P0: 43| * +---------+ *
Definition at line 174 of file display.c.
References ANSI_BOLD, ANSI_CYAN, ANSI_GOTO, ANSI_GREEN, ANSI_MAGENTA, ANSI_RESET, msg_history_t::count, msg_history_entry_t::data, msg_history_t::entries, msg_history_t::head, msg_history_entry_t::is_send, msg_history_entry_t::len, MSG_HISTORY_LEN, and msg_history_entry_t::source_id.
| void display_render_pipe | ( | uint8_t | start_row, |
| uint8_t | col, | ||
| const char * | label, | ||
| uint8_t | count, | ||
| uint8_t | max_count, | ||
| uint8_t | last_sent, | ||
| uint8_t | last_recv, | ||
| bool | show_sent, | ||
| bool | show_recv | ||
| ) |
Render a message queue (pipe) visualization panel.
Render a message queue visualization panel.
Displays a compact panel showing pipe fill level and recent send/receive activity. Includes horizontal fill bar and directional arrows for message flow indication.
| [in] | start_row | Top row of the panel (1-indexed) |
| [in] | col | Column position for left edge |
| [in] | label | Short label for the queue (e.g., "Q1", "PIPE0") |
| [in] | count | Current byte count in pipe |
| [in] | max_count | Maximum pipe capacity in bytes |
| [in] | last_sent | Last message value sent (0-255) |
| [in] | last_recv | Last message value received (0-255) |
| [in] | show_sent | true to display sent indicator with animation |
| [in] | show_recv | true to display received indicator with animation |
* PIPE0 * [████────] * 12/32 * →123 <- Green arrow + sent value * ← 45 <- Magenta arrow + received value *
Definition at line 431 of file display.c.
References ANSI_GOTO.
| void display_render_producer | ( | uint8_t | row, |
| const char * | task_name, | ||
| uint32_t | elapsed_ticks, | ||
| uint32_t | period_ticks, | ||
| uint8_t | msg_value, | ||
| bool | show_msg | ||
| ) |
Render a producer task progress bar with message indicator.
Render a producer task bar with sent message indicator.
Displays a green-colored progress bar for producer tasks with an animated arrow indicator showing the last sent message value.
| [in] | row | Terminal row (1-indexed) |
| [in] | task_name | Task name string |
| [in] | elapsed_ticks | Ticks elapsed in current period |
| [in] | period_ticks | Total ticks for this period |
| [in] | msg_value | Last message value sent (0-255) |
| [in] | show_msg | true to show message indicator with flash effect |
* [producer] ████████████──────── 160/2000 →[42] *
| void display_render_vbar | ( | uint8_t | start_row, |
| uint8_t | col, | ||
| uint32_t | count, | ||
| uint32_t | max_count | ||
| ) |
Render a vertical bar showing semaphore fill level.
Displays a vertical bar chart representing semaphore count as a percentage of maximum capacity. Bar fills from bottom to top. Uses ASCII box drawing for terminal compatibility.
| [in] | start_row | Top row of the vertical bar (1-indexed) |
| [in] | col | Column position for left edge |
| [in] | count | Current semaphore count |
| [in] | max_count | Maximum semaphore capacity |
* SEM * +---+ * |###| <- Filled portion (green) * |###| * | | <- Empty portion * | | * +---+ * 3/10 <- Current/max count *
Definition at line 352 of file display.c.
References ANSI_CYAN, ANSI_GOTO, ANSI_GREEN, ANSI_RESET, and VBAR_HEIGHT.
| void msg_history_add | ( | msg_history_t * | hist, |
| const uint8_t * | data, | ||
| uint8_t | len, | ||
| uint8_t | source_id, | ||
| bool | is_send | ||
| ) |
Add a message to the history buffer.
Add a message to history.
Adds a new entry at the head position using circular buffer semantics. Oldest entries are overwritten when buffer is full.
| [in,out] | hist | Pointer to history buffer |
| [in] | data | Message data bytes |
| [in] | len | Number of bytes in message (clamped to MSG_HISTORY_MAX_BYTES) |
| [in] | source_id | Producer/consumer ID (0-254, 0xFF = unknown) |
| [in] | is_send | true = send event, false = receive event |
Definition at line 127 of file display.c.
References msg_history_t::count, msg_history_entry_t::data, msg_history_t::entries, msg_history_t::head, msg_history_entry_t::is_send, msg_history_entry_t::len, MSG_HISTORY_LEN, MSG_HISTORY_MAX_BYTES, and msg_history_entry_t::source_id.
| void msg_history_init | ( | msg_history_t * | hist | ) |
Initialize a message history buffer.
Clears all entries and resets head/count to zero. Must be called before using the history buffer.
| [out] | hist | Pointer to history buffer to initialize |