K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
Loading...
Searching...
No Matches
Time-tagged releases

Data Structures

struct  kfsw_fbo_schedule_entry
 
struct  kfsw_fbo_schedule_status
 

Macros

#define KFSW_FBO_SCHEDULE_LINE_MAX   80U
 

Enumerations

enum  kfsw_fbo_time_kind { KFSW_FBO_TIME_RELATIVE = 0 , KFSW_FBO_TIME_ABSOLUTE = 1 }
 
enum  kfsw_fbo_entry_status {
  KFSW_FBO_ENTRY_SCHEDULED = 0 , KFSW_FBO_ENTRY_RUNNING = 1 , KFSW_FBO_ENTRY_COMPLETED = 2 , KFSW_FBO_ENTRY_FAILED = 3 ,
  KFSW_FBO_ENTRY_OVERDUE = 4 , KFSW_FBO_ENTRY_CANCELLED = 5
}
 

Functions

int kfsw_fbo_schedule_add (enum kfsw_fbo_time_kind kind, int64_t when, uint16_t node, const char *line, uint16_t *index)
 
int kfsw_fbo_schedule_cancel (uint16_t index)
 
int kfsw_fbo_schedule_clear (void)
 
int kfsw_fbo_schedule_get_entry (uint16_t index, struct kfsw_fbo_schedule_entry *entry)
 
int kfsw_fbo_schedule_get_status (struct kfsw_fbo_schedule_status *status)
 
int kfsw_fbo_schedule_set_latency_s (uint32_t seconds)
 
uint32_t kfsw_fbo_schedule_get_latency_s (void)
 

Description

Release a registered command at a time, instead of now.

An entry names a command exactly as a procedure line does, so a release is an ordinary invocation with the same validation, counters and events.

The queue is volatile. A reset clears it, deliberately: a queue that outlives a reset while its clock may have jumped fires at the wrong time with nobody watching.

Two kinds of time, and they are not equally safe.

Relative is the safer one. An entry due in N seconds needs only the monotonic clock, so it is right even on a node that was never told the time, and a clock step does not touch it because it never consults the wall clock.

Absolute needs the clock to have been set this power cycle. While nothing has set it, adding or releasing an absolute entry is refused and says so. Note what set claims: that something wrote the clock since this power cycle. It is a weaker claim than correct. An RTC set once and since drifted, or set from a wrong source, still reads as set. When a time quality service exists the gate tightens from was-set to a minimum quality, and that is the only change.

Macro Documentation

◆ KFSW_FBO_SCHEDULE_LINE_MAX

#define KFSW_FBO_SCHEDULE_LINE_MAX   80U

#include <fbo.h>

Longest entry text, a command name and its arguments, with the terminator.

Enumeration Documentation

◆ kfsw_fbo_entry_status

#include <fbo.h>

What has become of one entry.

Enumerator
KFSW_FBO_ENTRY_SCHEDULED 

Waiting for its time.

KFSW_FBO_ENTRY_RUNNING 

Released; the handler has not returned yet.

KFSW_FBO_ENTRY_COMPLETED 

Released and the command reported success.

KFSW_FBO_ENTRY_FAILED 

Released and the command reported a failure.

KFSW_FBO_ENTRY_OVERDUE 

Its time passed by more than the latency buffer; never released.

KFSW_FBO_ENTRY_CANCELLED 

Cancelled before it was released.

◆ kfsw_fbo_time_kind

#include <fbo.h>

Which clock an entry is due against.

Enumerator
KFSW_FBO_TIME_RELATIVE 

Seconds from the moment the entry was added, on the monotonic clock.

KFSW_FBO_TIME_ABSOLUTE 

UTC seconds, and only with the clock set.

Function Documentation

◆ kfsw_fbo_schedule_add()

int kfsw_fbo_schedule_add ( enum kfsw_fbo_time_kind  kind,
int64_t  when,
uint16_t  node,
const char *  line,
uint16_t *  index 
)

#include <fbo.h>

Add one entry.

The command is resolved and its arguments parsed now, so a bad entry is refused while an operator is listening rather than at its release.

Parameters
kindRelative or absolute.
whenSeconds from now, or the UTC second, by kind.
nodeNode to release on; 0 is this node.
lineCommand name and arguments, as a procedure line writes them.
[out]indexSlot taken, or the slot already holding this content.
Return values
0Scheduled.
-EINVALA NULL, an empty line, a bad kind, or a time out of range.
-ENODATAAn absolute entry while the clock has not been set.
-ENOENTThe command is not registered.
-EACCESThe registry is not frozen.
-ENOSPCThe queue is full; nothing changed.
-EEXISTAn entry with this content is already live; index names it.
-ENOTSUPnode is another node and this build has no remote commanding.

◆ kfsw_fbo_schedule_cancel()

int kfsw_fbo_schedule_cancel ( uint16_t  index)

#include <fbo.h>

Cancel a scheduled entry.

Return values
0Cancelled; it will not run.
-ENOENTNo such slot.
-EALREADYThe entry is running, or has already finished. Cancellation never claims to have stopped something that fired.

◆ kfsw_fbo_schedule_clear()

int kfsw_fbo_schedule_clear ( void  )

#include <fbo.h>

Empty the queue.

A release in flight finishes. Returns the slots dropped.

◆ kfsw_fbo_schedule_get_entry()

int kfsw_fbo_schedule_get_entry ( uint16_t  index,
struct kfsw_fbo_schedule_entry *  entry 
)

#include <fbo.h>

Read one slot.

Returns -ENOENT for an empty or out-of-range slot.

◆ kfsw_fbo_schedule_get_latency_s()

uint32_t kfsw_fbo_schedule_get_latency_s ( void  )

#include <fbo.h>

The latency buffer in seconds.

◆ kfsw_fbo_schedule_get_status()

int kfsw_fbo_schedule_get_status ( struct kfsw_fbo_schedule_status *  status)

#include <fbo.h>

Read the queue state.

Returns -EINVAL for a NULL destination.

◆ kfsw_fbo_schedule_set_latency_s()

int kfsw_fbo_schedule_set_latency_s ( uint32_t  seconds)

#include <fbo.h>

Change the latency buffer.

An entry due less than this long ago still runs; anything later reports overdue instead of firing at the wrong time.

Return values
0Applied.
-ERANGEBelow the command reply timeout, which would make a release waiting its turn look overdue, or above the compiled maximum.