|
K-FSW v1.2.1-59-gcaca356
KFSW: modular flight software on Zephyr, for small satellites
|
Data Structures | |
| struct | kfsw_scrub_result |
| struct | kfsw_scrub_status |
Macros | |
| #define | KFSW_SCRUB_PARAM_TABLE_ID 39U |
| #define | KFSW_SCRUB_PARAM_TABLE_NAME "scrub" |
| #define | KFSW_SCRUB_NAME_SIZE 8U |
Types | |
| typedef bool(* | kfsw_scrub_visitor_t) (const struct kfsw_scrub_result *result, void *context) |
Enumerations | |
| enum | kfsw_scrub_region { KFSW_SCRUB_SLOT0 = 0 , KFSW_SCRUB_SLOT1 = 1 , KFSW_SCRUB_GOLDEN = 2 , KFSW_SCRUB_REGIONS = 3 } |
| enum | kfsw_scrub_state { KFSW_SCRUB_EMPTY = 0 , KFSW_SCRUB_UNKNOWN = 1 , KFSW_SCRUB_OK = 2 , KFSW_SCRUB_MISMATCH = 3 , KFSW_SCRUB_UNREADABLE = 4 , KFSW_SCRUB_ABSENT = 5 } |
| enum | kfsw_scrub_event { KFSW_EVENT_SCRUB_MISMATCH = 1 } |
Functions | |
| int | kfsw_scrub_start (void) |
| int | kfsw_scrub_stop (void) |
| int | kfsw_scrub_sweep (void) |
| int | kfsw_scrub_sweep_region (enum kfsw_scrub_region region) |
| int | kfsw_scrub_learn (enum kfsw_scrub_region region) |
| void | kfsw_scrub_get_status (struct kfsw_scrub_status *status) |
| int | kfsw_scrub_get_result (enum kfsw_scrub_region region, struct kfsw_scrub_result *result) |
| void | kfsw_scrub_visit_regions (kfsw_scrub_visitor_t visitor, void *context) |
Variables | |
| const struct kfsw_param_definition_set | kfsw_scrub_param_definitions |
Re-reads the resident images and compares a CRC32 against a reference kept across resets.
FWU checks an image as it arrives and the bootloader checks the slot it boots; without this, the slot that is not running and the recovery image are never read again, so a bit flip in either is found when the image is needed and not before.
The reference is learned on command, never silently: a region whose reference is unknown reports KFSW_SCRUB_UNKNOWN and never KFSW_SCRUB_OK.
The storage partition is deliberately not a region. It is a mutable filesystem holding the parameter snapshots, the journal and the procedure files, so a checksum over it would differ after every ordinary write.
| #define KFSW_SCRUB_NAME_SIZE 8U |
#include <scrub.h>
Longest region name kept, including the terminator.
| #define KFSW_SCRUB_PARAM_TABLE_ID 39U |
#include <scrub.h>
Table 39: what the last sweep found in each region.
| #define KFSW_SCRUB_PARAM_TABLE_NAME "scrub" |
#include <scrub.h>
Parameter table name.
| typedef bool(* kfsw_scrub_visitor_t) (const struct kfsw_scrub_result *result, void *context) |
#include <scrub.h>
A visitor over the regions.
Returning false stops the walk.
| enum kfsw_scrub_event |
| enum kfsw_scrub_region |
| enum kfsw_scrub_state |
#include <scrub.h>
What a sweep concluded about one region.
| int kfsw_scrub_get_result | ( | enum kfsw_scrub_region | region, |
| struct kfsw_scrub_result * | result | ||
| ) |
#include <scrub.h>
Read one region's last result.
Returns -EINVAL for an unknown region.
| void kfsw_scrub_get_status | ( | struct kfsw_scrub_status * | status | ) |
#include <scrub.h>
Copy the counters.
| int kfsw_scrub_learn | ( | enum kfsw_scrub_region | region | ) |
#include <scrub.h>
Take the last measurement of a region as its reference.
Sweeps the region first, so what is learned is what is on flash now. The reference is persisted, because a reference held only in RAM would be relearned at every boot and could never report a mismatch.
| 0 | Learned and persisted. |
| -ENODEV | The region does not exist in this build. |
| -ENOENT | The region holds no image. |
| -EIO | The region could not be read, or the snapshot not written. |
| int kfsw_scrub_start | ( | void | ) |
#include <scrub.h>
Start sweeping on the configured period.
| int kfsw_scrub_stop | ( | void | ) |
#include <scrub.h>
Stop sweeping.
The recorded numbers stay readable.
| int kfsw_scrub_sweep | ( | void | ) |
#include <scrub.h>
Sweep every present region once.
| int kfsw_scrub_sweep_region | ( | enum kfsw_scrub_region | region | ) |
#include <scrub.h>
Sweep one region.
| 0 | Swept; read the result to see what it concluded. |
| -ENODEV | The region does not exist in this build. |
| -EINVAL | No such region. |
| void kfsw_scrub_visit_regions | ( | kfsw_scrub_visitor_t | visitor, |
| void * | context | ||
| ) |
#include <scrub.h>
Walk every region, present or not, in id order.
|
extern |
#include <scrub.h>
Parameter table 39.