|
K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
|
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) |
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.
| #define KFSW_FBO_SCHEDULE_LINE_MAX 80U |
#include <fbo.h>
Longest entry text, a command name and its arguments, with the terminator.
#include <fbo.h>
What has become of one entry.
| enum kfsw_fbo_time_kind |
| 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.
| kind | Relative or absolute. | |
| when | Seconds from now, or the UTC second, by kind. | |
| node | Node to release on; 0 is this node. | |
| line | Command name and arguments, as a procedure line writes them. | |
| [out] | index | Slot taken, or the slot already holding this content. |
| 0 | Scheduled. |
| -EINVAL | A NULL, an empty line, a bad kind, or a time out of range. |
| -ENODATA | An absolute entry while the clock has not been set. |
| -ENOENT | The command is not registered. |
| -EACCES | The registry is not frozen. |
| -ENOSPC | The queue is full; nothing changed. |
| -EEXIST | An entry with this content is already live; index names it. |
| -ENOTSUP | node is another node and this build has no remote commanding. |
| int kfsw_fbo_schedule_cancel | ( | uint16_t | index | ) |
#include <fbo.h>
Cancel a scheduled entry.
| 0 | Cancelled; it will not run. |
| -ENOENT | No such slot. |
| -EALREADY | The entry is running, or has already finished. Cancellation never claims to have stopped something that fired. |
| int kfsw_fbo_schedule_clear | ( | void | ) |
#include <fbo.h>
Empty the queue.
A release in flight finishes. Returns the slots dropped.
| 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.
| uint32_t kfsw_fbo_schedule_get_latency_s | ( | void | ) |
#include <fbo.h>
The latency buffer in seconds.
| 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.
| 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.
| 0 | Applied. |
| -ERANGE | Below the command reply timeout, which would make a release waiting its turn look overdue, or above the compiled maximum. |