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

Function-pointer seam a backend fills so the facade can reach the C6. More...

#include <ra8_c6link_transport.h>

Data Fields

ra8_err_t(* transfer )(void *ctx, const uint8_t *tx, uint8_t *rx, uint16_t len)
 Clock one full-duplex transaction of exactly len bytes.
bool(* handshake_active )(void *ctx)
 Report whether the co-processor is armed for a transaction.
void(* delay_ms )(void *ctx, uint16_t ms)
 Yield for approximately ms milliseconds.
void * ctx
 Opaque backend context, handed back to every row above.

Detailed Description

Function-pointer seam a backend fills so the facade can reach the C6.

Caller-allocated and copied into the link handle by ra8_c6link_open, so the structure itself need not outlive the open call – but everything it points at must outlive the link. Every row is mandatory: a partially-filled seam is rejected at open rather than discovered as a null call at the first transaction.

NASA Power of 10 Rule 9 permits function pointers precisely for this: Dependency Inversion, so the protocol layers are host-testable.

Invariant
transfer, handshake_active and delay_ms are all non-null once ra8_c6link_open has accepted the seam.
ctx is passed back unmodified to every row and is never dereferenced by the facade.
Example:
.transfer = my_spi_transfer,
.handshake_active = my_handshake_read,
.delay_ms = my_delay,
.ctx = &my_bus,
};
See also
ra8_c6link_open
Since
0.1.0

Definition at line 84 of file ra8_c6link_transport.h.

Field Documentation

◆ ctx

void* ra8_c6link_transport::ctx

Opaque backend context, handed back to every row above.

Definition at line 112 of file ra8_c6link_transport.h.

Referenced by internal_c6link_op_idle(), internal_c6link_pump_handshake(), priv_c6link_pump(), and ra8_esp_hosted_c6link_bind().

◆ delay_ms

void(* ra8_c6link_transport::delay_ms) (void *ctx, uint16_t ms)

Yield for approximately ms milliseconds.

Called between handshake samples and between transactions. May block; on the target it is the RTOS sleep, in host tests it advances the model's clock and returns immediately.

Definition at line 109 of file ra8_c6link_transport.h.

Referenced by internal_c6link_check_cfg(), internal_c6link_op_idle(), internal_c6link_pump_handshake(), priv_c6link_pump(), and ra8_esp_hosted_c6link_bind().

◆ handshake_active

bool(* ra8_c6link_transport::handshake_active) (void *ctx)

Report whether the co-processor is armed for a transaction.

The HANDSHAKE line, sampled at its active level. The facade polls this and never starts a transaction while it reads false, because the co-processor only latches its transmit buffer once it has raised the line.

Definition at line 101 of file ra8_c6link_transport.h.

Referenced by internal_c6link_check_cfg(), internal_c6link_pump_handshake(), and ra8_esp_hosted_c6link_bind().

◆ transfer

ra8_err_t(* ra8_c6link_transport::transfer) (void *ctx, const uint8_t *tx, uint8_t *rx, uint16_t len)

Clock one full-duplex transaction of exactly len bytes.

Must transmit every byte of tx and store every received byte in rx; both buffers are k_ra8_c6link_frame_bytes long and neither is ever null. Returning anything but k_ra8_ok aborts the pump and is reported to the caller as a bus fault.

Definition at line 92 of file ra8_c6link_transport.h.

Referenced by internal_c6link_check_cfg(), priv_c6link_pump(), and ra8_esp_hosted_c6link_bind().


The documentation for this struct was generated from the following file: