|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
EK-RA8D2 BSP – bind the debug console into an ra8_io byte stream. More...
#include "ra8_board_ek_ra8d2_console_stream.h"#include <stdint.h>#include "ra8_board_ek_ra8d2.h"#include "ra8_board_ek_ra8d2_internal.h"#include "ra8_check.h"#include "ra8_err.h"#include "ra8_io_stream.h"#include "ra8_io_stream_uart.h"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. | |
Variables | |
| static const char *const | s_tag = "ra8_board.console_stream" |
| Module log tag. | |
| static ra8_io_stream_uart_state_t | s_console_sink = {} |
| Sink state backing every stream handle bound to the board console. | |
EK-RA8D2 BSP – bind the debug console into an ra8_io byte stream.
The whole translation unit is the board half of one question: which SCI channel is the console, and has it been brought up? ra8_io_stream_uart already knows how to write bytes at a channel by polling, so this unit adds no second copy of that – it answers the board question and forwards.
Compiled into an application only when that application declares ra8_io in its LIBS (see cmake/ra8_app/sources.cmake); it is the one BSP unit that reaches outside the libraries every app already links.
Touches no MCU registers: ra8_io_stream_uart -> ra8_sci owns the HUM citations for the transmit path.
Definition in file ra8_board_ek_ra8d2_console_stream.c.
|
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().
|
static |
Sink state backing every stream handle bound to the board console.
The console is a board singleton – one J-Link OB VCOM bridge on one SCI channel – so its sink state is module-owned rather than caller-supplied. That is what lets ra8_board_console_stream take only a handle. Two handles bound from this module share these bytes and therefore address the same console, which is the intended behaviour.
Definition at line 57 of file ra8_board_ek_ra8d2_console_stream.c.
Referenced by ra8_board_console_stream().
|
static |
Module log tag.
Definition at line 38 of file ra8_board_ek_ra8d2_console_stream.c.