|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
EK-RA8D2 debug console as an ra8_io_stream byte sink. More...
Go to the source code of this file.
Functions | |
| ra8_err_t | ra8_board_console_stream (ra8_io_stream_t *out) |
| Bind the J-Link OB VCOM console into a caller-owned stream handle. | |
EK-RA8D2 debug console as an ra8_io_stream byte sink.
ra8_board_uart_console_write() is the right primitive – bytes and a length – but it is the ONLY thing the board console offers, so an application that wants to print a number writes its own adapter first. Meanwhile ra8_io_stream already carries puts / putc / put_u32 / put_u64 / put_hex and cannot be aimed at the console without knowing that it is SCI8 and repeating its PD02 / PD03 pin routing. ra8_board_console_stream closes that gap in one call, so the whole stream API becomes reachable from an application that knows only "the board has a console".
OPT-IN, DELIBERATELY. This header is NOT pulled in by the ra8_board_ek_ra8d2.h umbrella, and the translation unit behind it is compiled into an application only when that application declares ra8_io in its LIBS. The rest of the BSP depends solely on libraries every app already compiles; the stream binding is the one part that does not, so an application that never asks for a stream pays neither the include path nor the object code. Mirrors how ra8_compress.h is kept out of the ra8_io.h umbrella for the same reason.
Definition in file ra8_board_ek_ra8d2_console_stream.h.
|
nodiscard |
Bind the J-Link OB VCOM console into a caller-owned stream handle.
Hands back an ra8_io_stream_t whose sink is the board's debug console, so every ra8_io_stream_* writer lands on the same UART that ra8_board_uart_console_write() drives. The board supplies the two facts the application would otherwise have to know: that the console is SCI channel k_ra8_board_uart_console_sci_channel, and that ra8_board_uart_console_init() has already routed PD02 / PD03 and programmed the bit-rate register for the live PCLKA.
The sink state lives in this module (the console is a board singleton, so there is exactly one), which is why the caller supplies only the handle. Binding twice is harmless and yields two handles onto the same console.
| [out] | out | Caller-owned stream handle to bind; zero-initialise (= {}) before the call. On success it writes to the console. |
| k_ra8_ok | out is bound and usable. |
| k_ra8_err_null_ptr | out was null. |
| k_ra8_err_not_initialized | ra8_board_uart_console_init() has not succeeded, so there is no console to bind. |
out out-lives every write made through it. out carries a sink aimed at the board console. out is left exactly as the caller passed it.Definition at line 59 of file ra8_board_ek_ra8d2_console_stream.c.
References k_ra8_board_uart_console_sci_channel, k_ra8_err_not_initialized, priv_ra8_board_uart_console_is_up(), RA8_CHECK_NULL_PTR, ra8_io_stream_uart_init(), s_console_sink, and s_tag.
Referenced by internal_demo_setup_or_halt().