1
6
7
8
9
15
16
19
20
29
30
38
39
40
49
50
51
/* ... */
#pragma once
#include "esp_vfs_fat.h"
#include "diskio_impl.h"
#include "esp_partition.h"
#include "sdmmc_cmd.h"
#include <sys/param.h>
#include <stddef.h>6 includes
typedef enum {
FORMATTED_DURING_LAST_MOUNT = 1 << 0,
}{ ... } vfs_fat_x_ctx_flags_t;
typedef struct vfs_fat_spiflash_ctx_t {
const esp_partition_t *partition;
bool by_label;
BYTE pdrv;
FATFS *fs;
wl_handle_t wlhandle;
esp_vfs_fat_mount_config_t mount_config;
vfs_fat_x_ctx_flags_t flags;
}{ ... } vfs_fat_spiflash_ctx_t;
typedef struct vfs_fat_sd_ctx_t {
BYTE pdrv;
esp_vfs_fat_mount_config_t mount_config;
FATFS *fs;
sdmmc_card_t *card;
char *base_path;
vfs_fat_x_ctx_flags_t flags;
}{ ... } vfs_fat_sd_ctx_t;
static inline size_t esp_vfs_fat_get_allocation_unit_size(
size_t sector_size, size_t requested_size)
{
size_t alloc_unit_size = requested_size;
const size_t max_sectors_per_cylinder = 128;
const size_t max_size = sector_size * max_sectors_per_cylinder;
alloc_unit_size = MAX(alloc_unit_size, sector_size);
alloc_unit_size = MIN(alloc_unit_size, max_size);
return alloc_unit_size;
}{ ... }
vfs_fat_spiflash_ctx_t* get_vfs_fat_spiflash_ctx(wl_handle_t wlhandle);
vfs_fat_sd_ctx_t* get_vfs_fat_get_sd_ctx(const sdmmc_card_t *card);