#include "SFBChecksum.h"
#include "SFBTypes.h"
#include "SFBEeprom.h"
#include "SFBPower.h"
Go to the source code of this file.
Data Structures | |
struct | SFBBootBlock |
The exactly-64-byte-long SFB 'boot block' contents. More... | |
Defines | |
#define | BOOTBLOCK_MIN_VERSION 0x01 |
Minimum legal boot block version; excludes 0. | |
#define | BOOTBLOCK_MAX_VERSION 0xfe |
Maximum legel boot block version, excludes 0xff. | |
#define | BOOTBLOCK_VERSION 6 |
The current boot block version. | |
Enumerations | |
enum | SFBBootBlockFlag { BOOTBLOCK_INVALID = 0x0001, BOOTBLOCK_BOOT_MODE = 0x0002, BOOTBLOCK_BLUE_NOT_RED = 0x0004, BOOTBLOCK_UNLOCKED = 0x0008, BOOTBLOCK_NO_UPDATES = 0x0010, BOOTBLOCK_KILL_SKETCH = 0x0020, BOOTBLOCK_RSRVD06 = 0x0040, BOOTBLOCK_RSRVD07 = 0x0080, BOOTBLOCK_RSRVD08 = 0x0100, BOOTBLOCK_RSRVD09 = 0x0200, BOOTBLOCK_RSRVD10 = 0x0400, BOOTBLOCK_RSRVD11 = 0x0800, BOOTBLOCK_RSRVD12 = 0x1000, BOOTBLOCK_RSRVD13 = 0x2000, BOOTBLOCK_RSRVD14 = 0x4000, BOOTBLOCK_RSRVD15 = 0x8000, BOOTBLOCK_DEFINED_FLAGS } |
Flags that can be set in the SFBBootBlock. More... | |
Functions | |
u32 | getBootBlockVersion () |
Get bootblock version. | |
u8 | getBootBlockWatchdogResets () |
Get bootblock watchdog resets byte. | |
u32 | getBootBlockOwnerId () |
Get bootblock owner id. | |
u32 | getBootBlockBoardId () |
Get bootblock board id. | |
u32 | getBootBlockBootCount () |
Get bootblock boot count. | |
u32 | getBootBlockBurnCount () |
Get bootblock sketch burn count. | |
u32 | getBootBlockPowerOnHours () |
Get bootblock total Power-On-Hours count. | |
u32 | getBootBlockFlags () |
Get bootblock flags. | |
u32 | getBootBlockBootMode () |
Get bootblock boot mode. | |
u32 | getBootBlockMergedChecksum () |
Return the u32 XOR (exclusive-OR) of the two halves of the bootblock checksum. | |
bool | getBootBlockPowerIn (u8 face) |
Return true if input power should be accepted from face at power up. | |
bool | getBootBlockPowerOut (u8 face) |
Return true if output power should be provided from face at power up. | |
void | setBootBlockPowerIn (u8 face, bool accept) |
Specify whether input power should be. | |
void | setBootBlockPowerOut (u8 face, bool provide) |
accepted (accept equals true ) or blocked (accept equals false ) on face. | |
const char * | bootModeColorName (u32 bootMode) |
provided (provide equals true ) or not (provide equals false ) on face at boot time. | |
u32 | getBootBlockBootLoaderLength () |
Access the size of the tertiary bootloader. | |
u32 | getBootBlockBootLoaderBurnCount () |
Access the count of how many times the tertiary bootloader itself has been burned. | |
void | getBootBlockBootLoaderChecksum (SFBChecksum cs) |
Access the checksum of the tertiary bootloader itself. | |
void | setBootBlockWatchdogResetFlag (bool bootedClean) |
Add another bit to the bottom of the watchdog reset flag byte, pushing the existing bits to the left. | |
void | setBootBlockOwnerId (u32 newOwnerId) |
Write the boot block owner id field. | |
void | setBootBlockBoardId (u32 newBoardId) |
Write the boot block board id field. | |
void | incrementBootBlockBootCount () |
Increment the boot count in the boot block. | |
void | incrementBootBlockBurnCount () |
Increment the burn count in the boot block. | |
void | incrementBootBlockPowerOnHours () |
Increment the power on hours in the boot block. | |
void | setBootBlockFlags (u32 newFlags) |
Write the boot block flags. | |
void | setBootBlockBootMode (u32 newBootMode) |
Set the boot block boot mode. | |
void | getBootBlockVoltageCalibrationData (u8 data[VOLTAGE_CALIBRATION_SIZE_BYTES]) |
Fill data with the voltage calibration data (returns all zeros if this board was never voltage-calibrated). | |
void | setBootBlockVoltageCalibrationData (u8 data[VOLTAGE_CALIBRATION_SIZE_BYTES]) |
Stores voltage calibration data read from data. |
#define BOOTBLOCK_MAX_VERSION 0xfe |
Maximum legel boot block version, excludes 0xff.
#define BOOTBLOCK_MIN_VERSION 0x01 |
Minimum legal boot block version; excludes 0.
#define BOOTBLOCK_VERSION 6 |
The current boot block version.
This value can never decrease, during any and all future evolution of the SFB code.
enum SFBBootBlockFlag |
Flags that can be set in the SFBBootBlock.
const char* bootModeColorName | ( | u32 | bootMode | ) |
provided (provide equals true
) or not (provide equals false
) on face at boot time.
u32 getBootBlockBootLoaderBurnCount | ( | ) |
Access the count of how many times the tertiary bootloader itself has been burned.
Even though strictly speaking that's not 'boot block business'. Also note that it is possible for this count to get reset if various errors occur during reflashing, so it should be treated as likely lower bound on the count.
void getBootBlockBootLoaderChecksum | ( | SFBChecksum | cs | ) |
Access the checksum of the tertiary bootloader itself.
Even though strictly speaking that's not 'boot block business'.
u32 getBootBlockBootLoaderLength | ( | ) |
Access the size of the tertiary bootloader.
Even though strictly speaking that's not 'boot block business'.
u32 getBootBlockBootMode | ( | ) |
Get bootblock boot mode.
u32 getBootBlockMergedChecksum | ( | ) |
Return the u32
XOR (exclusive-OR) of the two halves of the bootblock checksum.
This value is used by the library startup code to generate the random number seed.
bool getBootBlockPowerIn | ( | u8 | face | ) |
Return true if input power should be accepted from face at power up.
The return value when output equals false
is meaningful only on boards with power input controls; is a noop otherwise. Note this value reflects only the boot time setting; even if power input is subsequently manipulated via powerIn, this value does not change. See setBootBlockPowerIn to change this value.
u32 getBootBlockPowerOnHours | ( | ) |
Get bootblock total Power-On-Hours count.
Note this counts only full consecutive uptime hours; all fractions are dropped no matter what their cumulative time. Note also that this value can be affected by RF_LESS_EEPROM.
bool getBootBlockPowerOut | ( | u8 | face | ) |
Return true if output power should be provided from face at power up.
Note this value reflects only the boot time setting; even if power output is subsequently manipulated via powerOut, this value does not change. See setBootBlockPowerOut to change this value.
u32 getBootBlockVersion | ( | ) |
void setBootBlockBoardId | ( | u32 | newBoardId | ) |
Write the boot block board id field.
Fails silently unless the boot block is unlocked.
void setBootBlockOwnerId | ( | u32 | newOwnerId | ) |
Write the boot block owner id field.
Fails silently unless the boot block is unlocked.
void setBootBlockPowerOut | ( | u8 | face, | |
bool | provide | |||
) |
accepted (accept equals true
) or blocked (accept equals false
) on face.
The value set is meaningful only on boards with power input controls; this method is a noop otherwise. Specify whether output power should be
void setBootBlockVoltageCalibrationData | ( | u8 | data[VOLTAGE_CALIBRATION_SIZE_BYTES] | ) |
Stores voltage calibration data read from data.
Storing all zeros implies 'no calibration data available', which will cause faceVoltage and railVoltage to fall back on approximate 'datasheet defaults'.
void setBootBlockWatchdogResetFlag | ( | bool | bootedClean | ) |
Add another bit to the bottom of the watchdog reset flag byte, pushing the existing bits to the left.