ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_fs_fat_alloc_internal.h
Go to the documentation of this file.
1
45
46#pragma once
47
48#include <stdint.h>
49
50#include "ra8_attributes.h"
51#include "ra8_fs.h"
52
62typedef enum : uint32_t {
63 k_fs_free_unknown = 0xFFFFFFFFU,
67
82typedef enum : uint64_t {
83 k_fs_cache_empty = 0xFFFFFFFFFFFFFFFFU,
84 k_fs_bitmap_unknown = 0xFFFFFFFFFFFFFFFFU,
86
115
138
172ra8_err_t priv_fat_sector_read(const ra8_fs_mount_t* m, uint64_t lba, uint8_t* buf);
173
199void priv_fat_sector_wrote(const ra8_fs_mount_t* m, const uint8_t* buf, uint64_t lba);
200
225uint32_t priv_alloc_hint_get(const ra8_fs_mount_t* m);
226
249void priv_alloc_hint_set(const ra8_fs_mount_t* m, uint32_t cluster);
250
275void priv_alloc_hint_lower(const ra8_fs_mount_t* m, uint32_t cluster);
276
300void priv_free_count_took(const ra8_fs_mount_t* m, uint32_t n);
301
325void priv_free_count_gave(const ra8_fs_mount_t* m, uint32_t n);
326
353uint32_t priv_free_count_peek(const ra8_fs_mount_t* m);
354
383void priv_free_count_cache(const ra8_fs_mount_t* m, uint32_t n);
384
420
451
484ra8_err_t priv_exfat_bitmap_lba(const ra8_fs_mount_t* m, uint64_t* out_lba);
Annotation-attribute framework macros for ra8-firmware.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
ra8_fs_alloc_const_t
Sentinels and bounds for the per-mount allocator state.
@ k_fs_fsinfo_absent
No usable FSInfo sector on this vol.
@ k_fs_alloc_slots
One state slot per mount slot.
@ k_fs_free_unknown
MS FAT spec sec 5: count not known.
ra8_err_t priv_fsinfo_seed(const ra8_fs_mount_t *m)
Validate FAT32's FSInfo sector and seed the hint and free count.
void priv_free_count_took(const ra8_fs_mount_t *m, uint32_t n)
Account n clusters as taken out of the volume's free space.
void priv_free_count_gave(const ra8_fs_mount_t *m, uint32_t n)
Account n clusters as returned to the volume's free space.
uint32_t priv_free_count_peek(const ra8_fs_mount_t *m)
Report the tracked free-cluster count, or k_fs_free_unknown.
void priv_alloc_hint_lower(const ra8_fs_mount_t *m, uint32_t cluster)
Pull the next-free hint back to cluster if it is further on.
void priv_alloc_state_bind(const ra8_fs_mount_t *m)
Claim and reset the allocator state slot for a freshly mounted volume.
void priv_fat_sector_wrote(const ra8_fs_mount_t *m, const uint8_t *buf, uint64_t lba)
Tell the cache that lba has just been written with buf.
void priv_alloc_hint_set(const ra8_fs_mount_t *m, uint32_t cluster)
Move the next-free hint forward to cluster.
ra8_err_t priv_fsinfo_flush(const ra8_fs_mount_t *m)
Write the tracked free count and next-free hint back into FSInfo.
ra8_err_t priv_fat_sector_read(const ra8_fs_mount_t *m, uint64_t lba, uint8_t *buf)
Read one FAT sector, through the shared one-sector cache.
ra8_err_t priv_exfat_bitmap_lba(const ra8_fs_mount_t *m, uint64_t *out_lba)
Resolve the exFAT allocation bitmap's first LBA, once per mount.
void priv_alloc_state_release(const ra8_fs_mount_t *m)
Release the allocator state slot held by m.
uint32_t priv_alloc_hint_get(const ra8_fs_mount_t *m)
Report the cluster a free-space scan should start from.
ra8_fs_alloc_lba_const_t
64-bit LBA sentinels for the per-mount allocator state.
@ k_fs_cache_empty
Cache holds no sector.
@ k_fs_bitmap_unknown
exFAT bitmap LBA not resolved yet.
void priv_free_count_cache(const ra8_fs_mount_t *m, uint32_t n)
Cache a freshly counted free-cluster total in the allocator slot.
Cached parse of one mounted FAT volume.