File syn_fat.c¶
FileList > src > syntropic > storage > syn_fat.c
Go to the source code of this file
#include "../log/syn_log.h"#include "../util/syn_assert.h"#include "../util/syn_pack.h"#include "syn_fat.h"#include <string.h>
Classes¶
| Type | Name |
|---|---|
| struct | DirEntryLoc Result of a directory scan — location of a matching entry. |
| struct | FAT_Volume Internal FAT volume metadata parsed from the boot sector. |
| struct | SYN_FatFileCtx Open file tracking context (pooled). |
Public Attributes¶
| Type | Name |
|---|---|
| SYN_SD | g_sd |
Public Static Attributes¶
| Type | Name |
|---|---|
| SYN_FatFileCtx | g_fat_files |
| const SYN_VfsOps | g_fat_vfs_ops = /* multi line expression */ |
| FAT_Volume | g_vol |
Public Functions¶
| Type | Name |
|---|---|
| const SYN_VfsOps * | syn_fat_get_ops (void) Get the VFS operations structure for the custom FAT filesystem. |
| SYN_Status | syn_fat_init (uint8_t spi_bus, SYN_GPIO_Pin cs) Initialize the SD card and mount the FAT filesystem in VFS at /sd. |
Public Static Functions¶
| Type | Name |
|---|---|
| uint32_t | cluster_to_sector (const FAT_Volume * vol, uint32_t cluster) |
| bool | fat_parse_bpb (FAT_Volume * vol, const uint8_t * bpb, uint32_t volume_start) |
| uint32_t | find_free_cluster (const FAT_Volume * vol) |
| uint32_t | find_partition_start (const uint8_t * sector0) |
| uint32_t | get_cluster_for_offset (const FAT_Volume * vol, uint32_t start_cluster, uint32_t offset) |
| void | path_to_fat_name (const char * path, char * fat_name) |
| uint32_t | read_fat_entry (const FAT_Volume * vol, uint32_t cluster) |
| bool | scan_root_dir (const FAT_Volume * vol, const char * fat_name, DirEntryLoc * loc, bool find_empty_slot) |
| int | syn_fat_vfs_close (SYN_VfsFile * file) |
| int | syn_fat_vfs_open (SYN_VfsFile * file, const char * path, int flags, void * fs_data) |
| int | syn_fat_vfs_read (SYN_VfsFile * file, void * buf, size_t len) |
| int32_t | syn_fat_vfs_seek (SYN_VfsFile * file, int32_t offset, int whence) |
| int32_t | syn_fat_vfs_tell (SYN_VfsFile * file) |
| int | syn_fat_vfs_unlink (const char * path, void * fs_data) |
| int | syn_fat_vfs_write (SYN_VfsFile * file, const void * buf, size_t len) |
| bool | write_fat_entry (const FAT_Volume * vol, uint32_t cluster, uint32_t value) |
Macros¶
| Type | Name |
|---|---|
| define | TAG "syn\_fat" |
Public Attributes Documentation¶
variable g_sd¶
Public Static Attributes Documentation¶
variable g_fat_files¶
variable g_fat_vfs_ops¶
variable g_vol¶
Public Functions Documentation¶
function syn_fat_get_ops¶
Get the VFS operations structure for the custom FAT filesystem.
Returns:
Pointer to the static SYN_VfsOps vtable.
function syn_fat_init¶
Initialize the SD card and mount the FAT filesystem in VFS at /sd.
Parameters:
spi_busSPI bus index.csGPIO CS pin index.
Returns:
SYN_OK on success, SYN_ERROR on failure.
Public Static Functions Documentation¶
function cluster_to_sector¶
function fat_parse_bpb¶
function find_free_cluster¶
function find_partition_start¶
function get_cluster_for_offset¶
static uint32_t get_cluster_for_offset (
const FAT_Volume * vol,
uint32_t start_cluster,
uint32_t offset
)
function path_to_fat_name¶
function read_fat_entry¶
function scan_root_dir¶
static bool scan_root_dir (
const FAT_Volume * vol,
const char * fat_name,
DirEntryLoc * loc,
bool find_empty_slot
)
function syn_fat_vfs_close¶
function syn_fat_vfs_open¶
function syn_fat_vfs_read¶
function syn_fat_vfs_seek¶
function syn_fat_vfs_tell¶
function syn_fat_vfs_unlink¶
function syn_fat_vfs_write¶
function write_fat_entry¶
Macro Definition Documentation¶
define TAG¶
The documentation for this class was generated from the following file src/syntropic/storage/syn_fat.c