43#include "esp_hosted_os_abstraction.h"
44#include "esp_hosted_transport_config.h"
81typedef enum : uint8_t {
101static const char*
const s_tag =
"C6OSI";
159struct hosted_config_t
g_h = HOSTED_CONFIG_INIT_DEFAULT();
165 if ((cb ==
nullptr) && (ctx !=
nullptr)) {
184 if ((data ==
nullptr) && (data_len != 0U)) {
188 (base ==
nullptr) ?
"" : base,
227 size_t event_data_size,
228 uint32_t ticks_to_wait)
262 size_t event_data_size,
263 uint32_t ticks_to_wait)
295[[gnu::format(printf, 3, 4)]]
static void
299 va_start(ap, format);
396 "host power save %u not enabled (pin %u level %d)",
397 (
unsigned int)power_save_type,
398 (
unsigned int)gpio_num,
455 void (*
rows[
sizeof(hosted_osi_funcs_t) /
sizeof(
void (*)(
void))])(void);
458static_assert(
sizeof(hosted_osi_funcs_t) %
sizeof(void (*)(void)) == 0U,
459 "the esp-hosted vtable must be a whole number of function pointers");
467 if (table ==
nullptr) {
472 const uint32_t rows = (uint32_t)(
sizeof(view.
rows) /
sizeof(view.
rows[0]));
474 for (uint32_t i = 0U; i < rows; i++) {
475 if (view.
rows[i] ==
nullptr) {
489 *out = (hosted_osi_funcs_t){};
531 struct esp_hosted_spi_config cfg = {};
const char * esp_event_base_t
Identity of an event-producing subsystem.
ESP-IDF-compatible logging surface, implemented by this port.
#define ESP_LOGW(tag,...)
Log something unexpected that was handled anyway.
#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_PIN_RESET
Pin index of the co-processor reset output, or -1 when unwired.
#define RA8_ESP_HOSTED_GPIO_PORT(pin_code)
Extract the void* port half of a packed RA8 pin.
#define H_GPIO_DATA_READY_Port
Opaque port handle of the DATA_READY input.
#define RA8_ESP_HOSTED_GPIO_PIN(pin_code)
Extract the int pin half of a packed RA8 pin, or -1 if unwired.
#define H_SPI_FD_CLK_MHZ
Full-duplex SPI clock, in megahertz.
#define H_TRANSPORT_QUEUE_SIZE
Frames a single transport direction can hold.
#define H_GPIO_PORT_RESET
Opaque port handle of the co-processor reset output.
#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 RET_FAIL
Operation failed for an unspecified reason.
#define RET_INVALID
A parameter was out of contract (null handle, bad size).
#define RET_OK
Operation completed.
esp-hosted port header: full-duplex SPI transport buffer size.
static const char * s_tag
Logging / check tag.
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).
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_ok
Success – operation completed with all postconditions satisfied.
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_bind(hosted_osi_funcs_t *out)
Populate the eight GPIO slots of the OS-abstraction vtable.
Module-private surface of the esp-hosted side-band GPIO slice.
void priv_ra8_esp_hosted_log_vwrite(int level, const char *tag, const char *fmt, va_list ap)
Implementation of priv_ra8_esp_hosted_log_vwrite() – formats onto a bounded stack line,...
Library-private surface of the esp-hosted logging bridge.
hosted_osi_funcs_t g_hosted_osi_funcs
The OS-abstraction vtable the vendored core calls through.
static void * s_ra8_esp_hosted_event_ctx
Opaque context handed back to s_ra8_esp_hosted_event_cb.
static void internal_printf(int level, const char *tag, const char *format,...)
Vtable row: emit one formatted log line.
ra8_err_t ra8_esp_hosted_port_set_event_cb(ra8_esp_hosted_event_cb_t cb, void *ctx)
Implementation of ra8_esp_hosted_port_set_event_cb() – stores the pair atomically enough for a bring-...
static int internal_restart_host(void)
Vtable row: restart the host processor.
static const char *const s_event_base_wifi
Namespace reported for events the core posts as Wi-Fi events.
static void internal_init_hook(void)
Vtable row: run whatever the host needs before the core starts.
int priv_ra8_esp_hosted_osi_dispatch_event(const char *base, int32_t event_id, const void *data, size_t data_len)
Implementation of priv_ra8_esp_hosted_osi_dispatch_event() – the one decision behind both event rows,...
static const char * s_esp_hosted_tag
static int internal_start_host_power_save(uint32_t power_save_type)
Vtable row: enter host power save.
static ra8_esp_hosted_event_cb_t s_ra8_esp_hosted_event_cb
Application callback invoked when the core posts a link event.
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.
union ra8_esp_hosted_osi_view ra8_esp_hosted_osi_view_t
static int internal_event_wifi_post(int32_t event_id, void *event_data, size_t event_data_size, uint32_t ticks_to_wait)
Vtable row: post a Wi-Fi event.
bool priv_ra8_esp_hosted_osi_is_complete(const hosted_osi_funcs_t *table)
Implementation of priv_ra8_esp_hosted_osi_is_complete() – scans the table row-wise through a union,...
struct hosted_config_t g_h
The handle the vendored core dereferences to reach the vtable.
static int internal_event_post(esp_event_base_t event_base, int32_t event_id, void *event_data, size_t event_data_size, uint32_t ticks_to_wait)
Vtable row: post a generic esp-hosted event.
static int internal_config_host_power_save(uint32_t power_save_type, void *gpio_port, uint32_t gpio_num, int level)
Vtable row: configure the host's power-save wake source.
ra8_esp_hosted_osi_const_t
Fixed values the non-slice vtable rows report.
@ k_ra8_esp_hosted_osi_queue_depth
Queue depth for each of the two transmit and receive priority queues, restated here so the SPI config...
@ k_ra8_esp_hosted_osi_spi_mode
SPI mode the co-processor image is built for.
@ k_ra8_esp_hosted_osi_wakeup_reboot
Wake-up reason meaning the host performed an ordinary reboot.
struct esp_hosted_spi_config esp_hosted_get_default_spi_config(void)
void priv_ra8_esp_hosted_osi_bind_absent(hosted_osi_funcs_t *out)
Implementation of priv_ra8_esp_hosted_osi_bind_absent() – fills all sixteen rows so none is ever left...
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_copi
Controller-out peripheral-in data, RA8 output, routed to the SCI channel rather than driven as a GPIO...
@ k_ra8_esp_hosted_pin_cipo
Controller-in peripheral-out data, RA8 input, routed to the SCI channel rather than sampled as a GPIO...
@ k_ra8_esp_hosted_pin_sck
Serial clock, RA8 output, routed to the SCI channel.
Public entry point of the RA8D2 + ThreadX port of esp-hosted.
bool ra8_esp_hosted_port_is_ready(void)
Report whether the port is currently initialised.
void ra8_esp_hosted_mem_dump(const char *label)
Report transport pool occupancy at a named point.
void(* ra8_esp_hosted_event_cb_t)(void *ctx, const char *base, int32_t event_id, const void *data, size_t data_len)
Application handler for an event the vendored core posts.
ra8_err_t priv_ra8_esp_hosted_rtos_bind(hosted_osi_funcs_t *out)
Populate the thread, sleep, timer and clock slots of the vtable.
Module-private contract of the esp-hosted RTOS abstraction slice.
ra8_err_t priv_ra8_esp_hosted_rtos_bind_sync(hosted_osi_funcs_t *out)
Populate the mutex and semaphore slots of the vtable.
ra8_err_t priv_ra8_esp_hosted_rtos_bind_pool(hosted_osi_funcs_t *out)
Populate the memory and queue slots of the vtable.
ra8_err_t priv_ra8_esp_hosted_spi_bind(hosted_osi_funcs_t *out)
Populate the three transport slots of the OS-abstraction vtable.
Module-private surface of the esp-hosted full-duplex SPI transport.
Row-wise view of the vtable, for the completeness scan.
hosted_osi_funcs_t table
The table as the vendored core sees it.
void(*[sizeof(hosted_osi_funcs_t)/sizeof(void(*)(void))]) rows(void)
The same bytes as a flat array of rows.