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

One vtable per radio. More...

#include <ra8_wifi_backend.h>

Data Fields

ra8_err_t(* open )(void *ctx)
 Bring the radio's link up and prove it answers.
ra8_err_t(* close )(void *ctx)
 Release the link the backend opened.
ra8_err_t(* radio_up )(void *ctx)
 Start the radio in station mode.
ra8_err_t(* radio_down )(void *ctx)
 Stop the radio and release its resources.
ra8_err_t(* join )(void *ctx, const char *ssid, const char *psk)
 Ask the station to associate with a network.
ra8_err_t(* leave )(void *ctx)
 Disassociate the station from its network.
ra8_err_t(* service )(void *ctx, ra8_wifi_link_t *out_link)
 Service the link once and report the association state.
ra8_err_t(* get_mac )(void *ctx, ra8_wifi_mac_t *out)
 Read the station's own MAC address.
ra8_err_t(* get_ap )(void *ctx, ra8_wifi_ap_t *out)
 Read what the radio knows about the associated AP.
void(* idle )(void *ctx, uint16_t ms)
 Idle for ms milliseconds, pacing a bounded wait.

Detailed Description

One vtable per radio.

Each callback takes the backend's opaque ctx.

A backend author fills a static const ra8_wifi_backend_t in one translation unit and publishes its address through a header of their own. The facade in ra8_wifi.c is the only runtime consumer; it never stores state here, so a single const instance serves every handle that selects the backend.

Invariant
Every function pointer is non-null.
open runs exactly once per handle before any other row, and close exactly once after the last.
Example:
static const ra8_wifi_backend_t k_backend = {
.open = my_open, .close = my_close, .radio_up = my_up, ...
};
struct ra8_wifi_backend ra8_wifi_backend_t
One radio's implementation of the operations this facade dispatches.
Definition ra8_wifi.h:342
See also
ra8_wifi_init
Since
0.1.0

Definition at line 71 of file ra8_wifi_backend.h.

Field Documentation

◆ close

ra8_err_t(* ra8_wifi_backend::close) (void *ctx)

Release the link the backend opened.

Mirror of open; the facade calls it from ra8_wifi_deinit.

Parameters
[in,out]ctxBackend context.
Returns
k_ra8_ok when the link is released.

Definition at line 87 of file ra8_wifi_backend.h.

Referenced by ra8_wifi_deinit().

◆ get_ap

ra8_err_t(* ra8_wifi_backend::get_ap) (void *ctx, ra8_wifi_ap_t *out)

Read what the radio knows about the associated AP.

Parameters
[in,out]ctxBackend context.
[out]outRecord to fill; never null.
Returns
k_ra8_ok when out describes the association.

Definition at line 145 of file ra8_wifi_backend.h.

Referenced by ra8_wifi_get_ap().

◆ get_mac

ra8_err_t(* ra8_wifi_backend::get_mac) (void *ctx, ra8_wifi_mac_t *out)

Read the station's own MAC address.

Parameters
[in,out]ctxBackend context.
[out]outAddress to fill; never null.
Returns
k_ra8_ok when out holds the station address.

Definition at line 137 of file ra8_wifi_backend.h.

Referenced by ra8_wifi_connect(), and ra8_wifi_get_mac().

◆ idle

void(* ra8_wifi_backend::idle) (void *ctx, uint16_t ms)

Idle for ms milliseconds, pacing a bounded wait.

The facade counts poll attempts, not milliseconds, so without this row its association wait would run as fast as the backend could answer – and a link that answers in tens of milliseconds spends a two-hundred-attempt budget in a couple of seconds, far less than an 802.11 association takes. This is the only seam through which the facade reaches a clock; a backend implements it with whatever delay its transport already owns, and a host test makes it instantaneous. It cannot fail, so it returns nothing.

Parameters
[in,out]ctxBackend context.
[in]msMilliseconds to idle for.
Returns
Nothing.

Definition at line 161 of file ra8_wifi_backend.h.

◆ join

ra8_err_t(* ra8_wifi_backend::join) (void *ctx, const char *ssid, const char *psk)

Ask the station to associate with a network.

Returns once the request is accepted; association completes later and is observed through service.

Parameters
[in,out]ctxBackend context.
[in]ssidTarget SSID, NUL-terminated; never null.
[in]pskPassphrase, NUL-terminated, or null for an open network.
Returns
k_ra8_ok when the association request was accepted.

Definition at line 112 of file ra8_wifi_backend.h.

Referenced by ra8_wifi_connect().

◆ leave

ra8_err_t(* ra8_wifi_backend::leave) (void *ctx)

Disassociate the station from its network.

Parameters
[in,out]ctxBackend context.
Returns
k_ra8_ok when the disassociation was accepted.

Definition at line 119 of file ra8_wifi_backend.h.

Referenced by ra8_wifi_disconnect().

◆ open

ra8_err_t(* ra8_wifi_backend::open) (void *ctx)

Bring the radio's link up and prove it answers.

Binds the transport, opens the link, and establishes liveness. The facade calls it once from ra8_wifi_init.

Parameters
[in,out]ctxBackend context from ra8_wifi_cfg::backend_ctx.
Returns
k_ra8_ok when the radio is answering, otherwise an error.

Definition at line 79 of file ra8_wifi_backend.h.

Referenced by ra8_wifi_init().

◆ radio_down

ra8_err_t(* ra8_wifi_backend::radio_down) (void *ctx)

Stop the radio and release its resources.

Parameters
[in,out]ctxBackend context.
Returns
k_ra8_ok when the radio is stopped.

Definition at line 101 of file ra8_wifi_backend.h.

Referenced by ra8_wifi_disconnect().

◆ radio_up

ra8_err_t(* ra8_wifi_backend::radio_up) (void *ctx)

Start the radio in station mode.

Parameters
[in,out]ctxBackend context.
Returns
k_ra8_ok when the radio is up in station mode.

Definition at line 94 of file ra8_wifi_backend.h.

Referenced by internal_ensure_radio_up().

◆ service

ra8_err_t(* ra8_wifi_backend::service) (void *ctx, ra8_wifi_link_t *out_link)

Service the link once and report the association state.

Drains whatever the radio has to say and reports whether the station is associated right now.

Parameters
[in,out]ctxBackend context.
[out]out_linkAssociation state after the cycle; never null.
Returns
k_ra8_ok when the cycle ran.

Definition at line 129 of file ra8_wifi_backend.h.

Referenced by ra8_wifi_poll().


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