546 if (create !=
nullptr) {
555 if (modify !=
nullptr) {
563 if (access !=
nullptr) {
578 if (create !=
nullptr) {
587 if (modify !=
nullptr) {
596 if (access !=
nullptr) {
613 if (clock ==
nullptr) {
618 if (clock->
now ==
nullptr) {
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
@ k_ra8_err_invalid_arg
Invalid function argument.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
Minimal FAT12/FAT16/FAT32 filesystem adapter (read + write).
void priv_wr32(uint8_t *p, uint32_t v)
Encode a little-endian uint32_t into a byte buffer.
void priv_wr16(uint8_t *p, uint16_t v)
Encode a little-endian uint16_t into a byte buffer.
Cross-TU shared declarations for the FAT/exFAT ra8_fs adapter.
void priv_fat_entry_set_times(uint8_t *entry, const ra8_fs_datetime_t *create, const ra8_fs_datetime_t *modify, const ra8_fs_datetime_t *access)
Set chosen FAT directory-entry timestamps from caller-supplied readings.
void priv_exfat_file_stamp_write(uint8_t *file_entry)
Advance an exFAT File entry's modification (and access) stamps.
void priv_exfat_file_stamp_create(uint8_t *file_entry)
Stamp a fresh exFAT File entry's create, modify, and access fields.
static bool internal_now_or_epoch(ra8_fs_datetime_t *out)
Read the installed clock, or hand back the FAT epoch.
void priv_exfat_file_stamp_access(uint8_t *file_entry)
Advance only an exFAT File entry's last-accessed stamp.
static void internal_fat_stamp_now(fat_stamp_t *out)
Pack the installed clock's reading into FAT's two words plus tenths.
void priv_fat_entry_stamp_access(uint8_t *entry)
Advance only a FAT directory entry's last-access date.
static ra8_fs_clock_t s_clock
The installed calendar binding; meaningful only when s_clock_bound.
void priv_exfat_file_set_times(uint8_t *file_entry, const ra8_fs_datetime_t *create, const ra8_fs_datetime_t *modify, const ra8_fs_datetime_t *access)
Set chosen exFAT File-entry timestamps from caller-supplied readings.
static uint8_t internal_utc_byte(int16_t minutes)
Encode a UTC offset in minutes as an exFAT UtcOffset byte.
static uint8_t internal_tenths_of(const ra8_fs_datetime_t *t)
Count the 10 ms increments the 2-second stamp granularity discards.
void priv_fat_entry_stamp_write(uint8_t *entry)
Advance a FAT directory entry's modification time and access date.
static void internal_fat_pack(const ra8_fs_datetime_t *t, fat_stamp_t *out)
Pack an already-clamped reading into FAT's two words plus the tenths.
static uint32_t internal_clamp_u32(uint32_t v, uint32_t lo, uint32_t hi)
Clamp v into the closed range [lo, hi].
ra8_err_t ra8_fs_set_clock(const ra8_fs_clock_t *clock)
Install (or remove) the calendar source used to stamp files.
void priv_fat_entry_stamp_create(uint8_t *entry)
Stamp a fresh FAT directory entry's create, write, and access fields.
static void internal_exfat_stamp_now(exfat_stamp_t *out)
Pack the installed clock's reading into exFAT's stamp plus side fields.
static void internal_clamp_datetime(ra8_fs_datetime_t *t)
Clamp every field of a broken-down time into its on-disk range.
static bool s_clock_bound
True once a complete binding has been installed.
static void internal_exfat_pack(const ra8_fs_datetime_t *t, bool real, exfat_stamp_t *out)
Pack an already-clamped reading into exFAT's stamp plus side fields.
@ k_fs_utc_span_min
UTC-12:00 expressed in minutes.
@ k_fs_utc_span_max
UTC+14:00 expressed in minutes.
@ k_exfat_off_file_mutc
exFAT spec sec 7.4.14 "LastModifiedUtcOffset".
@ k_exfat_off_file_m10ms
exFAT spec sec 7.4.12 "LastModified10ms".
@ k_exfat_off_file_atime
exFAT spec sec 7.4.10 "LastAccessedTimestamp".
@ k_exfat_off_file_mtime
exFAT spec sec 7.4.9 "LastModifiedTimestamp".
@ k_exfat_off_file_ctime
exFAT spec sec 7.4.8 "CreateTimestamp".
@ k_exfat_off_file_cutc
exFAT spec sec 7.4.13 "CreateUtcOffset".
@ k_exfat_off_file_autc
exFAT spec sec 7.4.15 "LastAccessedUtcOffset".
@ k_exfat_off_file_c10ms
exFAT spec sec 7.4.11 "Create10msIncrement".
@ k_dir_off_lst_acc_date
MS FAT spec sec 6 "DIR_LstAccDate".
@ k_dir_off_crt_time_tenth
MS FAT spec sec 6 "DIR_CrtTimeTenth".
@ k_dir_off_crt_date
MS FAT spec sec 6 "DIR_CrtDate".
@ k_dir_off_crt_time
MS FAT spec sec 6 "DIR_CrtTime".
@ k_dir_off_wrt_date
MS FAT spec sec 6 "DIR_WrtDate".
@ k_dir_off_wrt_time
MS FAT spec sec 6 "DIR_WrtTime".
@ k_fs_time_year_max
1980 + 127: last representable year.
@ k_fs_time_shift_hour
FAT time: hour field position.
@ k_fs_time_month_min
Month is 1-based on disk.
@ k_fs_time_second_max
Highest second.
@ k_fs_time_shift_minute
FAT time: minute field position.
@ k_fs_utc_valid_bit
exFAT UtcOffset bit 7 = OffsetValid.
@ k_fs_time_hour_max
Highest hour.
@ k_fs_time_minute_max
Highest minute.
@ k_fs_centi_per_second
Hundredths in one second.
@ k_fs_utc_step_min
exFAT UtcOffset granularity, minutes.
@ k_fs_date_shift_year
FAT date: year field position.
@ k_fs_xf_shift_year
exFAT date half: year field position.
@ k_fs_utc_field_mask
exFAT UtcOffset bits 6:0 = the offset.
@ k_fs_time_second_div
FAT/exFAT store seconds/2.
@ k_fs_time_epoch_year
Year 0 of both on-disk formats.
@ k_fs_xf_shift_month
exFAT date half: month field position.
@ k_fs_time_day_max
Highest day the field can express.
@ k_fs_time_day_min
Day is 1-based on disk.
@ k_fs_utc_unknown
OffsetValid clear: zone not recorded.
@ k_fs_xf_shift_date
exFAT stamp: date half position.
@ k_fs_time_centi_max
Highest hundredth within a second.
@ k_fs_time_month_max
Highest month.
@ k_fs_date_shift_month
FAT date: month field position.
One reading already packed into exFAT's 32-bit stamp plus its extras.
uint8_t utc
UtcOffset byte, or k_fs_utc_unknown.
uint32_t stamp
exFAT spec sec 7.4.8 packed timestamp.
uint8_t inc10
10 ms increment, 0..199.
One reading already packed into the two 16-bit FAT words plus tenths.
uint16_t time
MS FAT spec sec 6 packed time word.
uint8_t tenth
DIR_CrtTimeTenth: 0..199 in 10 ms.
uint16_t date
MS FAT spec sec 6 packed date word.
Caller-supplied calendar source used to stamp files.
ra8_err_t(* now)(void *ctx, ra8_fs_datetime_t *out)
Report the current civil time.
Broken-down civil date and time used at the filesystem boundary.
uint8_t hour
Hour of day, 0..23.
uint8_t minute
Minute of hour, 0..59.
int16_t utc_offset_min
Offset of the civil fields from UTC, in minutes.
uint8_t second
Second of minute, 0..59.
uint8_t month
Month of year, 1..12.
uint8_t centisecond
Hundredths within second, 0..99.
uint16_t year
Full civil year, e.g.
uint8_t day
Day of month, 1..31.