38#include "esp_hosted_os_abstraction.h"
73typedef enum : uint8_t {
152 if ((chip_select == handshake) || (chip_select == data_ready) || (handshake == data_ready)) {
355 "esp-hosted port up on SCI%u at %u Hz",
357 (
unsigned int)cfg->
sck_hz);
#define ESP_LOGI(tag,...)
Log a normal life-cycle milestone.
#define ESP_LOGE(tag,...)
Log a fault the caller cannot recover from itself.
esp-hosted port header: transport selection, side-band pin map, link polarity.
#define H_GPIO_HANDSHAKE_Pin
Pin index of the HANDSHAKE input, or -1 when it is not wired.
#define H_GPIO_HANDSHAKE_Port
Opaque port handle of the HANDSHAKE input.
#define H_GPIO_DATA_READY_Port
Opaque port handle of the DATA_READY input.
#define H_DR_VAL_ACTIVE
Level read back on DATA_READY when a frame is waiting.
#define H_GPIO_DATA_READY_Pin
Pin index of the DATA_READY input, or -1 when it is not wired.
esp-hosted port header: the per-file log tag the core expects.
#define DEFINE_LOG_TAG(tag)
Declare the file-scope s_esp_hosted_tag string the ESP_LOGx macros use.
esp-hosted port header: RTOS handle types, return codes and budgets.
#define H_GPIO_MODE_DEF_INPUT
Configure a side-band pin as a digital input.
#define RET_OK
Operation completed.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
ra8_board_eth_pin_t pin
Pin.
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_err_not_initialized
Module not initialized – _init() not yet called successfully.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
@ k_ra8_err_gpio_conflict
GPIO pin already owned by another peripheral or driver.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
ra8_err_t priv_ra8_esp_hosted_gpio_set_edge_poll_ms(uint16_t period_ms)
Set the sampling period the software edge detector runs at.
Module-private surface of the esp-hosted side-band GPIO slice.
hosted_osi_funcs_t g_hosted_osi_funcs
The OS-abstraction vtable the vendored core calls through.
static const char * s_esp_hosted_tag
ra8_err_t priv_ra8_esp_hosted_osi_bind_all(hosted_osi_funcs_t *out)
Implementation of priv_ra8_esp_hosted_osi_bind_all() – fills every row, then proves none was missed.
struct hosted_config_t g_h
The handle the vendored core dereferences to reach the vtable.
Library-private surface of the esp-hosted OS-abstraction vtable.
THE single point of change for the RA8 <-> ESP32-C6 harness map.
@ k_ra8_esp_hosted_pin_chip_select
Chip select, RA8 output.
@ k_ra8_esp_hosted_pin_data_ready
DATA_READY, RA8 input, C6 output.
@ k_ra8_esp_hosted_pin_handshake
HANDSHAKE, RA8 input, C6 output.
ra8_err_t priv_ra8_esp_hosted_port_cfg_check(const ra8_esp_hosted_port_cfg_t *cfg)
Implementation of priv_ra8_esp_hosted_port_cfg_check() – a pure predicate, so bring-up can reject a c...
static ra8_err_t internal_bring_up(const ra8_esp_hosted_port_cfg_t *cfg)
Bring the port's slices up in dependency order.
static bool internal_pin_in_range(uint16_t pin)
Whether a packed pin code decodes to a legal port and pin index.
ra8_err_t priv_ra8_esp_hosted_port_first_error(ra8_err_t first, ra8_err_t next)
Implementation of priv_ra8_esp_hosted_port_first_error() – a pure fold, so the unwind path carries no...
bool ra8_esp_hosted_port_is_ready(void)
Implementation of ra8_esp_hosted_port_is_ready() – one aligned load, so it is safe from any context.
ra8_err_t priv_ra8_esp_hosted_port_pins_check(void)
Implementation of priv_ra8_esp_hosted_port_pins_check() – applies the value check to the compiled-in ...
static ra8_err_t internal_unwind(void)
Release everything the bring-up path may have claimed.
ra8_esp_hosted_port_limit_t
Bounds the bring-up path validates against.
@ k_ra8_esp_hosted_port_sci_channels
SCI channels on this part; a channel index must be below this.
ra8_err_t ra8_esp_hosted_port_init(const ra8_esp_hosted_port_cfg_t *cfg)
Implementation of ra8_esp_hosted_port_init() – validate, then bring the slices up in dependency order...
ra8_err_t priv_ra8_esp_hosted_port_pins_check_values(uint16_t chip_select, uint16_t handshake, uint16_t data_ready)
Implementation of priv_ra8_esp_hosted_port_pins_check_values() – distinctness first,...
static ra8_err_t internal_configure_sideband(void)
Configure the two side-band nets as digital inputs.
bool ra8_esp_hosted_port_rx_pending(void)
Report whether the co-processor has queued receive data.
static bool s_ra8_esp_hosted_port_ready
Whether the port has completed bring-up and not been torn down.
ra8_err_t ra8_esp_hosted_port_deinit(void)
Implementation of ra8_esp_hosted_port_deinit() – refuses when the port was never up,...
Public entry point of the RA8D2 + ThreadX port of esp-hosted.
struct ra8_esp_hosted_port_cfg ra8_esp_hosted_port_cfg_t
Library-private surface of the esp-hosted port bring-up.
ra8_err_t priv_ra8_esp_hosted_rtos_deinit(void)
Tear the RTOS substrate down, deleting every outstanding object.
ra8_err_t priv_ra8_esp_hosted_rtos_init(void)
Bring the RTOS substrate up: byte pools and empty object tables.
Module-private contract of the esp-hosted RTOS abstraction slice.
ra8_err_t priv_ra8_esp_hosted_spi_close(void)
Close the SCI Simple-SPI channel and release every pin it took.
ra8_err_t priv_ra8_esp_hosted_spi_open(uint8_t sci_channel, uint32_t pclk_hz, uint32_t sck_hz)
Route the Pmod1 SPI pins and open the SCI Simple-SPI channel.
Module-private surface of the esp-hosted full-duplex SPI transport.
Typed Port / Pin Constants for the RA8D2 IOPORT Module.
@ k_ra8_port_max
Highest valid port index.
@ k_ra8_pin_max
Highest valid pin index.
#define RA8_PIN_PORT(p)
Extract the port index from a packed ra8_port_pin_t.
#define RA8_PIN_PIN(p)
Extract the pin index from a packed ra8_port_pin_t.
uint16_t edge_poll_ms
Sampling period for pins with no ICU channel.
uint32_t pclk_hz
PCLKA rate in hertz; the SCI baud clock source.
uint32_t sck_hz
Requested SPI bit rate in hertz.
uint8_t sci_channel
SCI channel carrying Simple-SPI; 0..9.