This commit is contained in:
2026-03-01 11:11:56 +01:00
parent c914333236
commit 844e8e06ca
17 changed files with 624 additions and 79 deletions

View File

@@ -82,6 +82,40 @@ int fs_pm_statvfs(const char *path, struct fs_statvfs *stat);
*/
int fs_pm_mkdir(const char *path);
/**
* @brief Gets the length of the audio data in a file, accounting for any metadata tags
* @param fp Pointer to an open fs_file_t structure representing the audio file
* @return Length of the audio data in bytes, or negative error code on failure
*/
int fs_get_audio_data_len(struct fs_file_t *fp);
/**
* @brief Reads audio data from a file, ensuring that it does not read past the audio data limit
* @param fp Pointer to an open fs_file_t structure representing the audio file
* @param buffer Pointer to the buffer to read data into
* @param len Maximum number of bytes to read
* @param audio_limit Maximum byte offset for audio data (e.g. file size minus metadata)
* @return Number of bytes read, or negative error code on failure
*/
int fs_read_audio(struct fs_file_t *fp, void *buffer, size_t len, size_t audio_limit);
/**
* @brief Writes a hexadecimal string as a metadata tag at the end of an audio file
* @param fp Pointer to an open fs_file_t structure representing the audio file
* @param hex_str Null-terminated string containing hexadecimal characters (0-9, a-f, A-F)
* @return 0 on success, negative error code on failure
*/
int fs_write_hex_tag(struct fs_file_t *fp, const char *hex_str);
/**
* @brief Reads a hexadecimal string from a metadata tag at the end of an audio file
* @param fp Pointer to an open fs_file_t structure representing the audio file
* @param hex_str Buffer to be filled with the hexadecimal string (must be large enough to hold the data)
* @param hex_str_size Size of the hex_str buffer
* @return 0 on success, negative error code on failure
*/
int fs_read_hex_tag(struct fs_file_t *fp, char *hex_str, size_t hex_str_size);
/**
* @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