|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Multi-channel console log store backing the board view's tabbed console. More...
#include <stdint.h>Go to the source code of this file.
Enumerations | |
| enum | board_console_ch_t : uint32_t { k_board_console_ch_all = 0U , k_board_console_ch_uart = 1U , k_board_console_ch_itm = 2U , k_board_console_ch_rtt = 3U , k_board_console_ch_spi = 4U , k_board_console_ch_i2c = 5U , k_board_console_ch_can = 6U , k_board_console_ch_usb = 7U , k_board_console_ch_sd = 8U , k_board_console_ch_ospi = 9U , k_board_console_ch_i2s = 10U , k_board_console_ch_adc = 11U , k_board_console_ch_dac = 12U , k_board_console_ch_gpio = 13U , k_board_console_ch_dma = 14U , k_board_console_ch_net = 15U , k_board_console_ch_count = 16U } |
| Console channels the board view exposes as tabs. More... | |
| enum | board_console_dims_t : uint32_t { k_board_console_line_cap = 128U , k_board_console_ring_depth = 64U } |
| Fixed ring geometry (mirrors the overlay line cap + SCI ring depth). More... | |
Functions | |
| const char * | board_console_name (board_console_ch_t ch) |
| Short display name for a channel (the tab caption). | |
| void | board_console_push (board_console_ch_t ch, const char *line) |
| Append one completed line to a channel ring and the ALL ring. | |
| uint32_t | board_console_count (board_console_ch_t ch) |
| Count of lines currently retained in a channel ring. | |
| uint32_t | board_console_total (board_console_ch_t ch) |
| Monotonic count of lines ever pushed to a channel. | |
| const char * | board_console_line (board_console_ch_t ch, uint32_t back) |
| Fetch a retained line by age (0 = newest) from a channel. | |
| void | board_console_reset (void) |
| Clear every channel ring (called on a warm reboot). | |
Multi-channel console log store backing the board view's tabbed console.
The emulator surfaces firmware activity through many distinct endpoints: the SCI_B serial console ([uart] SCIn:), the CoreSight ITM/SWO trace port ([itm]), the SEGGER RTT up-buffer drain ([rtt]), and one lane per modelled I/O protocol – SPI, I2C, CAN, USB, SD, OSPI, I2S, ADC, DAC, GPIO, DMA, and the virtual network peer. These are genuinely different wires, so this module keeps one fixed-capacity scrollback ring per channel plus an aggregate ALL ring that interleaves every channel in arrival order. The board view renders one channel at a time behind a clickable tab bar, exactly like a logic analyser splits its lanes.
The store is the single source of truth for console text: the SCI model routes each completed UART line here, main.c routes each completed ITM line here, and the overlay reads back the active channel's lines to paint the console panel. It owns no Unicorn engine and no AppKit dependency – it is plain C over static ring buffers (no malloc after init), so it builds and tests on any host and the tabbed console stays deterministic / headlessly verifiable.
Definition in file board_console.h.
| enum board_console_ch_t : uint32_t |
Console channels the board view exposes as tabs.
k_board_console_ch_all is the interleaved aggregate of every other channel in arrival order; the remaining values are the per-endpoint lanes. Adding a lane is a one-line change here (insert before k_board_console_ch_count) plus a matching board_console_name entry – the rings, the tab bar, and the hit-test all size themselves off k_board_console_ch_count.
Definition at line 49 of file board_console.h.
| enum board_console_dims_t : uint32_t |
Fixed ring geometry (mirrors the overlay line cap + SCI ring depth).
| Enumerator | |
|---|---|
| k_board_console_line_cap | Max chars stored per line (with NUL). |
| k_board_console_ring_depth | Recent lines retained per channel. |
Definition at line 70 of file board_console.h.
| uint32_t board_console_count | ( | board_console_ch_t | ch | ) |
Count of lines currently retained in a channel ring.
Saturates at k_board_console_ring_depth once the ring wraps. This is the number of valid back-indices for board_console_line on ch.
| [in] | ch | Channel to query. |
| 0 | ch is out of range or no line has been pushed yet. |
ch is a board_console_ch_t value. Definition at line 207 of file board_console.c.
References k_board_console_ch_count, and s_rings.
Referenced by internal_fill_console_tabs(), and internal_fill_status_console().
| const char * board_console_line | ( | board_console_ch_t | ch, |
| uint32_t | back ) |
Fetch a retained line by age (0 = newest) from a channel.
back counts backwards from the newest retained line: 0 is the most recent, 1 the one before it, up to board_console_count - 1. Older lines have aged out of the ring.
| [in] | ch | Channel to read. |
| [in] | back | Age index (0 = newest). |
back is too old. | NULL | ch out of range, or back >= board_console_count. |
ch is a board_console_ch_t value. Definition at line 223 of file board_console.c.
References console_ring_t::count, console_ring_t::head, k_board_console_ch_count, k_board_console_ring_depth, console_ring_t::lines, and s_rings.
Referenced by internal_fill_status_console(), and internal_run_stop_banner().
| const char * board_console_name | ( | board_console_ch_t | ch | ) |
Short display name for a channel (the tab caption).
Returns a borrowed static string ("ALL" / "UART" / "ITM" / ...). The same names prefix each line in the ALL ring so the aggregate view stays legible, and the board view draws them as the tab captions.
| [in] | ch | Channel to name (k_board_console_ch_all .. count-1). |
ch is out of range. | ? | ch is >= k_board_console_ch_count. |
ch is a board_console_ch_t value. Definition at line 66 of file board_console.c.
References k_board_console_ch_count, and s_k_channel_names.
Referenced by internal_fill_console_tabs(), and internal_format_all_line().
| void board_console_push | ( | board_console_ch_t | ch, |
| const char * | line ) |
Append one completed line to a channel ring and the ALL ring.
Copies line (bounded to k_board_console_line_cap, NUL-terminated) into the channel ch ring, then copies a "<NAME> <line>" prefixed form into the ALL ring so the aggregate view shows which endpoint each line came from. Calling with k_board_console_ch_all is rejected (ALL is populated only as the mirror of the source lanes, never directly).
| [in] | ch | Source lane (must not be k_board_console_ch_all). |
| [in] | line | Completed line text (no trailing newline); copied, not retained. |
ch is a source lane in (k_board_console_ch_all, k_board_console_ch_count). line is a valid NUL-terminated string. ch / NULL line leave every ring unchanged. Definition at line 190 of file board_console.c.
References internal_format_all_line(), internal_ring_push(), k_board_console_ch_all, k_board_console_ch_count, k_board_console_line_cap, and s_rings.
Referenced by board_net_on_tx(), board_net_poll_rx(), internal_adc_convert_group(), internal_board_sd_begin_write(), internal_board_sd_stage_block(), internal_canfd_console_frame(), internal_ceu_do_capture(), internal_dac_write(), internal_dmac_run_transfer(), internal_dtc_run_transfer(), internal_eth_tx_kick_queue(), internal_i3c_close_transfer(), internal_npu_console_job(), internal_on_itm_stim_write(), internal_pdm_console_maybe(), internal_port_trace_leds(), internal_riic_close_transfer(), internal_rtt_line_feed(), internal_sci_capture_tx_line(), internal_sdhi_begin_read(), internal_sdhi_begin_write(), internal_spi_report(), internal_ssie_report(), internal_xspi_do_program(), internal_xspi_do_read(), and priv_usb_log_line().
| void board_console_reset | ( | void | ) |
Clear every channel ring (called on a warm reboot).
Zeroes the head / count / total bookkeeping for all channels so a rebooted firmware starts with an empty console, matching the peripheral models' reset hooks. The line storage itself is left as-is (count gates all reads).
Definition at line 238 of file board_console.c.
References k_board_console_ch_count, and s_rings.
Referenced by warm_reboot().
| uint32_t board_console_total | ( | board_console_ch_t | ch | ) |
Monotonic count of lines ever pushed to a channel.
Unlike board_console_count (which caps at the ring depth) this keeps climbing, so the view can detect new arrivals while paused and hold its absolute scroll position.
| [in] | ch | Channel to query. |
ch since the last reset. | 0 | ch is out of range or nothing has been pushed. |
ch is a board_console_ch_t value. Definition at line 215 of file board_console.c.
References k_board_console_ch_count, and s_rings.
Referenced by emu_view_select_console_tab(), internal_fill_status_console(), and route_click().