|
K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
|
Data Structures | |
| struct | kfsw_table_report |
| struct | kfsw_table_status |
Macros | |
| #define | KFSW_TABLE_MAX_ENTRIES CONFIG_KFSW_TABLE_MAX_ENTRIES |
| #define | KFSW_TABLE_PATH_SIZE 64U |
| #define | KFSW_TABLE_DIRECTORY "/kfsw/tables" |
| #define | KFSW_TABLE_PARAM_TABLE_ID 37U |
| #define | KFSW_TABLE_PARAM_TABLE_NAME "table" |
Enumerations | |
| enum | kfsw_table_event { KFSW_EVENT_TABLE_REJECTED = 1 , KFSW_EVENT_TABLE_LOADED = 2 , KFSW_EVENT_TABLE_REVERTED = 3 } |
| enum | kfsw_table_state { KFSW_TABLE_EMPTY = 0 , KFSW_TABLE_LOADED = 1 , KFSW_TABLE_REVERTED = 2 } |
Functions | |
| int | kfsw_table_validate (const char *path, struct kfsw_table_report *report) |
| int | kfsw_table_load (const char *path, struct kfsw_table_report *report) |
| int | kfsw_table_revert (void) |
| int | kfsw_table_dump (uint8_t table, const char *path, uint16_t *entries) |
| int | kfsw_table_get_status (struct kfsw_table_status *status) |
| const char * | kfsw_table_state_name (enum kfsw_table_state state) |
Variables | |
| const struct kfsw_param_definition_set | kfsw_table_param_definitions |
A parameter table uploaded as one file, checked completely before any of it takes effect, and undoable afterwards.
The parameter snapshot is the other way of changing many values at once, and it is a different job: the node writes it, it covers whatever is marked persistent across every table, and it is adopted at boot. A table file is written on the ground, addresses one table, and is adopted when an operator says so during a pass. Both use the same value encoding, so one decoder reads either.
| #define KFSW_TABLE_DIRECTORY "/kfsw/tables" |
#include <table.h>
Where this node keeps table files it writes, and the usual place to upload to.
| #define KFSW_TABLE_MAX_ENTRIES CONFIG_KFSW_TABLE_MAX_ENTRIES |
#include <table.h>
Entries one table file may carry.
| #define KFSW_TABLE_PARAM_TABLE_ID 37U |
#include <table.h>
Parameter table of this service.
| #define KFSW_TABLE_PATH_SIZE 64U |
#include <table.h>
Longest path kept for the file that was loaded, including the terminator.
| enum kfsw_table_event |
| enum kfsw_table_state |
#include <table.h>
Whether anything is loaded, and whether it can still be undone.
| int kfsw_table_dump | ( | uint8_t | table, |
| const char * | path, | ||
| uint16_t * | entries | ||
| ) |
#include <table.h>
Write a table's current values out as a table file.
So an operator can fetch what is running, change a value and upload it back rather than composing a file from the manual.
| table | Table identifier, 1..99. | |
| path | File to write, usually under KFSW_TABLE_DIRECTORY, which is created if it is missing. Replaced atomically. | |
| [out] | entries | Entries written. May be NULL. |
| 0 | The file holds the table. |
| -EINVAL | table or path is not usable. |
| -EACCES | The parameter service is not initialized. |
| -ENODEV | Storage is not mounted. |
| -ENOENT | No such table is registered. |
| -E2BIG | The table has more entries than a file may carry. |
| <0 | An errno from the filesystem; any previous file is unchanged. |
| int kfsw_table_get_status | ( | struct kfsw_table_status * | status | ) |
#include <table.h>
Read a snapshot of the service.
| [out] | status | Destination. |
| 0 | Written. |
| -EINVAL | status is NULL. |
| int kfsw_table_load | ( | const char * | path, |
| struct kfsw_table_report * | report | ||
| ) |
#include <table.h>
Adopt a table file.
Validates the whole file first and applies nothing unless every entry passes, so a file with one bad entry leaves the table as it was. The values it replaces are held, so the load can be undone with kfsw_table_revert. A failed application returns its errno and keeps the previous undo values. No physical rollback is attempted.
| path | File to read. | |
| [out] | report | What was applied, or what stopped it. May be NULL. |
| int kfsw_table_revert | ( | void | ) |
#include <table.h>
Put back the values the last load replaced.
Values are validated before application. A failed application keeps the undo values for a later retry and returns its errno.
| 0 | The previous values are back. |
| -ENOENT | Nothing has been loaded, or the last load was already undone. |
| -EACCES | The parameter service is not initialized. |
| const char * kfsw_table_state_name | ( | enum kfsw_table_state | state | ) |
#include <table.h>
Human-readable name for a state; "unknown" for an unrecognised value.
| int kfsw_table_validate | ( | const char * | path, |
| struct kfsw_table_report * | report | ||
| ) |
#include <table.h>
Check a table file without applying any of it.
Reads the file, checks its header, its checksum and every entry against the running parameter registry, and reports what it found. A value with a fallible scalar applier must be the file's only entry; mixed files are refused with report reason -ENOTSUP before any application.
| path | File to read. | |
| [out] | report | What the file holds and, on failure, which entry stopped it. May be NULL. |
| 0 | Every entry would be accepted. |
| -EINVAL | path is NULL or too long. |
| -EACCES | The parameter service is not initialized. |
| -ENODEV | Storage is not mounted. |
| -ENOENT | There is no such file. |
| -EFBIG | The file is larger than this image can read. |
| -EBADMSG | It is not a table file, its checksum is wrong, or an entry was refused. report says which and why. |
| -ENOTSUP | Its format version is not the one this image writes. |
|
extern |
#include <table.h>
Definitions of this service's own parameters.