Nexus Embedded Platform 1.0.0
Statically assembled reusable embedded mechanisms
Loading...
Searching...
No Matches
bus_owner.h
Go to the documentation of this file.
1
6#ifndef NEXUS_COMPONENTS_BUS_OWNER_H
7#define NEXUS_COMPONENTS_BUS_OWNER_H
9#include "nexus/os/wait.h"
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
24typedef struct {
25 void* context;
26 uintptr_t (*enter)(void*);
27 void (*leave)(void*, uintptr_t);
29
49typedef struct {
50 void* context;
51 nx_result_t (*start)(void*, void* operation, nx_time_us_t deadline);
52 nx_result_t (*service)(void*, nx_result_t* result, size_t* transferred);
56
61typedef struct {
62 size_t slot;
63 uint64_t epoch;
65
78
95
109 size_t capacity, nx_owner_guard_port_t guard,
111 nx_clock_t clock, const nx_wait_port_t* wake);
129 void* operation,
130 const nx_wait_port_t* completion,
131 nx_owner_ticket_t* ticket);
143 nx_owner_ticket_t ticket);
173
174#ifdef __cplusplus
175}
176#endif
177
178#endif /* NEXUS_COMPONENTS_BUS_OWNER_H */
bool nx_bus_owner_idle(nx_bus_owner_t *owner)
Test whether execution and completion publication have exited.
nx_result_t nx_bus_owner_service(nx_bus_owner_t *owner)
Advance at most one bounded execution step.
void nx_bus_owner_stop(nx_bus_owner_t *owner)
Close admission and request every accepted operation to stop.
nx_result_t nx_bus_owner_cancel(nx_bus_owner_t *owner, nx_owner_ticket_t ticket)
Submit cancellation through stable adapter storage.
nx_result_t nx_bus_owner_submit(nx_bus_owner_t *owner, nx_request_t *request, void *operation, const nx_wait_port_t *completion, nx_owner_ticket_t *ticket)
Establish the chain's unique admission.
nx_result_t nx_bus_owner_init(nx_bus_owner_t *owner, nx_owner_slot_t *slots, size_t capacity, nx_owner_guard_port_t guard, nx_owner_executor_port_t executor, nx_clock_t clock, const nx_wait_port_t *wake)
Initialize unused owner/slot storage.
Caller-owned admission, borrow, settlement and stable cancellation.
nx_result_t
Operation result; success at submission means admission only.
Definition status.h:21
Explicit adapter state; external application supplies all storage.
Definition bus_owner.h:80
nx_owner_executor_port_t executor
Definition bus_owner.h:88
nx_clock_t clock
Definition bus_owner.h:89
nx_result_t cancellation_result
Definition bus_owner.h:91
nx_owner_slot_t * slots
Definition bus_owner.h:81
nx_wait_port_t wake
Definition bus_owner.h:90
size_t active
Definition bus_owner.h:85
nx_owner_guard_port_t guard
Definition bus_owner.h:87
size_t free_head
Definition bus_owner.h:86
size_t capacity
Definition bus_owner.h:82
An explicitly injected clock; its context outlives all borrowers.
Definition time.h:26
One real execution owner, injected without OS dependency.
Definition bus_owner.h:49
nx_result_t(* start)(void *, void *operation, nx_time_us_t deadline)
Definition bus_owner.h:51
nx_result_t(* service)(void *, nx_result_t *result, size_t *transferred)
Definition bus_owner.h:52
nx_result_t(* cancel)(void *)
Definition bus_owner.h:53
Explicit bounded metadata exclusion port.
Definition bus_owner.h:24
uintptr_t(* enter)(void *)
Definition bus_owner.h:26
void(* leave)(void *, uintptr_t)
Definition bus_owner.h:27
Exact caller-owned slot, linked in either the free or FIFO chain; initialize only with owner init.
Definition bus_owner.h:70
bool cancel_requested
Definition bus_owner.h:75
void * operation
Definition bus_owner.h:72
nx_wait_port_t completion
Definition bus_owner.h:73
nx_request_slot_t identity
Definition bus_owner.h:71
Stable control identity; never dereference a stale request pointer.
Definition bus_owner.h:61
Adapter-owned stable cancellation identity.
Definition request.h:53
Caller-owned request metadata, without payload or callbacks.
Definition request.h:38
Single-waiter notification port.
Definition wait.h:42
uint64_t nx_time_us_t
Microseconds in one boot/clock domain; no wall-clock semantics.
Definition time.h:20
Optional sequence-latched waiting without hidden workers.