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

The ESP32-C6 backend for the ra8_wifi facade, over ra8_c6link. More...

#include <stdint.h>
#include "ra8_c6link.h"
#include "ra8_err.h"
#include "ra8_wifi.h"
Include dependency graph for ra8_wifi_c6link.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

 What ra8_wifi_c6link_setup needs to wire this backend to a link. More...
 Caller-allocated backend context for the ESP32-C6 radio. More...

Typedefs

typedef struct ra8_wifi_c6link_cfg ra8_wifi_c6link_cfg_t
typedef struct ra8_wifi_c6link ra8_wifi_c6link_t

Functions

ra8_err_t ra8_wifi_c6link_setup (ra8_wifi_c6link_t *self, const ra8_wifi_c6link_cfg_t *cfg, ra8_wifi_cfg_t *out_wcfg)
 Wire this backend into the backend half of an ra8_wifi_cfg_t.

Variables

const ra8_wifi_backend_t k_ra8_wifi_backend_c6link
 The ESP32-C6 ra8_wifi_backend_t, exported for ra8_wifi_cfg::backend.

Detailed Description

The ESP32-C6 backend for the ra8_wifi facade, over ra8_c6link.

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

The first ra8_wifi_backend_t. It maps each facade operation onto the ra8_c6link station calls and owns the event callback that turns the co-processor's asynchronous connect/disconnect announcements into the simple "associated / not associated" reading the facade asks for. Everything the facade is designed to hide – the RPC ids, the transaction pump, the interface index, the wifi_mode_t – stays on this side of the seam.

What an application wires
Allocate one ra8_wifi_c6link_t and one ra8_c6link_t at file scope, fill an ra8_wifi_c6link_cfg_t, and call ra8_wifi_c6link_setup to populate the backend half of an ra8_wifi_cfg_t. The application still owns two things this backend cannot: the transport's hardware bring-up (clocks and pins, done once before ra8_wifi_init) and the IP provider (ra8_wifi_cfg::ip_bind).
Example:
.link = &s_link, .arena = s_arena,
.arena_bytes = (uint32_t)sizeof s_arena, .rx_cb = nx_ether_driver_c6_rx,
};
ra8_wifi_cfg_t cfg = {};
(void)ra8_wifi_c6link_setup(&s_c6, &bcfg, &cfg);
cfg.ip_bind = my_dhcp;
cfg.ip_ctx = &s_link;
(void)ra8_wifi_init(&s_wifi, &cfg);
static ra8_c6link_t s_link
Definition c6_cam_app.c:44
static uint8_t s_arena[k_c6_cam_arena_bytes]
Definition c6_cam_app.c:43
static ra8_wifi_c6link_t s_c6
The ESP32-C6 ra8_wifi backend context.
Definition main.c:64
static ra8_wifi_t s_wifi
The Wi-Fi handle every operation goes through.
Definition main.c:66
void nx_ether_driver_c6_rx(void *ctx, const uint8_t *frame, uint16_t len)
Receive callback the application registers with ra8_c6link_open.
ra8_err_t ra8_wifi_init(ra8_wifi_t *wifi, const ra8_wifi_cfg_t *cfg)
Bring the radio and its link up and make a handle usable.
Definition ra8_wifi.c:166
struct ra8_wifi_cfg ra8_wifi_cfg_t
ra8_wifi_ip_bind_fn ip_bind
IP-stack hook for ra8_wifi_wait_ip.
Definition ra8_wifi.h:372
void * ip_ctx
Opaque context handed to ip_bind.
Definition ra8_wifi.h:373
See also
ra8_wifi.h
ra8_c6link.h
Since
0.1.0

Definition in file ra8_wifi_c6link.h.

Typedef Documentation

◆ ra8_wifi_c6link_cfg_t

◆ ra8_wifi_c6link_t

Function Documentation

◆ ra8_wifi_c6link_setup()

ra8_err_t ra8_wifi_c6link_setup ( ra8_wifi_c6link_t * self,
const ra8_wifi_c6link_cfg_t * cfg,
ra8_wifi_cfg_t * out_wcfg )
nodiscard

Wire this backend into the backend half of an ra8_wifi_cfg_t.

Copies cfg into self, clears the event latches, and fills out_wcfg 's backend and backend_ctx. It leaves ip_bind and ip_ctx untouched so the application can set its IP provider on the same structure. No hardware is touched; the link is opened later, from ra8_wifi_init.

Parameters
[out]selfBackend context to populate; must be non-null.
[in]cfgBackend configuration; must be non-null with a link and an arena of at least k_ra8_c6link_arena_min bytes.
[out]out_wcfgFacade configuration whose backend half is filled; must be non-null.
Returns
ra8_err_t Error code.
Return values
k_ra8_okout_wcfg selects this backend with self as context.
k_ra8_err_null_ptrself, cfg, out_wcfg, or cfg->link was null.
k_ra8_err_invalid_sizecfg->arena_bytes is below k_ra8_c6link_arena_min.
Precondition
The transport's hardware bring-up has run or will run before ra8_wifi_init.
cfg->link is zero-initialised storage.
Postcondition
On success out_wcfg->backend is k_ra8_wifi_backend_c6link.
On failure out_wcfg is not modified.
Note
Not thread-safe; call once during bring-up.
Example:
(void)ra8_wifi_c6link_setup(&s_c6, &bcfg, &cfg);
See also
ra8_wifi_init
Since
0.1.0
NASA Power of 10 Compliance:
  • Rule 5: preconditions on every pointer plus a size floor, two postconditions.

Definition at line 430 of file ra8_wifi_c6link.c.

References ra8_wifi_c6link::arena, ra8_wifi_c6link_cfg::arena, ra8_wifi_c6link::arena_bytes, ra8_wifi_c6link_cfg::arena_bytes, ra8_wifi_cfg::backend, ra8_wifi_cfg::backend_ctx, k_ra8_c6link_arena_min, k_ra8_err_invalid_size, k_ra8_ok, k_ra8_wifi_backend_c6link, ra8_wifi_c6link::link, ra8_wifi_c6link_cfg::link, RA8_CHECK_NULL_PTR, RA8_WIFI_C6_TAG, ra8_wifi_c6link::rx_cb, ra8_wifi_c6link_cfg::rx_cb, ra8_wifi_c6link::transport, and ra8_wifi_c6link_cfg::transport.

Referenced by wifi_hal_make_cfg().

Variable Documentation

◆ k_ra8_wifi_backend_c6link

const ra8_wifi_backend_t k_ra8_wifi_backend_c6link
extern

The ESP32-C6 ra8_wifi_backend_t, exported for ra8_wifi_cfg::backend.

The one ESP32-C6 backend table; see the header for the contract.

A single const table shared by every handle that runs on the co-processor. Applications take its address through ra8_wifi_c6link_setup rather than naming it directly, but it is exported so a test or a bespoke wiring can reference it.

Note
Immutable; every row points at a translation-unit-local function.
Warning
Do not copy or mutate it; pass its address.
See also
ra8_wifi_c6link_setup
Since
0.1.0

Every row points at a translation-unit-local mapping above.

Note
Immutable and shared by every handle on the co-processor.
Since
0.1.0

Definition at line 417 of file ra8_wifi_c6link.c.

Referenced by ra8_wifi_c6link_setup().