FastLED 3.10.8
Loading...
Searching...
No Matches
boot_guard_record.h File Reference

Detailed Description

Platform-neutral record format and policy for the early-boot loop guard (see fl/wdt/boot_guard.h).

Everything is always-inline: platforms call it from startup hooks that run before normal code memory is ready.

Definition in file boot_guard_record.h.

+ Include dependency graph for boot_guard_record.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fl::BootGuardDecision
 What the early-boot hook does on this boot. More...
 
struct  fl::BootGuardRecord
 Reset-persistent boot-guard record. More...
 

Namespaces

namespace  fl
 Base definition for an LED controller.
 

Functions

FL_ALWAYS_INLINE fl::u32 fl::bootGuardCheck (fl::u32 image, fl::u32 boots, fl::u32 crashes)
 
FL_ALWAYS_INLINE fl::u32 fl::bootGuardDecode (const volatile BootGuardRecord &r, fl::u32 image)
 Boot count stored in r, or 0 if r is not a valid record of image.
 
FL_ALWAYS_INLINE fl::u32 fl::bootGuardDecodeCrashes (const volatile BootGuardRecord &r, fl::u32 image)
 Crash count stored in r, or 0 if r is not a valid record of image.
 
FL_ALWAYS_INLINE void fl::bootGuardEncode (volatile BootGuardRecord &r, fl::u32 image, fl::u32 boots)
 Store boots, keeping the crash count (0 if the record is invalid).
 
FL_ALWAYS_INLINE void fl::bootGuardEncodeCrashes (volatile BootGuardRecord &r, fl::u32 image, fl::u32 crashes)
 Store crashes, keeping the boot count (0 if the record is invalid).
 
FL_ALWAYS_INLINE fl::u32 fl::bootGuardHashWords (const volatile fl::u32 *words, fl::u32 count, fl::u32 stride=1)
 FNV-1a over every stride-th of count 32-bit words; platforms hash their firmware image with it to get the record key.
 
FL_ALWAYS_INLINE BootGuardDecision fl::bootGuardOnBoot (fl::u32 stored_boots, fl::u32 escape_boots)
 Boot-guard policy.
 
FL_ALWAYS_INLINE void fl::bootGuardStore (volatile BootGuardRecord &r, fl::u32 image, fl::u32 boots, fl::u32 crashes)
 Store both counts in r as a valid record of image.
 
FL_ALWAYS_INLINE bool fl::bootGuardValid (const volatile BootGuardRecord &r, fl::u32 image)
 True when r holds a valid record written by firmware image.
 

Variables

constexpr fl::u32 fl::kBootGuardMagic = 0xFA57B008u
 

Class Documentation

◆ fl::BootGuardDecision

struct fl::BootGuardDecision
Class Members
u32 boots count to store before continuing
bool escape reboot into the bootloader now

◆ fl::BootGuardRecord

struct fl::BootGuardRecord
Class Members
u32 boots consecutive boots that never called markBootHealthy()
u32 check checksum of the fields above, rejects power-on garbage
u32 crashes consecutive watchdog resets (Watchdog::consecutiveCrashCount())
u32 image key of the firmware image that wrote the record
u32 magic
u32 reserved[3]