|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Multi-channel console log store implementation (see board_console.h). More...
Go to the source code of this file.
Data Structures | |
| struct | console_ring_t |
| One channel's scrollback ring. More... | |
Functions | |
| const char * | board_console_name (board_console_ch_t ch) |
| Short display name for a channel (the tab caption). | |
| static void | internal_slot_copy (char *dst, const char *src) |
| Copy a bounded, NUL-terminated string into a ring slot. | |
| static void | internal_ring_push (console_ring_t *ring, const char *line) |
| Append one already-formed line to a single ring. | |
| static void | internal_format_all_line (board_console_ch_t ch, const char *line, char *out) |
| Build the "<NAME> <line>" form an ALL-ring entry stores. | |
| 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). | |
Variables | |
| static console_ring_t | s_rings [k_board_console_ch_count] |
| One ring per channel, including the aggregate ALL ring at index 0. | |
| static const char *const | s_k_channel_names [k_board_console_ch_count] |
| Tab captions, indexed by board_console_ch_t (also the ALL prefix). | |
Multi-channel console log store implementation (see board_console.h).
One fixed-capacity ring per channel plus an aggregate ALL ring. A source lane (UART / ITM / ...) receives a line verbatim via board_console_push, which also mirrors a "<NAME> <line>" prefixed copy into the ALL ring so the aggregate view labels each line's origin. All storage is static (no malloc after init); a back-index walk converts an age (0 = newest) to a ring slot the same way the SCI scrollback ring did before this store subsumed it.
Definition in file board_console.c.
| 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().
|
static |
Build the "<NAME> <line>" form an ALL-ring entry stores.
Prefixes line with the source channel's name and a space so the aggregate view labels each line's origin, truncating to the slot capacity.
| [in] | ch | Source channel whose name prefixes the line. |
| [in] | line | Source line text (may be NULL -> name only). |
| [out] | out | Destination buffer (k_board_console_line_cap bytes). |
out points at a k_board_console_line_cap-byte buffer. ch is a source lane with a valid board_console_name. out is NUL-terminated within its capacity. out begins with the channel name followed by a space. Definition at line 159 of file board_console.c.
References board_console_name(), and k_board_console_line_cap.
Referenced by board_console_push().
|
static |
Append one already-formed line to a single ring.
Copies line into the head slot, advances head modulo the ring depth, saturates count at the depth, and bumps the monotonic total.
| [in,out] | ring | Ring to push into. |
| [in] | line | Line text to copy (bounded; may be NULL -> empty). |
ring is a valid console_ring_t with head < ring depth. ring has space for the copy (a ring is never full – it overwrites). ring gains one line; count <= k_board_console_ring_depth. total increased by one. Definition at line 125 of file board_console.c.
References console_ring_t::count, console_ring_t::head, internal_slot_copy(), k_board_console_ring_depth, console_ring_t::lines, RA8_INTERNAL, and console_ring_t::total.
Referenced by board_console_push().
|
static |
Copy a bounded, NUL-terminated string into a ring slot.
Writes at most k_board_console_line_cap - 1 chars from src into dst then NUL-terminates, so an over-length line is truncated rather than overrunning the slot. A NULL src yields an empty string.
| [out] | dst | Destination ring slot (k_board_console_line_cap bytes). |
| [in] | src | Source text (may be NULL). |
dst points at a k_board_console_line_cap-byte buffer. dst is NUL-terminated within its capacity. Definition at line 91 of file board_console.c.
References k_board_console_line_cap, and RA8_INTERNAL.
Referenced by internal_ring_push().
|
static |
Tab captions, indexed by board_console_ch_t (also the ALL prefix).
Definition at line 47 of file board_console.c.
Referenced by board_console_name().
|
static |
One ring per channel, including the aggregate ALL ring at index 0.
Definition at line 44 of file board_console.c.
Referenced by board_console_count(), board_console_line(), board_console_push(), board_console_reset(), and board_console_total().