This commit is contained in:
2026-02-27 11:50:27 +01:00
parent 5934bba4af
commit 82b535a183
12 changed files with 323 additions and 65 deletions

View File

@@ -3,6 +3,11 @@
#include <zephyr/fs/fs.h>
typedef struct slot_info_t {
size_t start_addr;
size_t size;
} slot_info_t;
/**
* @brief Initializes the filesystem by mounting it
*/
@@ -68,4 +73,35 @@ int fs_pm_unlink(const char *path);
* @return 0 on success, negative error code on failure
*/
int fs_pm_statvfs(const char *path, struct fs_statvfs *stat);
/**
* @brief Wrapper around fs_mkdir that handles power management for the flash
* Resumes the flash before creating the directory and suspends it afterwards
* @param path Path to the directory to create
* @return 0 on success, negative error code on failure
*/
int fs_pm_mkdir(const char *path);
/**
* @brief Retrieves information about the firmware slot, such as start address and size
* @param info Pointer to slot_info_t structure to be filled with slot information
* @return 0 on success, negative error code on failure
*/
int flash_get_slot_info(slot_info_t *info);
/**
* @brief Initializes the flash for firmware upload, preparing it for receiving new firmware data
* @return 0 on success, negative error code on failure
*/
int flash_init_firmware_upload(void);
/**
* @brief Writes a block of firmware data to the flash
* @param buffer Pointer to the data buffer
* @param length Length of the data buffer
* @param is_last_block Indicates if this is the last block of the firmware
* @return 0 on success, negative error code on failure
*/
int flash_write_firmware_block(const uint8_t *buffer, size_t length, bool is_last_block);
#endif // FS_H