|
ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
|
#include <stdint.h>#include <stdbool.h>#include <stdio.h>Go to the source code of this file.
Data Structures | |
| struct | msg_history_entry_t |
| Message history entry for rolling window display. More... | |
| struct | msg_history_t |
| Message history buffer for a pipe. More... | |
Macros | |
| #define | ENABLE_HEARTBEAT_VISUALIZATION 1 |
| #define | ROW_HEADER 1 |
| #define | ROW_SEPARATOR 9 |
| #define | ROW_HEARTBEAT 10 |
| #define | ROW_TASK_A 11 |
| #define | ROW_TASK_B 12 |
| #define | ROW_TASK_C 13 |
| #define | BAR_WIDTH 40 |
| #define | BAR_COL_START 6 |
| #define | VBAR_HEIGHT 10 |
| #define | VBAR_COL 70 |
| #define | HEARTBEAT_ON_TICKS 437 |
| #define | HEARTBEAT_OFF_TICKS 479 |
| #define | HEARTBEAT_PERIOD_TICKS (HEARTBEAT_ON_TICKS + HEARTBEAT_OFF_TICKS) |
| #define | TASK_A_PERIOD_TICKS 2000 |
| #define | TASK_B_PERIOD_TICKS 4000 |
| #define | TASK_C_PERIOD_TICKS 3000 |
| #define | RENDER_INTERVAL_TICKS 20 |
| #define | CYCLE_PAUSE_TICKS 100 |
| #define | MSG_HISTORY_LEN 8 |
| #define | MSG_HISTORY_MAX_BYTES 4 |
Functions | |
| void | display_init (void) |
| Initialize terminal display - clear screen and print header. | |
| void | display_render_bar (uint8_t row, const char *task_name, uint32_t elapsed_ticks, uint32_t period_ticks) |
| Render a progress bar on a fixed row. | |
| void | display_render_banner (uint8_t row, const char *task_name, bool is_on) |
| Render a simple flashing banner (on/off indicator) | |
| 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 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 bar with sent 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 bar with received message indicator. | |
| 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 history. | |
| 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. | |
| #define HEARTBEAT_PERIOD_TICKS (HEARTBEAT_ON_TICKS + HEARTBEAT_OFF_TICKS) |
| void display_init | ( | void | ) |
Initialize terminal display - clear screen and print header.
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 simple flashing banner (on/off indicator)
| row | terminal row (1-indexed) |
| task_name | task name string |
| is_on | true to show banner (LED on), false to clear (LED off) |
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 progress bar on a fixed row.
| row | terminal row (1-indexed) |
| task_name | task name string (from TCB) |
| elapsed_ticks | ticks elapsed in current period |
| period_ticks | total ticks for this period |
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 bar with received message indicator.
| row | terminal row (1-indexed) |
| task_name | task name string |
| elapsed_ticks | ticks elapsed in current period |
| period_ticks | total ticks for this period |
| msg_value | last message value received |
| show_msg | true to show message value with animation |
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.
| row | starting row for display |
| col | column position |
| hist | pointer to history buffer |
| label | label for the history (e.g., "SS", "SM") |
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 visualization panel.
| start_row | top row of the panel (1-indexed) |
| col | column position for the panel |
| label | short label for the queue (e.g., "SS", "SM") |
| count | current message count in queue |
| max_count | maximum queue capacity |
| last_sent | last message value sent (0-255) |
| last_recv | last message value received (0-255) |
| show_sent | true if last_sent is valid |
| show_recv | true if last_recv is valid |
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 bar with sent message indicator.
| row | terminal row (1-indexed) |
| task_name | task name string |
| elapsed_ticks | ticks elapsed in current period |
| period_ticks | total ticks for this period |
| msg_value | last message value sent |
| show_msg | true to show message value with animation |
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.
| start_row | top row of the vertical bar (1-indexed) |
| col | column position for the bar |
| count | current semaphore count |
| max_count | maximum semaphore capacity (init_count) |
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 history.
| hist | pointer to history buffer |
| data | message data |
| len | message length in bytes |
| source_id | producer ID (use 0xFF if unknown) |
| is_send | true if this is a send event, false for receive |
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.
| hist | pointer to 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 |