ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_fs_fat_protos_b_internal.h
Go to the documentation of this file.
1
20
21#pragma once
22
23#include "ra8_attributes.h"
25
48 uint32_t cluster,
49 uint32_t idx,
50 const uint8_t* set,
51 uint32_t bytes);
52
81 uint64_t abs_lba,
82 uint32_t bps,
83 uint32_t* out_csum);
84
111void priv_fat_entry_apply_attr(uint8_t* entry, uint8_t set_mask, uint8_t clear_mask);
112
138ra8_err_t priv_fat_get(const ra8_fs_mount_t* m, uint32_t cluster, uint32_t* out_value);
139
164ra8_err_t priv_fat_set(const ra8_fs_mount_t* m, uint32_t cluster, uint32_t value);
165
202
245priv_fmt_clear_region(const ra8_fs_backend_t* backend, uint64_t lba, uint64_t count, uint32_t bps);
246
276 const ra8_fs_fmt_geom_t* g,
277 const char* label);
278
302
329void priv_fmt_label_field(uint8_t* dst, const char* label);
330
353bool priv_fmt_spc_valid(uint8_t spc);
354
379ra8_err_t priv_free_chain(const ra8_fs_mount_t* m, uint32_t start);
380
403uint8_t priv_is_eoc(const ra8_fs_mount_t* m, uint32_t value);
404
436void priv_lfn_add(lfn_state_t* s, const uint8_t* ent);
437
469const uint16_t*
470priv_lfn_units_for(const lfn_state_t* s, const uint8_t* name83, uint32_t* out_units);
471
495
520void priv_lock_acquire(void);
521
542RA8_RELEASES_RESOURCE("ra8_fs_lock")
543void priv_lock_release(void);
544
574RA8_EXPECTS_LOCK("ra8_fs_lock")
576 const char* path,
577 ra8_fs_mode_t mode,
578 ra8_fs_file_t** out_file);
579
603
623
648uint8_t priv_path_to_83(const char* path, uint8_t* out11);
649
673ra8_err_t priv_read_sector(const ra8_fs_mount_t* m, uint64_t lba, uint8_t* buf);
674
702ra8_err_t priv_resolve_dir(const ra8_fs_mount_t* m, const char* path, dir_loc_t* out);
703
735 const char* path,
736 dir_loc_t* out_parent,
737 const char** out_leaf);
738
755uint32_t priv_strlen(const char* s);
756
778char priv_to_upper(char c);
779
810 uint64_t lba,
811 uint32_t off_in_sector,
812 const uint8_t* src,
813 uint32_t put);
814
838ra8_err_t priv_write_sector(const ra8_fs_mount_t* m, uint64_t lba, const uint8_t* buf);
Annotation-attribute framework macros for ra8-firmware.
#define RA8_RELEASES_RESOURCE(kind)
Release side of the RA8_OWNS_RESOURCE(kind) pair.
#define RA8_PRIV
Module-private helper: shared across TUs but only inside one library.
#define RA8_EXPECTS_LOCK(name)
The function expects the named thread/IRQ lock to be held on entry.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Definition ra8_err.h:546
ra8_err_t priv_read_sector(const ra8_fs_mount_t *m, uint64_t lba, uint8_t *buf)
Read a single sector into the module scratch buffer.
Definition ra8_fs_fat.c:134
ra8_err_t priv_write_sector(const ra8_fs_mount_t *m, uint64_t lba, const uint8_t *buf)
Write a single sector from a caller-provided buffer.
Definition ra8_fs_fat.c:140
uint32_t priv_strlen(const char *s)
Length of a NUL-terminated string.
ra8_err_t priv_parse_volume(ra8_fs_mount_t *m)
Parse the volume at the current base: exFAT first, then FAT BPB.
ra8_err_t priv_resolve_dir(const ra8_fs_mount_t *m, const char *path, dir_loc_t *out)
Resolve a whole path to the directory it names.
ra8_err_t priv_open_locked(ra8_fs_mount_t *handle, const char *path, ra8_fs_mode_t mode, ra8_fs_file_t **out_file)
Open a file by path – the guarded body of ra8_fs_open().
ra8_err_t priv_resolve_parent(const ra8_fs_mount_t *m, const char *path, dir_loc_t *out_parent, const char **out_leaf)
Resolve all-but-the-last path component to a parent directory.
ra8_err_t priv_write_into_sector(const ra8_fs_mount_t *m, uint64_t lba, uint32_t off_in_sector, const uint8_t *src, uint32_t put)
Implementation of priv_write_into_sector() – one read-modify-write.
void priv_lock_release(void)
Drop the library lock taken by priv_lock_acquire.
ra8_err_t priv_parse_bpb_into_mount(ra8_fs_mount_t *m)
Parse the BPB layout fields out of g_fs_scratch into m.
uint8_t priv_path_to_83(const char *path, uint8_t *out11)
Convert a "/FILE.TXT"-style path to packed 11-byte 8.3 form.
char priv_to_upper(char c)
Convert "FILE.TXT" (caller-supplied path) to packed 11-byte 8.3.
ra8_err_t priv_fat_get(const ra8_fs_mount_t *m, uint32_t cluster, uint32_t *out_value)
Fetch the FAT entry for cluster, returning the next-cluster value.
Definition ra8_fs_fat.c:187
ra8_err_t priv_exfat_write_upcase(const ra8_fs_backend_t *backend, uint64_t abs_lba, uint32_t bps, uint32_t *out_csum)
Write the canonical exFAT up-case table and return its checksum.
ra8_err_t priv_fat_set(const ra8_fs_mount_t *m, uint32_t cluster, uint32_t value)
Write value into the FAT entry for cluster across every FAT copy.
Definition ra8_fs_fat.c:486
uint8_t priv_is_eoc(const ra8_fs_mount_t *m, uint32_t value)
Test whether value is an end-of-chain marker for this FAT type.
Definition ra8_fs_fat.c:511
ra8_err_t priv_fmt_emit_volume(const ra8_fs_backend_t *backend, const ra8_fs_fmt_geom_t *g, const char *label)
Lay down the boot sector, FAT seeds, FSInfo, and the empty root.
ra8_err_t priv_fmt_choose_geometry(ra8_fs_fmt_geom_t *g, uint32_t spc_hint)
Pick the cluster size that lands the FAT cluster count in the right band.
ra8_err_t priv_free_chain(const ra8_fs_mount_t *m, uint32_t start)
Free an entire cluster chain starting at start.
ra8_err_t priv_exfat_write_dir_set(const ra8_fs_mount_t *m, uint32_t cluster, uint32_t idx, const uint8_t *set, uint32_t bytes)
Write a pre-built entry set into consecutive directory entries.
ra8_err_t priv_fmt_clear_region(const ra8_fs_backend_t *backend, uint64_t lba, uint64_t count, uint32_t bps)
Clear count blocks at lba to zero – bulk-erase if the backend can.
void priv_lfn_add(lfn_state_t *s, const uint8_t *ent)
Fold one LFN directory entry's 13 UTF-16LE code units into the state.
const uint16_t * priv_lfn_units_for(const lfn_state_t *s, const uint8_t *name83, uint32_t *out_units)
Code units of the chain that precedes name83, or NULL if none.
bool priv_fmt_spc_valid(uint8_t spc)
Validate a caller-pinned sectors-per-cluster value.
void priv_fmt_label_field(uint8_t *dst, const char *label)
Pad an ASCII volume label into an 11-byte BS_VolLab / label field.
void priv_lock_acquire(void)
Take the library lock, if the caller installed one.
void priv_fat_entry_apply_attr(uint8_t *entry, uint8_t set_mask, uint8_t clear_mask)
Clear then set attribute bits in a 32-byte FAT directory entry.
void priv_lfn_reset(lfn_state_t *s)
Reset the LFN reassembly state so a fresh chain can start.
uint32_t priv_fmt_reserved_for(ra8_fs_type_t type)
Map a requested FAT type to its reserved-sector count.
Cross-TU on-disk-layout enums and typedefs for the FAT/exFAT adapter.
ra8_fs_type_t
FAT variant detected from the BPB cluster-count rule.
ra8_fs_mode_t
File-open modes accepted by ra8_fs_open().
Identifies the directory a lookup/scan should operate in.
In-progress reassembly of one LFN chain across the directory scan.
Block-device interface that ra8_fs runs on top of.
Open-file state.
Computed on-disk geometry for one ra8_fs_format() run.
Cached parse of one mounted FAT volume.