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

The three transport slots of the esp-hosted OS-abstraction vtable. More...

#include <stdint.h>
#include "port_esp_hosted_host_os.h"
#include "port_esp_hosted_host_spi.h"
#include "ra8_attributes.h"
#include "ra8_board_ek_ra8d2_connectors.h"
#include "ra8_check.h"
#include "ra8_err.h"
#include "ra8_esp_hosted_pins.h"
#include "ra8_esp_hosted_spi_internal.h"
#include "ra8_gpio_constants.h"
#include "ra8_io_spi_bus.h"
#include "ra8_io_spi_bus_sci_spi.h"
#include "ra8_log.h"
#include "ra8_pin_interface.h"
#include "ra8_port_constants.h"
#include "ra8_port_utils.h"
#include "ra8_sci_spi.h"
#include "ra8_spi.h"
#include "transport_drv.h"
Include dependency graph for ra8_esp_hosted_spi.c:

Go to the source code of this file.

Enumerations

enum  ra8_esp_hosted_spi_frame_t : uint16_t { k_ra8_esp_hosted_spi_frame_bytes = (uint16_t)MAX_TRANSPORT_BUFFER_SIZE }
 The frame bound this port supplies, as a named constant. More...

Functions

static const ra8_pin_interface_tinternal_pin_if (void)
 Report the pin driver the chip select is driven through.
static const ra8_io_spi_bus_tinternal_bus (void)
 Report the bus the transfer slot should clock through.
static ra8_err_t internal_route_data_pins (void)
 Route the three Pmod1 SPI data pins to the SCI peripheral.
static void internal_release_pins (void)
 Hand every pin the transport claimed back to the pin validator.
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.
ra8_err_t priv_ra8_esp_hosted_spi_close (void)
 Close the SCI Simple-SPI channel and release every pin it took.
bool priv_ra8_esp_hosted_spi_is_open (void)
 Report whether the SCI Simple-SPI channel is currently open.
void priv_ra8_esp_hosted_spi_set_bus (const ra8_io_spi_bus_t *bus)
 Replace the SPI bus the transfer slot clocks frames through.
void priv_ra8_esp_hosted_spi_set_pin_interface (const ra8_pin_interface_t *iface)
 Replace the pin driver the transfer slot drives chip select with.
static void * internal_bus_init (void)
 _h_bus_init: hand the vendored transport its opaque bus handle.
static int internal_bus_deinit (void *bus_handle)
 _h_bus_deinit: close the channel behind an opaque bus handle.
static int internal_do_bus_transfer (void *transfer_context)
 _h_do_bus_transfer: clock one full-duplex esp-hosted frame.
ra8_err_t priv_ra8_esp_hosted_spi_bind (hosted_osi_funcs_t *out)
 Populate the three transport slots of the OS-abstraction vtable.

Variables

static const char *const s_tag = "eh_spi"
 Log tag identifying lines emitted by the SPI transport slice.
static ra8_io_spi_bus_t s_bus
 Bus handle bound to the SCI Simple-SPI channel by the open.
static const ra8_io_spi_bus_ts_injected_bus
 Test-injected replacement for s_bus, or null in production.
static const ra8_pin_interface_ts_pin_if
 Pin driver the chip select is configured and driven through.
static uint8_t s_channel
 SCI channel the open brought up, meaningful only while s_open.
static bool s_open
 True between a successful open and its matching close.
const ra8_pin_interface_t g_ra8_gpio_pin_interface

Detailed Description

The three transport slots of the esp-hosted OS-abstraction vtable.

Tag
[Ring 4 / PORT] {World: NS}

One esp-hosted transaction is one 1600-byte full-duplex SPI frame: the host clocks a transmit buffer out while the co-processor clocks its own frame back, and both directions complete or neither does. That is exactly the shape of ra8_io_spi_bus_write_read, so the transfer slot is a single call to it wrapped in chip-select sequencing.

Chip-select timing
The C6 image is built CONFIG_ESP_SPI_DEASSERT_HS_ON_CS, so it drops HANDSHAKE the moment the chip select falls: the falling edge is the event that starts the transaction on the co-processor side, and the frame must follow it. No artificial setup delay is inserted – the pin write, the bus-handle check and the SCI transmit-data-register write already separate the two by tens of nanoseconds on a 1 GHz Cortex-M85, which is far more than the peripheral needs. The hold is structural rather than timed: ra8_io_spi_bus_write_read polls each frame to completion on the SCI Simple-SPI backend, so the last clock edge has retired before the call returns and therefore before the chip select rises.
Since
0.1.0

Definition in file ra8_esp_hosted_spi.c.

Enumeration Type Documentation

◆ ra8_esp_hosted_spi_frame_t

enum ra8_esp_hosted_spi_frame_t : uint16_t

The frame bound this port supplies, as a named constant.

MAX_TRANSPORT_BUFFER_SIZE is whichever value transport_drv.h picked up from the port header its transport-selection chain chose. Binding it to an enumerator here gives the assertion below a symbol to compare against the constant the vendored SPI driver actually clocks, instead of comparing one spelling of a macro with another spelling of the same macro.

Invariant
k_ra8_esp_hosted_spi_frame_bytes equals MAX_SPI_BUFFER_SIZE – asserted immediately below, because the two coming apart means this port and the driver would clock different frames.
Example:
static uint8_t frame[k_ra8_esp_hosted_spi_frame_bytes];
@ k_ra8_esp_hosted_spi_frame_bytes
Bytes clocked in one full-duplex transaction, from the port header.
See also
ra8_esp_hosted_spi_transfer
Since
0.1.0
Enumerator
k_ra8_esp_hosted_spi_frame_bytes 

Bytes clocked in one full-duplex transaction, from the port header.

Definition at line 96 of file ra8_esp_hosted_spi.c.

Function Documentation

◆ internal_bus()

const ra8_io_spi_bus_t * internal_bus ( void )
static

Report the bus the transfer slot should clock through.

An injected bus wins over the internally bound one, so a test can drive the transfer path with no channel open. When neither is available the result is null and the caller reports failure rather than clocking a dead channel.

Returns
The bus to use, or null when none is usable.
Return values
non-nullA backend vtable is bound into the returned handle.
nullptrNothing is injected and no open has bound a backend.
Precondition
An injected handle, when present, out-lives the call.
The caller treats null as "cannot transfer".
Postcondition
No module state is modified.
A non-null result always has a bound iface.
Note
Safe from interrupt context; two aligned loads.
Since
0.1.0

Definition at line 232 of file ra8_esp_hosted_spi.c.

References s_bus, and s_injected_bus.

Referenced by internal_bus_init(), and internal_do_bus_transfer().

◆ internal_bus_deinit()

int internal_bus_deinit ( void * bus_handle)
static

_h_bus_deinit: close the channel behind an opaque bus handle.

Accepts only the handle _h_bus_init produced, so a stray pointer cannot tear the transport down. A close on an already-closed bus reports failure rather than success, which is what lets the port's own teardown tell "I closed it" from "it was already gone".

Parameters
[in]bus_handleThe handle _h_bus_init returned.
Returns
int Vendored return code.
Return values
RET_OKThe channel was closed and its pins released.
RET_INVALIDbus_handle was null or not ours.
RET_FAILThe bus was not open, or the HAL refused.
Precondition
The vendored transport has stopped clocking frames.
No transfer is in flight.
Postcondition
On RET_OK no link pin is claimed by this module.
An unrecognised handle changes nothing.
Note
Not thread-safe.
Since
0.1.0

Definition at line 446 of file ra8_esp_hosted_spi.c.

References k_ra8_ok, priv_ra8_esp_hosted_spi_close(), RET_FAIL, RET_INVALID, RET_OK, and s_bus.

Referenced by priv_ra8_esp_hosted_spi_bind().

◆ internal_bus_init()

void * internal_bus_init ( void )
static

_h_bus_init: hand the vendored transport its opaque bus handle.

The channel itself is opened by the port's bring-up, not here: the vendored driver has no clocking configuration to give and simply asserts that the handle is non-null. Reporting null when no bus is usable is therefore the honest answer – it makes the transport refuse to start rather than clock a channel that was never enabled.

Returns
void* The opaque bus handle, or null.
Return values
non-nullA bus is bound and transfers can proceed.
nullptrNo open has run and nothing was injected.
Precondition
priv_ra8_esp_hosted_spi_open has run, or a bus was injected.
The returned handle is only ever passed back to _h_bus_deinit.
Postcondition
No module state is modified.
The result is null exactly when a transfer would fail.
Note
Not thread-safe with respect to the open and close pair.
Since
0.1.0

Definition at line 411 of file ra8_esp_hosted_spi.c.

References internal_bus(), ra8_log_warn, s_bus, and s_tag.

Referenced by priv_ra8_esp_hosted_spi_bind().

◆ internal_do_bus_transfer()

int internal_do_bus_transfer ( void * transfer_context)
static

_h_do_bus_transfer: clock one full-duplex esp-hosted frame.

Validates the context and both buffers, asserts the chip select, exchanges the caller's frame in a single full-duplex transfer, deasserts the chip select and reports what the bus did. The transmit size is the caller's – the vendored driver sets it to MAX_SPI_BUFFER_SIZE – but it is bounded against MAX_TRANSPORT_BUFFER_SIZE here as well, because the receive buffer is only ever that large and a longer transfer would overrun it.

The chip select is deasserted on every path that asserted it, including the failure path, so a bus error cannot leave the co-processor selected.

Parameters
[in,out]transfer_contextA struct hosted_transport_context_t with both buffers set and tx_buf_size in bytes.
Returns
int Vendored return code.
Return values
RET_OKThe frame was exchanged; rx_buf holds the reply.
RET_INVALIDNull context, a null buffer, or a size of zero or more than one frame.
RET_FAILNo bus is bound, the chip select would not move, or the bus reported an error.
Precondition
Both buffers cover tx_buf_size bytes.
The chip select was configured as an output by the open.
Postcondition
The chip select is high on every return path.
On RET_OK exactly tx_buf_size bytes were clocked each way.
Note
Not thread-safe; the vendored driver serialises callers on its own bus mutex.
Since
0.1.0

Definition at line 492 of file ra8_esp_hosted_spi.c.

References ra8_pin_interface_t::ctx, internal_bus(), internal_pin_if(), k_ra8_esp_hosted_pin_chip_select, k_ra8_level_high, k_ra8_level_low, k_ra8_ok, k_ra8_spi_width_8, MAX_TRANSPORT_BUFFER_SIZE, ra8_io_spi_bus_write_read(), ra8_log_error_val, RET_FAIL, RET_INVALID, RET_OK, s_tag, and ra8_pin_interface_t::write.

Referenced by priv_ra8_esp_hosted_spi_bind().

◆ internal_pin_if()

const ra8_pin_interface_t * internal_pin_if ( void )
static

Report the pin driver the chip select is driven through.

Folds the "nothing injected" case onto the production instance so every caller can use the result without a null test.

Returns
The installed pin interface.
Return values
non-nullAlways.
Precondition
The slice is linked against libs/ra8_hal.
The caller does not retain the pointer across a seam swap.
Postcondition
No module state is modified.
The result has non-null output_init and write rows.
Note
Safe from interrupt context; a single aligned load.
Since
0.1.0

Definition at line 205 of file ra8_esp_hosted_spi.c.

References g_ra8_gpio_pin_interface, and s_pin_if.

Referenced by internal_do_bus_transfer(), and priv_ra8_esp_hosted_spi_open().

◆ internal_release_pins()

void internal_release_pins ( void )
static

Hand every pin the transport claimed back to the pin validator.

Used both by the failure unwind inside the open and by the close, so the two cannot disagree about which pins the transport owns. Release failures are ignored on purpose: a pin that was never claimed is exactly the case the unwind has to tolerate.

Precondition
No transfer is in flight.
The SCI channel has already been disabled, or was never enabled.
Postcondition
None of the four link pins is claimed by this module.
The call is idempotent; a second one changes nothing.
Note
Not thread-safe.
Since
0.1.0

Definition at line 303 of file ra8_esp_hosted_spi.c.

References k_ra8_board_pmod1_spi_cipo, k_ra8_board_pmod1_spi_copi, k_ra8_board_pmod1_spi_sck, k_ra8_esp_hosted_pin_chip_select, and ra8_gpio_release().

Referenced by priv_ra8_esp_hosted_spi_close(), and priv_ra8_esp_hosted_spi_open().

◆ internal_route_data_pins()

ra8_err_t internal_route_data_pins ( void )
static

Route the three Pmod1 SPI data pins to the SCI peripheral.

The chip select is deliberately not routed here: esp-hosted needs it driven by software for the whole frame, so it stays a GPIO output. The three data pins take the SCI peripheral function, which the Simple-SPI mode of the SCI shares with its asynchronous mode.

Returns
ra8_err_t Error code.
Return values
k_ra8_okAll three pins are routed.
k_ra8_err_gpio_conflictA pin is owned by another module.
k_ra8_err_hw_unmappedThe PFS window for a pin is not mapped.
Precondition
The Pmod1 mode mux is in its SPI position (board switch SW4-3 on).
The IOPORT module is powered.
Postcondition
On success the three data pins carry the SCI function.
On failure the caller releases whatever was routed.
Note
Not thread-safe.
Since
0.1.0

Definition at line 264 of file ra8_esp_hosted_spi.c.

References k_ra8_board_pmod1_spi_cipo, k_ra8_board_pmod1_spi_copi, k_ra8_board_pmod1_spi_sck, k_ra8_ok, k_ra8_psel_sci_async, and ra8_pfs_route_peripheral().

Referenced by priv_ra8_esp_hosted_spi_open().

◆ priv_ra8_esp_hosted_spi_bind()

ra8_err_t priv_ra8_esp_hosted_spi_bind ( hosted_osi_funcs_t * out)
nodiscard

Populate the three transport slots of the OS-abstraction vtable.

Writes _h_bus_init, _h_bus_deinit and _h_do_bus_transfer into out and touches nothing else, so the GPIO and RTOS slices may fill theirs in any order relative to this call.

Parameters
[out]outVtable to populate; must be non-null.
Returns
ra8_err_t Error code.
Return values
k_ra8_okThe three rows are populated.
k_ra8_err_null_ptrout was null.
Precondition
out points at storage that out-lives the vendored core.
priv_ra8_esp_hosted_spi_open has run, or will run before the vendored transport is started.
Postcondition
The three transport rows of out are non-null.
No non-transport row of out is modified.
Note
Not thread-safe; call once from the port's bring-up path.
Example:
hosted_osi_funcs_t g_hosted_osi_funcs
The OS-abstraction vtable the vendored core calls through.
ra8_err_t priv_ra8_esp_hosted_spi_bind(hosted_osi_funcs_t *out)
Populate the three transport slots of the OS-abstraction vtable.
See also
priv_ra8_esp_hosted_gpio_bind
Since
0.1.0

Definition at line 524 of file ra8_esp_hosted_spi.c.

References internal_bus_deinit(), internal_bus_init(), internal_do_bus_transfer(), k_ra8_err_invalid_state, k_ra8_ok, RA8_CHECK_NULL_PTR, RA8_PRIV, and s_tag.

Referenced by priv_ra8_esp_hosted_osi_bind_all().

◆ priv_ra8_esp_hosted_spi_close()

ra8_err_t priv_ra8_esp_hosted_spi_close ( void )
nodiscard

Close the SCI Simple-SPI channel and release every pin it took.

Exact reverse of priv_ra8_esp_hosted_spi_open: the channel is disabled and its module-stop gate released, then the chip select and the three routed data pins are handed back to the pin validator. The bound bus handle is cleared so a later transfer attempt fails rather than driving a dead channel.

Returns
ra8_err_t Error code.
Return values
k_ra8_okEverything was released.
k_ra8_err_not_initializedThe bus was not open.
k_ra8_err_spi_errorThe HAL refused to disable the channel.
Precondition
The vendored transport has stopped clocking frames.
No transfer is in flight.
Postcondition
Every pin priv_ra8_esp_hosted_spi_open claimed is released.
A later _h_do_bus_transfer reports failure rather than clocking.
Note
Not thread-safe; call from the same context as the open.
Example:
ra8_err_t priv_ra8_esp_hosted_spi_close(void)
Close the SCI Simple-SPI channel and release every pin it took.
See also
priv_ra8_esp_hosted_spi_open
Since
0.1.0

Definition at line 360 of file ra8_esp_hosted_spi.c.

References internal_release_pins(), k_ra8_err_not_initialized, k_ra8_err_spi_error, k_ra8_ok, RA8_PRIV, ra8_sci_spi_deinit(), s_bus, s_channel, and s_open.

Referenced by internal_bus_deinit(), and internal_unwind().

◆ priv_ra8_esp_hosted_spi_is_open()

bool priv_ra8_esp_hosted_spi_is_open ( void )
nodiscard

Report whether the SCI Simple-SPI channel is currently open.

Reads the single module-state flag, so the port can decide whether a close is needed and tests can assert the open/close state machine without reaching into the module.

Returns
Whether priv_ra8_esp_hosted_spi_open has completed with no close since.
Return values
trueThe channel is open and bound.
falseThe channel was never opened, failed to open, or was closed.
Precondition
None; safe to call at any time.
The caller tolerates a value a concurrent close may stale.
Postcondition
No module state is modified.
The result reflects the flag at the moment of the read.
Note
Safe from interrupt context; a single aligned load.
Example:
bool priv_ra8_esp_hosted_spi_is_open(void)
Report whether the SCI Simple-SPI channel is currently open.
See also
priv_ra8_esp_hosted_spi_open
Since
0.1.0

Definition at line 372 of file ra8_esp_hosted_spi.c.

References RA8_PRIV, and s_open.

◆ priv_ra8_esp_hosted_spi_open()

ra8_err_t priv_ra8_esp_hosted_spi_open ( uint8_t sci_channel,
uint32_t pclk_hz,
uint32_t sck_hz )
nodiscard

Route the Pmod1 SPI pins and open the SCI Simple-SPI channel.

Performs, in order: route SCK, COPI and CIPO to the SCI peripheral through the PFS; take the chip select as a GPIO output idling high (deasserted); bring the SCI channel up at mode 3, MSB first, at the requested bit rate; and bind the channel into the ra8_io SPI-bus facade so the transfer slot can drive it. Any failure unwinds the steps already taken, so a failed open leaves no pin claimed.

The channel argument must name the Pmod1 Simple-SPI channel. The port routes the Pmod1 pin trio and nothing else, so accepting a different channel would clock a peripheral whose pins were never routed.

Parameters
[in]sci_channelSCI channel carrying Simple-SPI; must equal the board's Pmod1 channel.
[in]pclk_hzLive PCLKA rate in hertz; non-zero.
[in]sck_hzRequested bit rate in hertz; non-zero.
Returns
ra8_err_t Error code.
Return values
k_ra8_okThe bus is open and bound.
k_ra8_err_invalid_argA clock was zero, or the channel is not the Pmod1 one.
k_ra8_err_invalid_stateThe bus is already open.
k_ra8_err_gpio_conflictA link pin is owned by another module.
k_ra8_err_spi_errorThe SCI channel would not come up.
Precondition
The CGC is configured and pclk_hz reflects the live PCLKA rate.
The Pmod1 mode mux is in its SPI position (board switch SW4-3 on).
Postcondition
On success the chip select idles high and the channel is enabled.
On failure no pin is left claimed and the channel is left disabled.
Note
Not thread-safe; call once from the port's bring-up path.
Warning
Opening the bus does not talk to the co-processor; the first traffic is whatever the vendored transport clocks out.
Example:
(void)priv_ra8_esp_hosted_spi_open(cfg->sci_channel, cfg->pclk_hz, cfg->sck_hz);
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.
See also
priv_ra8_esp_hosted_spi_close
Since
0.1.0

Definition at line 311 of file ra8_esp_hosted_spi.c.

References ra8_pin_interface_t::ctx, internal_pin_if(), internal_release_pins(), internal_route_data_pins(), k_ra8_board_pmod1_sci_channel, k_ra8_err_invalid_arg, k_ra8_err_invalid_state, k_ra8_err_spi_error, k_ra8_esp_hosted_pin_chip_select, k_ra8_esp_hosted_spi_mode, k_ra8_level_high, k_ra8_ok, ra8_pin_interface_t::output_init, ra8_io_spi_bus_bind_sci_spi(), ra8_log_error_val, ra8_log_info_val, RA8_PRIV, ra8_sci_spi_deinit(), ra8_sci_spi_init(), s_bus, s_channel, s_open, and s_tag.

Referenced by internal_bring_up().

◆ priv_ra8_esp_hosted_spi_set_bus()

void priv_ra8_esp_hosted_spi_set_bus ( const ra8_io_spi_bus_t * bus)

Replace the SPI bus the transfer slot clocks frames through.

Dependency-injection seam. Production leaves it unset, in which case the slot uses the handle priv_ra8_esp_hosted_spi_open bound to the SCI channel. Host tests point it at a recording ra8_io_spi_bus_iface so the whole transfer path – argument validation, chip-select sequencing, error propagation – runs with no silicon and no open channel.

Parameters
[in]busReplacement bus handle, or null to fall back on the handle the open bound. Must out-live every later transfer.
Precondition
bus, when non-null, has a bound backend vtable.
No transfer is in flight.
Postcondition
Later transfers clock through bus.
Passing null restores the internally bound handle.
Note
Not thread-safe; intended for bring-up and for tests.
Warning
Injecting a bus does not open a channel; the two are independent.
Example:
void priv_ra8_esp_hosted_spi_set_bus(const ra8_io_spi_bus_t *bus)
Replace the SPI bus the transfer slot clocks frames through.
See also
priv_ra8_esp_hosted_spi_open
Since
0.1.0

Definition at line 377 of file ra8_esp_hosted_spi.c.

References RA8_PRIV, and s_injected_bus.

◆ priv_ra8_esp_hosted_spi_set_pin_interface()

void priv_ra8_esp_hosted_spi_set_pin_interface ( const ra8_pin_interface_t * iface)

Replace the pin driver the transfer slot drives chip select with.

Dependency-injection seam, separate from the GPIO slice's own seam because the two translation units are independent. Production leaves it at g_ra8_gpio_pin_interface; tests point it at a recorder so the order of "chip select low, frame, chip select high" can be asserted rather than assumed.

Parameters
[in]ifaceReplacement interface, or null to restore the production instance. Must out-live every later transfer.
Precondition
iface, when non-null, has non-null output_init and write rows.
No transfer is in flight.
Postcondition
Later chip-select transitions go through iface.
Passing null restores the production pin driver.
Note
Not thread-safe; intended for bring-up and for tests.
Example:
void priv_ra8_esp_hosted_spi_set_pin_interface(const ra8_pin_interface_t *iface)
Replace the pin driver the transfer slot drives chip select with.
See also
priv_ra8_esp_hosted_spi_set_bus
Since
0.1.0

Definition at line 382 of file ra8_esp_hosted_spi.c.

References RA8_PRIV, and s_pin_if.

Variable Documentation

◆ g_ra8_gpio_pin_interface

const ra8_pin_interface_t g_ra8_gpio_pin_interface
extern

Definition at line 502 of file gpio.c.

Referenced by internal_pin_if(), and priv_ra8_esp_hosted_gpio_pin_interface().

◆ s_bus

ra8_io_spi_bus_t s_bus
static

Bus handle bound to the SCI Simple-SPI channel by the open.

Caller-allocated by contract of ra8_io_spi_bus_t, so the storage lives here for the lifetime of the image; iface is null until an open binds a backend into it.

Note
Written only by priv_ra8_esp_hosted_spi_open and priv_ra8_esp_hosted_spi_close.
Warning
Also handed to the vendored driver as its opaque bus handle; do not move it.
Since
0.1.0

Definition at line 127 of file ra8_esp_hosted_spi.c.

Referenced by internal_bus(), internal_bus_deinit(), internal_bus_init(), priv_ra8_esp_hosted_spi_close(), and priv_ra8_esp_hosted_spi_open().

◆ s_channel

uint8_t s_channel
static

SCI channel the open brought up, meaningful only while s_open.

Remembered so the close can disable exactly the channel that was enabled, without the caller having to repeat it.

Note
Written only by priv_ra8_esp_hosted_spi_open.
Warning
Reading it while s_open is false yields a stale channel index.
Since
0.1.0

Definition at line 162 of file ra8_esp_hosted_spi.c.

Referenced by priv_ra8_esp_hosted_spi_close(), and priv_ra8_esp_hosted_spi_open().

◆ s_injected_bus

const ra8_io_spi_bus_t* s_injected_bus
static

Test-injected replacement for s_bus, or null in production.

Kept separate from s_bus so an injection survives an open and an open does not clobber an injection.

Note
Written only by priv_ra8_esp_hosted_spi_set_bus.
Warning
Pointing this at a short-lived object leaves the transfer slot clocking through a dangling vtable.
Since
0.1.0

Definition at line 139 of file ra8_esp_hosted_spi.c.

Referenced by internal_bus(), and priv_ra8_esp_hosted_spi_set_bus().

◆ s_open

bool s_open
static

True between a successful open and its matching close.

The single piece of state the open/close pair maintains; the transfer slot deliberately does not consult it, because an injected bus makes a transfer meaningful with no channel open at all.

Note
Written only by priv_ra8_esp_hosted_spi_open and priv_ra8_esp_hosted_spi_close.
Warning
Never set it without the channel actually being enabled.
Since
0.1.0

Definition at line 175 of file ra8_esp_hosted_spi.c.

Referenced by internal_handle_init(), internal_rx_acceptable(), internal_rx_worker_entry(), internal_send_blocked(), nx_ether_driver_c6(), priv_ra8_esp_hosted_spi_close(), priv_ra8_esp_hosted_spi_is_open(), and priv_ra8_esp_hosted_spi_open().

◆ s_pin_if

const ra8_pin_interface_t* s_pin_if
static

Pin driver the chip select is configured and driven through.

Null means "use the production instance", which keeps the seam usable before any initialisation has run.

Note
Written only by priv_ra8_esp_hosted_spi_set_pin_interface.
Warning
Swapping it mid-transfer would split one frame's chip-select edges across two drivers.
Since
0.1.0

Definition at line 151 of file ra8_esp_hosted_spi.c.

◆ s_tag

const char* const s_tag = "eh_spi"
static

Log tag identifying lines emitted by the SPI transport slice.

Distinct from the vendored driver's own spi tag so a reader can tell a port-side refusal from a transport-side one.

Note
Read-only after load.
Warning
Changing it breaks log filters that key on the string.
Since
0.1.0

Definition at line 71 of file ra8_esp_hosted_spi.c.