updater: Add function to safety memory for storing the update file name
This commit is contained in:
@@ -47,6 +47,8 @@
|
||||
|
||||
#define SAFETY_MEMORY_CONFIG_OVERRIDE_COUNT 32UL
|
||||
|
||||
#define SAFETY_MEMORY_UPDATE_FILENAME_MAXSIZE 256U
|
||||
|
||||
/**
|
||||
* @brief Safety memory header
|
||||
*/
|
||||
@@ -55,6 +57,7 @@ struct safety_memory_header {
|
||||
uint32_t boot_status_offset; /**< @brief Offset of the safety_memory_boot_status struct (in 32 bit words)*/
|
||||
uint32_t config_overrides_offset; /**< @brief Offset address of override entries */
|
||||
uint32_t config_overrides_len; /**< @brief Length of override entries in words */
|
||||
uint32_t firmware_update_filename; /**< @brief Filename of the firmware update. This string is at maximum 256 bytes long including the 0 terminator */
|
||||
uint32_t err_memory_offset; /**< @brief Offset of the error memory */
|
||||
uint32_t err_memory_end; /**< @brief End of the error memory. This points to the word after the error memory, containing the CRC of the whole backup RAM. */
|
||||
uint32_t crc; /**< @brief CRC of the header */
|
||||
@@ -247,6 +250,26 @@ int safety_memory_get_config_override_count(uint32_t *count);
|
||||
*/
|
||||
int safety_memory_get_config_override(uint32_t idx, struct config_override *config_override);
|
||||
|
||||
/**
|
||||
* @brief Read the set update filename from the safety backup memory
|
||||
*
|
||||
* \p filename has to be large enough to hold the filename (255 chars) plus the '\0'-terminator.
|
||||
*
|
||||
* @param[out] filename Array to fill in file name. May be NULL to only read the length.
|
||||
* @param[out] outlen String length of the filename. May be NULL to only read the file name.
|
||||
* @note \p filename may be NULL. In this case this function can be used to read the currently set filename's length.
|
||||
* @warning Function will fail if both parameters are NULL
|
||||
* @return 0 if successful
|
||||
*/
|
||||
int safety_memory_get_update_filename(char *filename, size_t *outlen);
|
||||
|
||||
/**
|
||||
* @brief Set the filename of the update file
|
||||
* @param[in] filename Filename to set. Must be 255 chars at max (256 including null terminator)
|
||||
* @return 0 if successful
|
||||
*/
|
||||
int safety_memory_set_update_filename(const char *filename);
|
||||
|
||||
#ifndef SAFETY_MEMORY_STRIPOUT_DUMP
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user