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

Binds the ra8_c6link transport seam to this port's OS vtable. More...

#include "ra8_c6link_transport.h"
#include "ra8_err.h"
Include dependency graph for ra8_esp_hosted_c6link.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ra8_err_t ra8_esp_hosted_c6link_bind (ra8_c6link_transport_t *out)
 Fill a ra8_c6link transport seam with this port's implementations.

Detailed Description

Binds the ra8_c6link transport seam to this port's OS vtable.

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

libs/ra8_c6link is deliberately ignorant of hardware: it reaches the co-processor through three function pointers and knows nothing about SCI channels, ICU edges or ThreadX. This header is where those three pointers are filled in with the port's own implementations, which is why it lives here rather than inside the library – the library must stay compilable on a host with no port, and it is.

All three rows are thin trampolines onto the 72-entry hosted_osi_funcs_t vtable behind g_h. That is deliberate: the transactions the facade clocks then go through exactly the same code the vendored driver would use, so a bench result from the facade is a bench result about the port.

Order of operations
ra8_esp_hosted_port_init must have returned k_ra8_ok before the seam is bound, because g_h.funcs is unpopulated until it does and the first transaction would dereference it.
Since
0.1.0

Definition in file ra8_esp_hosted_c6link.h.

Function Documentation

◆ ra8_esp_hosted_c6link_bind()

ra8_err_t ra8_esp_hosted_c6link_bind ( ra8_c6link_transport_t * out)
nodiscard

Fill a ra8_c6link transport seam with this port's implementations.

Sets the transfer, handshake and delay rows to trampolines onto g_h and leaves the context null – the port is a singleton, so there is nothing per-instance to carry. The seam is validated by ra8_c6link_open, which rejects any row this call failed to fill.

Parameters
[out]outSeam to fill; must be non-null.
Returns
ra8_err_t Error code.
Return values
k_ra8_okThe seam is bound and may be handed to ra8_c6link_open.
k_ra8_err_null_ptrout was null.
k_ra8_err_not_initializedThe port is not up, so g_h.funcs would be unpopulated at the first transaction.
Precondition
ra8_esp_hosted_port_init has returned k_ra8_ok.
No link is currently clocking transactions through this port.
Postcondition
On success all three rows of out are non-null.
On failure out is cleared rather than left half-filled.
Note
Not thread-safe against a concurrent port teardown; bind during bring-up, before any pump starts.
Warning
The bound seam outlives nothing: tearing the port down while a link holds the seam leaves that link calling into a closed bus.
Example:
cfg.arena = arena;
cfg.arena_bytes = (uint32_t)sizeof arena;
(void)ra8_c6link_open(&link, &cfg);
}
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
Definition ra8_err.h:119
See also
ra8_esp_hosted_port_init
ra8_c6link_open
Since
0.1.0
NASA Power of 10 Compliance:
  • Rule 5: two preconditions and two postconditions are checked.

Definition at line 151 of file ra8_esp_hosted_c6link.c.

References ra8_c6link_transport::ctx, ra8_c6link_transport::delay_ms, ra8_c6link_transport::handshake_active, internal_ra8_esp_hosted_c6link_delay(), internal_ra8_esp_hosted_c6link_handshake(), internal_ra8_esp_hosted_c6link_transfer(), k_ra8_err_not_initialized, k_ra8_err_null_ptr, k_ra8_ok, ra8_esp_hosted_port_is_ready(), and ra8_c6link_transport::transfer.

Referenced by c6_join_open_link(), c6_wifi_open_link(), internal_c6_cam_open_link(), internal_open_and_join(), and wifi_hal_make_cfg().