Nexus Embedded Platform 1.0.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
ethernet.h
Go to the documentation of this file.
1
6#ifndef NEXUS_IO_ETHERNET_H
7#define NEXUS_IO_ETHERNET_H
9#include "nexus/io/wake.h"
10#ifdef __cplusplus
11extern "C" {
12#endif
13#define NX_ETH_FRAME_MIN 14U
14#define NX_ETH_FRAME_MAX 1514U
15#define NX_ETH_RX_STORAGE_MIN 1518U
16#define NX_ETH_RX_CRC 1U
17#define NX_ETH_RX_LENGTH 2U
18#define NX_ETH_RX_FRAGMENT 4U
19#define NX_ETH_RX_UNSUPPORTED 8U
20#define NX_ETH_RX_DMA_ERROR 16U
21#define NX_ETH_RX_BACKPRESSURE 32U
24typedef struct {
26 const uint8_t* data;
27 size_t length;
29
30typedef struct {
31 bool up;
33 uint16_t speed_mbps;
35
40typedef struct {
41 const uint8_t* data;
42 size_t length;
43 size_t slot;
44 const void* identity;
45 uint64_t epoch;
48
73typedef struct {
75 void* context;
77
88 size_t length, nx_time_us_t deadline);
99 nx_eth_tx_request_t* request);
110 nx_eth_tx_request_t* request);
122 nx_eth_rx_frame_t* frame);
131 const nx_eth_rx_frame_t* frame);
150 const nx_eth_link_t* link);
171 const nx_irq_wake_t* wake,
172 uint8_t syscall_ceiling);
173#ifdef __cplusplus
174}
175#endif
176#endif
nx_result_t nx_eth_port_stop(const nx_eth_port_t *port)
Close admission and withdraw MAC/DMA/IRQ sources with readback.
nx_result_t nx_eth_port_cancel(const nx_eth_port_t *port, nx_eth_tx_request_t *request)
Close TX admission and drain the shared TX engine without replay.
nx_result_t nx_eth_port_release(const nx_eth_port_t *port, const nx_eth_rx_frame_t *frame)
Final consumer access; stale, foreign and double releases reject.
nx_result_t nx_eth_port_submit(const nx_eth_port_t *port, nx_eth_tx_request_t *request)
Admit one frame into caller-owned hardware descriptors.
nx_result_t nx_eth_port_service(const nx_eth_port_t *port)
Task-owner bounded progress; no worker, lock, pool or wait.
nx_result_t nx_eth_port_state(const nx_eth_port_t *port, nx_eth_state_t *state)
Copy latched instance/link/error facts; output is not retained.
nx_result_t nx_eth_port_acquire(const nx_eth_port_t *port, nx_eth_rx_frame_t *frame)
Task-consumer complete-frame loan; EMPTY creates no borrow.
nx_result_t nx_eth_tx_prepare(nx_eth_tx_request_t *request, const void *data, size_t length, nx_time_us_t deadline)
Prepare an initialized, unborrowed request and its immutable frame.
nx_result_t nx_eth_port_apply_link(const nx_eth_port_t *port, const nx_eth_link_t *link)
Apply external PHY observations, not auto-negotiate or invent link.
nx_result_t nx_eth_port_attach_wake(const nx_eth_port_t *port, const nx_irq_wake_t *wake, uint8_t syscall_ceiling)
Bind an optional borrowed hint after actual IRQ-policy validation.
Caller-owned admission, borrow, settlement and stable cancellation.
nx_result_t
Operation result; success at submission means admission only.
Definition status.h:21
nx_result_t(* service)(void *)
Definition ethernet.h:65
nx_result_t(* attach_wake)(void *, const nx_irq_wake_t *, uint8_t)
Definition ethernet.h:71
nx_result_t(* apply_link)(void *, const nx_eth_link_t *)
Definition ethernet.h:69
nx_result_t(* stop)(void *)
Definition ethernet.h:70
nx_result_t(* cancel)(void *, nx_eth_tx_request_t *)
Definition ethernet.h:64
nx_result_t(* release)(void *, const nx_eth_rx_frame_t *)
Definition ethernet.h:67
nx_result_t(* submit)(void *, nx_eth_tx_request_t *)
Definition ethernet.h:63
nx_result_t(* acquire)(void *, nx_eth_rx_frame_t *)
Definition ethernet.h:66
nx_result_t(* state)(void *, nx_eth_state_t *)
Definition ethernet.h:68
const nx_eth_ops_t * ops
Definition ethernet.h:74
void * context
Definition ethernet.h:75
Complete immutable frame; release requires this exact incarnation.
Definition ethernet.h:40
const void * identity
Definition ethernet.h:44
nx_time_us_t timestamp_us
Definition ethernet.h:46
uint64_t epoch
Definition ethernet.h:45
const uint8_t * data
Definition ethernet.h:41
Latched facts survive receive backpressure and failed wake hints.
Definition ethernet.h:49
bool transmit_underflow
Definition ethernet.h:60
size_t held_rx
Definition ethernet.h:56
bool fatal_bus_error
Definition ethernet.h:59
uint64_t received
Definition ethernet.h:51
size_t pending_tx
Definition ethernet.h:55
uint32_t receive_flags
Definition ethernet.h:54
uint64_t unavailable_events
Definition ethernet.h:53
nx_eth_link_t link
Definition ethernet.h:50
uint64_t discarded
Definition ethernet.h:52
Caller-owned immutable contiguous frame, excluding its hardware FCS.
Definition ethernet.h:24
const uint8_t * data
Definition ethernet.h:26
nx_request_t base
Definition ethernet.h:25
Optional immutable wake target borrowed by an IRQ provider.
Definition wake.h:26
Caller-owned request metadata, without payload or callbacks.
Definition request.h:38
uint64_t nx_time_us_t
Microseconds in one boot/clock domain; no wall-clock semantics.
Definition time.h:20
Explicit borrowed IRQ wake target and syscall-ceiling check.