ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_board_ra8p1.c File Reference

Board-support implementation for the RA8P1 foundation board. More...

#include "ra8_board_ra8p1.h"
#include <stddef.h>
#include <stdint.h>
#include "ra8_cgc.h"
#include "ra8_elc_regs.h"
#include "ra8_err.h"
#include "ra8_gpio_constants.h"
#include "ra8_icu.h"
#include "ra8_icu_regs.h"
#include "ra8_isr.h"
#include "ra8_port_constants.h"
#include "ra8_port_utils.h"
#include "ra8_sci.h"
Include dependency graph for ra8_board_ra8p1.c:

Go to the source code of this file.

Enumerations

enum  ra8_board_uart_console_clock_t : uint32_t { k_ra8_board_uart_console_min_pclka_hz = 16000000UL }
 Minimum SCI module operating clock accepted by the console init. More...

Functions

ra8_err_t ra8_board_get_info (ra8_board_info_t *out)
 Copy the three board-identity strings into out.
ra8_err_t ra8_board_led_pin (ra8_board_led_id_t led, ra8_port_pin_t *out_pin)
 Translate a board LED id into its underlying ra8_port_pin_t.
ra8_err_t ra8_board_led_init (ra8_board_led_id_t led)
 Configure led as a digital output, initial level low (off).
ra8_err_t ra8_board_led_on (ra8_board_led_id_t led)
 Drive led HIGH (light it).
ra8_err_t ra8_board_led_off (ra8_board_led_id_t led)
 Drive led LOW (extinguish it).
ra8_err_t ra8_board_led_toggle (ra8_board_led_id_t led)
 Toggle led's output state.
ra8_err_t ra8_board_sw_pin (ra8_board_sw_id_t sw, ra8_port_pin_t *out_pin)
 Translate a board switch id into its underlying ra8_port_pin_t.
ra8_err_t ra8_board_sw_init (ra8_board_sw_id_t sw)
 Configure a switch pin as an input with internal pull-up.
ra8_err_t ra8_board_sw_read (ra8_board_sw_id_t sw, ra8_board_sw_state_t *out_pressed)
 Sample the current state of sw.
ra8_err_t ra8_board_sw_attach_irq (ra8_board_sw_id_t sw, ra8_board_sw_irq_cb_t cb, void *ctx)
 Wire sw to the ICU and register a falling-edge callback.
ra8_err_t ra8_board_uart_console_init (uint32_t baud)
 Configure SCI8 + PD02/PD03 as the debug-console UART.
ra8_err_t ra8_board_uart_console_write (const uint8_t *data, size_t len)
 Polled blocking write to the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_read (uint8_t *out, size_t cap, size_t *out_len)
 Polled non-blocking read from the J-Link OB VCOM console.
ra8_err_t ra8_board_uart_console_flush (void)
 Block until every byte queued on the J-Link OB VCOM console has finished clocking out on the wire.

Variables

const char *const k_ra8_board_name = "RA8P1 foundation board"
 Human-readable strings identifying this BSP target.
const char *const k_ra8_board_doc_rev = "R01UH1064EJ (chip HUM)"
 "R20UT5523EG0101 Rev 1.01".
const char *const k_ra8_board_mcu = "R7KA8P1KFLCAC"
 "R7KA8D2KFLCAC".
static const ra8_port_pin_t s_led_pins [k_ra8_board_led_count]
 Lookup table from ra8_board_led_id_t to ra8_port_pin_t.
static const ra8_port_pin_t s_sw_pins [k_ra8_board_sw_count]
 Lookup table from ra8_board_sw_id_t to ra8_port_pin_t.
static const uint8_t s_sw_irq_nums [k_ra8_board_sw_count]
 Lookup table from ra8_board_sw_id_t to ICU IRQ channel.
static bool s_uart_console_initialized = false
 Tracks whether ra8_board_uart_console_init has succeeded.

Detailed Description

Board-support implementation for the RA8P1 foundation board.

Tag
[Ring 5 / BSP] {World: S}

Translates board-coordinate APIs ("LED1", "SW1", "the console") into HAL calls for the RA8P1 (R7KA8P1KFLCAC). The BSP itself never touches MCU registers; ra8_gpio_* / ra8_pfs_route_peripheral / ra8_icu_configure_irq_pin / ra8_sci_* carry every register write, and each of those HAL entry points carries its own RA8P1-identical HUM citation.

The pin tables below are PROVISIONAL, mirrored from the pin-compatible EK-RA8D2 layout because no RA8P1 board is defined yet (no committed EK-RA8P1 User's Manual, no ra8p1_kicad/ PCB). See the header for the full TODO(EK-RA8P1 UM / ra8p1_kicad) rationale; every pin is a valid GPIO / SCI alternate on the RA8P1 (chip HUM R01UH1064EJ Ch 20 "I/O Ports").

Since
0.1.0

Definition in file ra8_board_ra8p1.c.

Enumeration Type Documentation

◆ ra8_board_uart_console_clock_t

Minimum SCI module operating clock accepted by the console init.

The RA8P1 SCI_B baud-rate generator is clocked from PCLKA (byte-identical to the RA8D2, chip HUM R01UH1064EJ Ch 38 "Serial Communications Interface"). Before ra8_cgc_init() brings the PLL up the chip sits on MOCO (~8 MHz), far too low for a usable 115200 baud divisor, so the console init refuses to come up until CGC has published a post-PLL PCLKA value. This floor sits well above MOCO and below the target so any reasonable CGC tree still qualifies.

Invariant
Value is a plausible SCI operating-clock lower bound in Hz.
Enumerator
k_ra8_board_uart_console_min_pclka_hz 

16 MHz PCLKA floor.

Definition at line 267 of file ra8_board_ra8p1.c.

Function Documentation

◆ ra8_board_get_info()

ra8_err_t ra8_board_get_info ( ra8_board_info_t * out)
nodiscard

Copy the three board-identity strings into out.

Parameters
[out]outDestination struct, must be non-NULL.
Return values
k_ra8_okFilled.
k_ra8_err_invalid_argout == NULL.
Precondition
out is writable.
Postcondition
On success out->name / doc_rev / mcu point at the global k_ra8_board_* strings.
Since
0.1.0

Definition at line 51 of file ra8_board_ra8p1.c.

References ra8_board_info_t::doc_rev, k_ra8_board_doc_rev, k_ra8_board_mcu, k_ra8_board_name, k_ra8_err_invalid_arg, k_ra8_ok, ra8_board_info_t::mcu, and ra8_board_info_t::name.

◆ ra8_board_led_init()

ra8_err_t ra8_board_led_init ( ra8_board_led_id_t led)
nodiscard

Configure led as a digital output, initial level low (off).

Return values
k_ra8_okPin claimed and driven low.
k_ra8_err_invalid_argled >= k_ra8_board_led_count.
k_ra8_err_gpio_conflictPin already owned.
Precondition
HAL pin validator initialized (single-threaded boot context).
Postcondition
LED is off and pin is configured as a digital output.
Since
0.1.0

Definition at line 96 of file ra8_board_ra8p1.c.

References k_ra8_level_low, k_ra8_ok, k_ra8_pin_none, pin, ra8_board_led_pin(), and ra8_gpio_output_init().

Referenced by adc_diag_setup_or_halt(), app_bringup_clocks(), blc_setup_or_halt(), c6_probe_setup_or_halt(), cdc_setup_or_halt(), cm_bringup_clocks(), combo_setup_or_halt(), crc_demo_setup_or_halt(), demo_setup_or_halt(), demo_setup_or_halt(), dfu_setup_or_halt(), drw_blend_setup_or_halt(), drw_demo_setup_or_halt(), dtc_arm_setup_or_halt(), dtc_coh_setup_or_halt(), dtc_demo_setup_or_halt(), ep_bringup_core(), ez_bringup_clocks(), fileops_setup_or_halt(), flash_journal_setup_or_halt(), gpt_ecc_clocks_or_halt(), gptp_setup_or_halt(), hid_setup_or_halt(), i3c_demo_setup_or_halt(), iic_setup_or_halt(), imu_demo_setup_or_halt(), internal_acmphs_demo_setup(), internal_agt_periodic_setup_or_halt(), internal_audio_loopback_init_clocks_and_led(), internal_bkup_demo_setup_or_halt(), internal_blink_pins_init(), internal_can_demo_setup_or_halt(), internal_canfd_demo_setup_or_halt(), internal_canfd_filter_setup_or_halt(), internal_clock_check_pins_init(), internal_dac_b_demo_setup_or_halt(), internal_demo_clocks_or_halt(), internal_dotf_demo_setup_or_halt(), internal_gpio_demo_setup_or_halt(), internal_gpt_3p_demo_setup_or_halt(), internal_gpt_irq_demo_setup_or_halt(), internal_gpt_pwm_demo_setup_or_halt(), internal_icu_extint_demo_setup_or_halt(), internal_iic_peripheral_setup_or_halt(), internal_kat_setup_or_halt(), internal_lcd_bringup_clocks(), internal_lpm_deep_setup_or_halt(), internal_lpm_demo_setup_or_halt(), internal_lpm_wake_setup_or_halt(), internal_lvd_demo_setup_or_halt(), internal_mecc_setup_or_halt(), internal_motor_3phase_init_clocks_and_led(), internal_mpu_simple_setup_or_halt(), internal_pdg_demo_setup_or_halt(), internal_poeg_demo_setup_or_halt(), internal_rng_demo_setup_or_halt(), internal_setup_or_halt(), internal_uart_hello_setup_or_halt(), internal_usb_audio_clocks_or_halt(), internal_wdt_demo_setup_or_halt(), kat_setup_or_halt(), l3_setup_or_halt(), lcd_bringup_clocks(), lin_hil_setup_or_halt(), lpi_setup_or_halt(), main(), mg_bringup_clocks(), microsd_setup_or_halt(), mlun_setup_or_halt(), modem_setup_or_halt(), ospirw_setup_or_halt(), pdm_demo_io_or_halt(), pp_demo_modules_or_halt(), riic_target_setup_or_halt(), rot_setup_or_halt(), sb_setup_or_halt(), scb_demo_setup_or_halt(), sdmsc_setup_or_halt(), sdram_demo_setup_or_halt(), selftest_setup_or_halt(), sfr_bringup_clocks(), timer_demo_setup_or_halt(), tsn_setup_or_halt(), uart_irq_setup_or_halt(), wdt_rr_setup_or_halt(), wdt_window_demo_setup_or_halt(), and wlun_setup_or_halt().

◆ ra8_board_led_off()

ra8_err_t ra8_board_led_off ( ra8_board_led_id_t led)
nodiscard

Drive led LOW (extinguish it).

Return values
k_ra8_ok/ k_ra8_err_invalid_arg
Precondition
ra8_board_led_init(led) succeeded.
Postcondition
LED pin output latch == 0.

Definition at line 116 of file ra8_board_ra8p1.c.

References k_ra8_level_low, k_ra8_ok, k_ra8_pin_none, pin, ra8_board_led_pin(), and ra8_gpio_write().

Referenced by internal_gpio_demo_one_iter().

◆ ra8_board_led_on()

◆ ra8_board_led_pin()

ra8_err_t ra8_board_led_pin ( ra8_board_led_id_t led,
ra8_port_pin_t * out_pin )
nodiscard

Translate a board LED id into its underlying ra8_port_pin_t.

Parameters
[in]ledLED identifier.
[out]out_pinDestination pin id.
Return values
k_ra8_ok/ k_ra8_err_invalid_arg
Since
0.1.0

Definition at line 84 of file ra8_board_ra8p1.c.

References k_ra8_board_led_count, k_ra8_err_invalid_arg, k_ra8_ok, and s_led_pins.

Referenced by ra8_board_led_init(), ra8_board_led_off(), ra8_board_led_on(), and ra8_board_led_toggle().

◆ ra8_board_led_toggle()

◆ ra8_board_sw_attach_irq()

ra8_err_t ra8_board_sw_attach_irq ( ra8_board_sw_id_t sw,
ra8_board_sw_irq_cb_t cb,
void * ctx )
nodiscard

Wire sw to the ICU and register a falling-edge callback.

Buttons are active-low so a falling edge corresponds to a press. The HAL takes care of the PFS routing, IRQCR programming, and NVIC enable; this veneer just hides the specific channel number (UM Table 25) from the caller.

Return values
k_ra8_ok/ k_ra8_err_invalid_arg / k_ra8_err_gpio_conflict
Precondition
ra8_icu_init() has been called once during boot.
Postcondition
Pressing sw invokes cb(ctx) from the ICU ISR context.

Definition at line 204 of file ra8_board_ra8p1.c.

References k_ra8_board_sw1, k_ra8_board_sw_count, k_ra8_elc_event_icu_irq12, k_ra8_elc_event_icu_irq13, k_ra8_err_invalid_arg, k_ra8_icu_fclksel_pclkb, k_ra8_icu_irqmd_falling, k_ra8_isr_prio_default, k_ra8_ok, ra8_icu_configure_irq_pin(), ra8_isr_register(), and s_sw_irq_nums.

◆ ra8_board_sw_init()

ra8_err_t ra8_board_sw_init ( ra8_board_sw_id_t sw)
nodiscard

Configure a switch pin as an input with internal pull-up.

Return values
k_ra8_ok/ k_ra8_err_invalid_arg / k_ra8_err_gpio_conflict
Precondition
HAL pin validator initialized.
Postcondition
Pin is digital input, pull-up enabled.
Since
0.1.0

Definition at line 173 of file ra8_board_ra8p1.c.

References k_ra8_ok, k_ra8_pin_none, k_ra8_pull_up, pin, ra8_board_sw_pin(), and ra8_gpio_input_init().

Referenced by internal_gpio_demo_setup_or_halt(), internal_icu_extint_demo_setup_or_halt(), internal_kint_demo_arm(), internal_setup_or_halt(), main(), sh_input_init(), and wd_setup_or_halt().

◆ ra8_board_sw_pin()

ra8_err_t ra8_board_sw_pin ( ra8_board_sw_id_t sw,
ra8_port_pin_t * out_pin )
nodiscard

Translate a board switch id into its underlying ra8_port_pin_t.

Since
0.1.0

Definition at line 161 of file ra8_board_ra8p1.c.

References k_ra8_board_sw_count, k_ra8_err_invalid_arg, k_ra8_ok, and s_sw_pins.

Referenced by er_poll_buttons(), ra8_board_sw_init(), ra8_board_sw_read(), and wd_setup_or_halt().

◆ ra8_board_sw_read()

ra8_err_t ra8_board_sw_read ( ra8_board_sw_id_t sw,
ra8_board_sw_state_t * out_pressed )
nodiscard

Sample the current state of sw.

The buttons are wired active-low (press shorts the pin to GND); this function inverts the level so callers receive a positive "pressed = true" semantic.

Parameters
[in]swSwitch id.
[out]out_pressedSet to k_ra8_board_sw_pressed if held.
Return values
k_ra8_okRead complete.
k_ra8_err_invalid_argsw out of range or out_pressed NULL.
Precondition
ra8_board_sw_init(sw) succeeded.
Postcondition
*out_pressed is one of {released, pressed}.
Since
0.1.0

Definition at line 183 of file ra8_board_ra8p1.c.

References k_ra8_board_sw_pressed, k_ra8_board_sw_released, k_ra8_err_invalid_arg, k_ra8_level_high, k_ra8_level_low, k_ra8_ok, k_ra8_pin_none, pin, ra8_board_sw_pin(), and ra8_gpio_read().

Referenced by internal_edge(), internal_gpio_demo_one_iter(), ls_poll_buttons(), main(), sh_pump_input(), and sh_run().

◆ ra8_board_uart_console_flush()

ra8_err_t ra8_board_uart_console_flush ( void )
nodiscard

Block until every byte queued on the J-Link OB VCOM console has finished clocking out on the wire.

Block until every byte queued on the console has clocked out.

Thin wrapper around ra8_sci_flush(k_ra8_board_uart_console_sci_channel) that polls CSR.TEND on the SCI8 channel that backs the J-Link OB VCOM bridge (HUM Ch 38.2.17 "CSR : Common Status Register", p 2225). The intended caller is a panic-handler that needs the failure log to reach the host before WFI gates the SCI clock and silently drops the remaining FIFO contents.

Returns
ra8_err_t error code.
Return values
k_ra8_okTEND observed (or fake stub).
k_ra8_err_not_initializedra8_board_uart_console_init not called.
k_ra8_err_hw_timeoutSpin budget elapsed without TEND.
Precondition
ra8_board_uart_console_init succeeded.
Postcondition
On success, every byte previously passed to ra8_board_uart_console_write has been transmitted.
Note
Not thread-safe with respect to a concurrent ra8_board_uart_console_write – the writer may refill the shift register while the flush is polling.
See also
ra8_sci_flush
ra8_board_uart_console_write
Since
0.1.0

Definition at line 366 of file ra8_board_ra8p1.c.

References k_ra8_board_uart_console_sci_channel, k_ra8_err_not_initialized, ra8_sci_flush(), and s_uart_console_initialized.

Referenced by app_launch_hil_emit_pass(), app_shell_hil_emit_pass(), cache_hal_emit(), cache_mpu_emit(), demo_panic_halt(), dtc_coh_report(), dualcore_bg_hil_emit_pass(), dualcore_mailbox_hil_emit_pass(), imp_panic(), internal_emit_pass(), internal_npu_infer_emit(), internal_npu_smoke_emit(), internal_npu_vela_emit(), internal_rcs_panic_halt(), internal_report(), main(), and mpu_boot_emit().

◆ ra8_board_uart_console_init()

ra8_err_t ra8_board_uart_console_init ( uint32_t baud)
nodiscard

Configure SCI8 + PD02/PD03 as the debug-console UART.

Routes PD02 -> TXD8 and PD03 -> RXD8 (PSEL = SCI async) and brings SCI8 up via ra8_sci_init with 8N1 framing at the requested baud. The SCI module operating clock on RA8D2 is PCLKA (chip HUM Ch 38.2 "SCI registers"); the BRR divisor is computed from the current PCLKA frequency reported by ra8_cgc_get_clock_hz, so callers must call ra8_cgc_init() before ra8_board_uart_console_init. Applications that retune CGC afterwards must additionally call ra8_sci_set_baud((uint8_t)k_ra8_board_uart_console_sci_channel, baud, new_pclka_hz) to recompute the divisor.

Parameters
[in]baudTarget line rate in bps (e.g. 115200).
Return values
k_ra8_okConsole up, ready to TX/RX.
k_ra8_err_invalid_argbaud == 0.
k_ra8_err_not_initializedra8_cgc_init has not yet published a usable PCLKA value (chip still on MOCO / pre-PLL).
k_ra8_err_gpio_conflictPD02 or PD03 already owned.
k_ra8_err_hw_init_failedUnderlying ra8_sci_init failed.
Precondition
HAL pin validator initialized (single-threaded boot context).
ra8_cgc_init() has run and PCLKA is post-PLL.
ra8_mstp_init() has run.
Postcondition
SCI8 is enabled with TE=RE=1; PD02/PD03 are routed to SCI8.
BRR computed against the live PCLKA value (no hardcoded clock).
Note
Not thread-safe; call once during board bring-up.
Since
0.1.0

Definition at line 271 of file ra8_board_ra8p1.c.

References k_ra8_board_uart_console_min_pclka_hz, k_ra8_board_uart_console_pin_rxd, k_ra8_board_uart_console_pin_txd, k_ra8_board_uart_console_sci_channel, k_ra8_clock_id_pclka, k_ra8_err_invalid_arg, k_ra8_err_not_initialized, k_ra8_ok, k_ra8_psel_sci_async, k_ra8_sci_data_8, k_ra8_sci_parity_none, k_ra8_sci_stop_1, ra8_cgc_get_clock_hz(), ra8_pfs_route_peripheral(), ra8_sci_init(), and s_uart_console_initialized.

Referenced by adc_diag_setup_or_halt(), al_setup_or_halt(), app_bringup_clocks(), app_launch_hil_console_init(), app_setup(), app_shell_hil_console_init(), bm_setup_or_halt(), bs_setup_or_halt(), c6_fwver_setup_or_halt(), c6_hosted_setup_or_halt(), c6_join_setup_or_halt(), c6_probe_setup_or_halt(), c6_wifi_setup_or_halt(), cache_hal_setup(), cache_mpu_setup(), cam_bringup(), cdc_setup_or_halt(), ch_setup_or_halt(), cm_bringup_clocks(), combo_setup_or_halt(), crc_demo_setup_or_halt(), demo_setup_or_halt(), demo_setup_or_halt(), dfu_setup_or_halt(), drw_blend_setup_or_halt(), drw_demo_setup_or_halt(), dtc_arm_setup_or_halt(), dtc_coh_setup_or_halt(), dtc_demo_setup_or_halt(), dualcore_bg_hil_console_init(), dualcore_mailbox_hil_console_init(), ec_setup_or_halt(), ef_setup_or_halt(), ehb_setup_or_halt(), eoh_setup_or_halt(), eop_setup_or_halt(), ep_bringup_core(), ep_setup_or_halt(), erb_setup_or_halt(), es_setup_or_halt(), est_setup_or_halt(), etoc_setup_or_halt(), ez_bringup_clocks(), fc_setup_or_halt(), fileops_setup_or_halt(), fs_fmt_setup_or_halt(), gh_setup_or_halt(), gptp_setup_or_halt(), hid_setup_or_halt(), i3c_demo_setup_or_halt(), iic_setup_or_halt(), imp_setup_or_halt(), imu_demo_setup_or_halt(), internal_agt_periodic_setup_or_halt(), internal_audio_loopback_init_console(), internal_bkup_demo_setup_or_halt(), internal_c6_cam_setup_or_halt(), internal_console_init(), internal_demo_clocks_or_halt(), internal_demo_setup_or_halt(), internal_dotf_demo_setup_or_halt(), internal_eth_loopback_setup_or_halt(), internal_icu_extint_demo_setup_or_halt(), internal_kat_setup_or_halt(), internal_kint_demo_setup_or_halt(), internal_lpm_deep_setup_or_halt(), internal_lpm_demo_setup_or_halt(), internal_lpm_dpsby1_setup_or_halt(), internal_lpm_dpsby2_setup_or_halt(), internal_lpm_dpsby3_setup_or_halt(), internal_lpm_swstd_setup_or_halt(), internal_lpm_wake_setup_or_halt(), internal_lus_setup_or_halt(), internal_lvd_demo_setup_or_halt(), internal_mecc_setup_or_halt(), internal_motor_3phase_init_console(), internal_mpu_simple_setup_or_halt(), internal_npu_infer_setup_or_halt(), internal_npu_smoke_setup_or_halt(), internal_npu_vela_setup_or_halt(), internal_pc_setup_or_halt(), internal_pdg_demo_setup_or_halt(), internal_poeg_demo_setup_or_halt(), internal_rc_setup_or_halt(), internal_rcs_setup_or_halt(), internal_rng_demo_setup_or_halt(), internal_rtc_demo_setup_or_halt(), internal_sd_demo_setup_or_halt(), internal_setup_or_halt(), internal_ssie_loop_setup_or_halt(), internal_tc_setup_or_halt(), internal_td_setup_or_halt(), internal_uart_hello_setup_or_halt(), internal_usb_audio_setup_or_halt(), internal_wdt_demo_setup_or_halt(), ipc_demo_setup_or_halt(), iu_setup_or_halt(), iv_setup_or_halt(), kat_setup_or_halt(), kb_setup_or_halt(), l3_setup_or_halt(), lin_hil_setup_or_halt(), lk_setup_or_halt(), lpi_setup_or_halt(), main(), mem_setup_or_halt(), mg_bringup_clocks(), microsd_setup_or_halt(), mlun_setup_or_halt(), modem_setup_or_halt(), mpu_boot_setup(), ospirw_setup_or_halt(), pdm_demo_io_or_halt(), pp_demo_clocks_or_halt(), ra8_nsc_periph_init(), riic_target_setup_or_halt(), rot_setup_or_halt(), sb_setup_or_halt(), sbns_console_bringup(), scb_demo_setup_or_halt(), sd_demo_setup_or_halt(), sd_setup_or_halt(), sdhi_card_setup_or_halt(), sdhi_demo_setup_or_halt(), sdmsc_setup_or_halt(), sdram_demo_setup_or_halt(), selftest_setup_or_halt(), sh_setup_or_halt(), tb_setup_or_halt(), timer_demo_setup_or_halt(), tsn_setup_or_halt(), wa_setup_or_halt(), wc_setup_or_halt(), wd_setup_or_halt(), wdt_rr_setup_or_halt(), wdt_window_demo_setup_or_halt(), webp_demo_setup_or_halt(), wifi_hal_setup_or_halt(), wk_setup_or_halt(), and wlun_setup_or_halt().

◆ ra8_board_uart_console_read()

ra8_err_t ra8_board_uart_console_read ( uint8_t * out,
size_t cap,
size_t * out_len )
nodiscard

Polled non-blocking read from the J-Link OB VCOM console.

Polled non-blocking read from the debug VCOM console.

Drains up to cap bytes from SCI8 RDR while RDRF stays set. Stops (without error) the first time RDRF clears so the call never blocks waiting for a host that is silent.

Parameters
[out]outDestination buffer (non-NULL when cap > 0).
[in]capCapacity of out in bytes.
[out]out_lenNumber of bytes actually read; non-NULL.
Return values
k_ra8_okRead complete; *out_len in [0, cap].
k_ra8_err_invalid_argout / out_len NULL with non-zero cap.
k_ra8_err_not_initializedConsole not initialized.
Precondition
ra8_board_uart_console_init succeeded.
Postcondition
0 <= *out_len <= cap.
Since
0.1.0

Definition at line 333 of file ra8_board_ra8p1.c.

References k_ra8_board_uart_console_sci_channel, k_ra8_err_invalid_arg, k_ra8_err_not_initialized, k_ra8_ok, ra8_sci_getc_polling(), and s_uart_console_initialized.

◆ ra8_board_uart_console_write()

ra8_err_t ra8_board_uart_console_write ( const uint8_t * data,
size_t len )
nodiscard

Polled blocking write to the J-Link OB VCOM console.

Polled blocking write to the debug VCOM console.

Parameters
[in]dataBytes to transmit; must be non-NULL when len > 0.
[in]lenNumber of bytes in data.
Return values
k_ra8_okAll bytes pushed to TDR.
k_ra8_err_invalid_argdata NULL with non-zero len.
k_ra8_err_not_initializedra8_board_uart_console_init not called.
Precondition
ra8_board_uart_console_init succeeded.
Postcondition
All len bytes have been handed to the SCI8 TDR shift register.
Since
0.1.0

Definition at line 319 of file ra8_board_ra8p1.c.

References k_ra8_board_uart_console_sci_channel, k_ra8_err_invalid_arg, k_ra8_err_not_initialized, k_ra8_ok, ra8_sci_write_polling(), and s_uart_console_initialized.

Referenced by adc_diag_write(), al_print(), app_launch_hil_emit_pass(), app_print(), app_shell_hil_emit_pass(), bm_print(), bs_print(), c6_cam_put_u32(), c6_cam_puts(), c6_fwver_put_hex(), c6_fwver_put_text(), c6_fwver_put_u32(), c6_fwver_puts(), c6_hosted_put_hex(), c6_hosted_put_u32(), c6_hosted_puts(), c6_join_put_hex(), c6_join_put_u32(), c6_join_puts(), c6_probe_put_hex(), c6_probe_put_u32(), c6_probe_puts(), c6_wifi_put_hex(), c6_wifi_put_text(), c6_wifi_put_u32(), c6_wifi_puts(), cache_hal_emit(), cache_mpu_emit(), cam_put_hex(), cam_put_u32(), cam_puts(), cdc_sci_write(), ch_print(), cm_print(), crc_demo_one_iter(), demo_drain_print_job(), demo_emit(), demo_print(), demo_puts(), demo_read_test_file(), demo_report(), dfu_sci_write(), dfu_sci_write(), drw_blend_print_hex(), drw_blend_print_pass(), dtc_coh_report(), dualcore_bg_hil_emit_pass(), dualcore_mailbox_hil_emit_pass(), ec_print(), ef_print(), ehb_write(), eoh_print(), eop_log_sink(), eop_print(), ep_emit(), ep_print(), erb_print(), es_print(), est_print(), etoc_print(), ez_print(), fc_log_sink(), fc_print(), fileops_sci_write(), fs_fmt_print(), gh_print(), gptp_write(), hid_sci_write(), hid_sci_write(), iic_print(), imp_print(), imu_demo_tx(), internal_audio_loopback_print_count(), internal_bkup_demo_report_survival(), internal_demo_log(), internal_demo_print(), internal_demo_write_bytes(), internal_emit_pass(), internal_emit_tick(), internal_log_sink(), internal_lpm_demo_one_wake(), internal_motor_3phase_print_duty(), internal_mpu_simple_emit_banner(), internal_npu_infer_write(), internal_npu_smoke_write(), internal_npu_vela_write(), internal_pc_print(), internal_print(), internal_puts(), internal_rc_print(), internal_rcs_print(), internal_report(), internal_rng_demo_emit_one_line(), internal_sd_demo_print(), internal_sdcard_log(), internal_tc_print(), internal_td_print(), internal_usb_audio_log(), ipc_demo_log(), iu_print(), iv_print(), kat_setup_or_halt(), kb_print(), l3_write(), lk_print(), lpi_do_work(), ls_print(), main(), mem_print(), mg_print(), microsd_sci_write(), mlun_sci_write(), modem_tx(), mpu_boot_emit(), ospirw_sci_write(), pdm_demo_tx(), riic_target_on_event(), rot_write(), sb_write(), sbns_console_print_hex32(), sbns_console_say(), scb_demo_write(), sd_demo_print(), sd_print(), sdhi_card_print(), sdhi_demo_print(), sdmsc_sci_write(), selftest_sci_write(), selftest_sci_write(), selftest_sci_write(), selftest_sci_write(), selftest_sci_write(), sh_print(), tb_print(), timer_demo_one_capture(), tsn_write(), wa_print(), wc_print(), wd_print(), wdt_rr_arm_and_wait_for_reset(), wdt_window_demo_banner(), wifi_hal_put_hex(), wifi_hal_put_u32(), wifi_hal_puts(), wk_print(), and wlun_sci_write().

Variable Documentation

◆ k_ra8_board_doc_rev

const char* const k_ra8_board_doc_rev = "R01UH1064EJ (chip HUM)"

"R20UT5523EG0101 Rev 1.01".

"R01UH1064EJ (chip HUM)".

Definition at line 48 of file ra8_board_ra8p1.c.

Referenced by ra8_board_get_info().

◆ k_ra8_board_mcu

const char* const k_ra8_board_mcu = "R7KA8P1KFLCAC"

"R7KA8D2KFLCAC".

"R7KA8P1KFLCAC".

Definition at line 49 of file ra8_board_ra8p1.c.

Referenced by ra8_board_get_info().

◆ k_ra8_board_name

const char* const k_ra8_board_name = "RA8P1 foundation board"

Human-readable strings identifying this BSP target.

Returned by ra8_board_get_info() so applications can log / verify the board they were built for. All three are ASCII string literals with permanent storage duration. "EK-RA8D2 v1".

Definition at line 47 of file ra8_board_ra8p1.c.

Referenced by ra8_board_get_info().

◆ s_led_pins

const ra8_port_pin_t s_led_pins[k_ra8_board_led_count]
static
Initial value:
= {
(ra8_port_pin_t) ((ra8_port_pin_t)(((uint16_t)(k_ra8_port_6) << 8) | (uint16_t)(k_ra8_pin_0))) ,
(ra8_port_pin_t) ((ra8_port_pin_t)(((uint16_t)(k_ra8_port_3) << 8) | (uint16_t)(k_ra8_pin_3))) ,
(ra8_port_pin_t) ((ra8_port_pin_t)(((uint16_t)(k_ra8_port_10) << 8) | (uint16_t)(k_ra8_pin_7))) ,
}
@ k_ra8_board_led2
LED2, GREEN, P303 (jumper E26).
@ k_ra8_board_led1
LED1, BLUE, P600 (jumper E27).
@ k_ra8_board_led3
LED3, RED, PA07 (jumper E28).
ra8_port_pin_t
Packed (port << 8) | pin pin identifier.
@ k_ra8_port_3
RA8 port 3.
@ k_ra8_port_6
RA8 port 6.
@ k_ra8_port_10
RA8 port 10.
@ k_ra8_pin_7
RA8 pin 7.
@ k_ra8_pin_0
RA8 pin 0.
@ k_ra8_pin_3
RA8 pin 3.

Lookup table from ra8_board_led_id_t to ra8_port_pin_t.

Index by ra8_board_led_id_t (LED1=0, LED2=1, LED3=2). Provisional pins mirrored from the EK-RA8D2 layout; valid GPIO outputs on the RA8P1 (chip HUM R01UH1064EJ Ch 20). TODO(EK-RA8P1 UM / ra8p1_kicad): re-derive from schematic.

Definition at line 75 of file ra8_board_ra8p1.c.

◆ s_sw_irq_nums

const uint8_t s_sw_irq_nums[k_ra8_board_sw_count]
static
Initial value:
= {
}
@ k_ra8_board_sw1
SW1, P009, IRQ13-DS (jumper E31).
@ k_ra8_board_sw2
SW2, P008, IRQ12-DS (jumper E32).
@ k_ra8_board_sw2_irq
SW2 -> IRQ12-DS.
@ k_ra8_board_sw1_irq
SW1 -> IRQ13-DS.

Lookup table from ra8_board_sw_id_t to ICU IRQ channel.

Definition at line 156 of file ra8_board_ra8p1.c.

◆ s_sw_pins

const ra8_port_pin_t s_sw_pins[k_ra8_board_sw_count]
static
Initial value:
= {
(ra8_port_pin_t) ((ra8_port_pin_t)(((uint16_t)(k_ra8_port_0) << 8) | (uint16_t)(k_ra8_pin_9))) ,
(ra8_port_pin_t) ((ra8_port_pin_t)(((uint16_t)(k_ra8_port_0) << 8) | (uint16_t)(k_ra8_pin_8))) ,
}
@ k_ra8_port_0
RA8 port 0.
@ k_ra8_pin_9
RA8 pin 9.
@ k_ra8_pin_8
RA8 pin 8.

Lookup table from ra8_board_sw_id_t to ra8_port_pin_t.

SW1 -> P009, SW2 -> P008 (provisional; valid IRQ-capable GPIO inputs on the RA8P1, chip HUM R01UH1064EJ Ch 20). TODO(EK-RA8P1 UM / ra8p1_kicad).

Definition at line 148 of file ra8_board_ra8p1.c.

◆ s_uart_console_initialized

bool s_uart_console_initialized = false
static

Tracks whether ra8_board_uart_console_init has succeeded.

Set true after ra8_sci_init returns ok and the PFS routes are programmed. The write/read/flush helpers refuse to forward to ra8_sci while this flag is false so callers cannot drive an unconfigured channel.

Note
Written once during console init; read by the write/read/flush helpers.
Warning
Do not modify outside ra8_board_uart_console_init.
Since
0.1.0

Definition at line 251 of file ra8_board_ra8p1.c.