Audio added to firmware, Website File handling
This commit is contained in:
@@ -4,32 +4,43 @@
|
||||
#include <zephyr/fs/fs.h>
|
||||
#include "buzz_proto.h"
|
||||
|
||||
#define FS_MGMT_MAX_PATH_LENGTH 32
|
||||
#define FS_AUDIO_PATH CONFIG_FS_MGMT_MOUNT_POINT CONFIG_FS_MGMT_AUDIO_SUBDIR
|
||||
#define FS_SYSTEM_PATH CONFIG_FS_MGMT_MOUNT_POINT CONFIG_FS_MGMT_SYSTEM_SUBDIR
|
||||
|
||||
/**
|
||||
* @brief Initializes the filesystem management module.
|
||||
*/
|
||||
int fs_mgmt_init(void);
|
||||
#define MAX_FILE_NAME_LEN(target, path) \
|
||||
((int)(sizeof(target) - (sizeof(path)) - 1))
|
||||
|
||||
/** @brief Assemble a full path from a base path and a filename
|
||||
* Ensures that the resulting path fits into the target buffer and is null-terminated. If the filename is too long, it will be truncated to fit.
|
||||
* @param buffer Target buffer to hold the assembled path
|
||||
* @param path Base path (e.g. "/sys" or "/audio")
|
||||
* @param filename Name of the file to append to the base path
|
||||
*/
|
||||
#define FS_MGMT_ASSEMBLE_PATH(buffer, path, filename) \
|
||||
snprintf(buffer, sizeof(buffer), \
|
||||
"%s/%.*s", \
|
||||
path, \
|
||||
MAX_FILE_NAME_LEN(buffer, path), \
|
||||
filename)
|
||||
|
||||
/**
|
||||
* @brief OP-Codes for the FS write thread
|
||||
*/
|
||||
enum fs_write_op {
|
||||
enum fs_write_op
|
||||
{
|
||||
FS_WRITE_OP_FILE_START,
|
||||
FS_WRITE_OP_FILE_CHUNK,
|
||||
FS_WRITE_OP_FILE_END,
|
||||
FS_WRITE_OP_TAGS_START, // Schon mal vorgesehen
|
||||
FS_WRITE_OP_FW_START, // Schon mal vorgesehen
|
||||
FS_WRITE_OP_TAGS_START, // Schon mal vorgesehen
|
||||
FS_WRITE_OP_FW_START, // Schon mal vorgesehen
|
||||
FS_WRITE_OP_ABORT
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Structure representing a write message for the FS write thread
|
||||
*/
|
||||
struct fs_write_msg {
|
||||
struct fs_write_msg
|
||||
{
|
||||
enum fs_write_op op;
|
||||
uint8_t *slab_ptr; /* Basis-Pointer des Memory-Slabs (für k_mem_slab_free) */
|
||||
uint16_t data_offset; /* Offset ab dem slab_ptr, wo die Nutzdaten beginnen */
|
||||
@@ -135,7 +146,7 @@ int fs_mgmt_pm_rm_recursive(char *path, size_t max_len);
|
||||
* @param fp Pointer to an open fs_file_t structure representing the file
|
||||
* @return Length of the audio data on success, negative error code on failure
|
||||
*/
|
||||
ssize_t fs_get_audio_data_len(struct fs_file_t *fp);
|
||||
ssize_t fs_mgmt_get_audio_data_len(struct fs_file_t *fp);
|
||||
|
||||
/**
|
||||
* @brief Submits a write message to the FS write thread, which will handle writing data to the filestem asynchronously, ensuring the flash is active during the operation
|
||||
|
||||
Reference in New Issue
Block a user