29typedef enum : uint8_t {
79typedef enum : uint16_t {
114typedef enum : uint32_t {
178 bool past_end = (label ==
nullptr);
180 if (!past_end && (label[i] ==
'\0')) {
183 dst[i] = past_end ? (uint8_t)
' ' : (uint8_t)label[i];
217 const uint32_t tmp1 = total_sectors - ((uint32_t)
k_fmt_resv_f16 + root_sectors);
220 *fatsz = (tmp1 + tmp2 - 1U) / tmp2;
221 const uint32_t data = total_sectors - (uint32_t)
k_fmt_resv_f16 - (2U * *fatsz) - root_sectors;
222 const uint32_t clus = data / spc;
255 uint32_t total_sectors,
307 uint32_t total_sectors,
364 uint32_t clusters = 0U;
370 fatsz = (tmp1 + tmp2 - 1U) / tmp2;
371 const uint32_t data = total_sectors - (uint32_t)
k_fmt_resv_f32 - (2U * fatsz);
372 clusters = data / spc;
386 *out_clusters = clusters;
407 uint32_t total_sectors,
436 uint32_t total_sectors,
441 uint32_t clusters = 0U;
Module-private FAT formatter shared by the board_periph_sd TUs.
@ k_fmt_fat32_pref
FAT32: preferred max clusters (bumps spc).
@ k_fmt_totsec16_max
Above this, use the 32-bit TotSec.
@ k_fmt_root_ents
FAT16 root-directory entries.
@ k_fmt_volid
Arbitrary volume serial base.
@ k_fmt_fat16_max
Max FAT16 data clusters.
@ k_fmt_sec_bytes
Bytes per sector.
Bounded raw-descriptor I/O seam for the RA8 emulator.
@ k_emu_io_ok
The complete operation succeeded.
emu_io_result_t priv_emu_io_pwrite_exact(int fd, const void *buf, size_t count, off_t offset)
Write exactly count bytes at offset without changing the cursor.
@ k_bpb_jmp2
BS_jmpBoot[2]: NOP.
@ k_bpb_jmp0
BS_jmpBoot[0]: short jump opcode.
@ k_bpb_jmp1
BS_jmpBoot[1]: jump displacement.
@ k_bpb_fatsz16
Sectors per FAT.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
void * memcpy(void *dst, const void *src, size_t n)
Copy memory area between non-overlapping regions.
@ k_bpb_sig_hi
Bpb sig hi.
@ k_bpb_sig_lo
Bpb sig lo.
@ k_fmt_label_len
Volume-label field width (bytes).
@ k_fmt_resv_f16
FAT12/16 reserved (boot) sectors.
@ k_fmt_spc_max
Largest sectors-per-cluster we set.
@ k_fmt_resv_f32
FAT32 reserved sectors.
Complete, caller-visible result of a raw host-I/O operation.
emu_io_status_t status
Semantic completion status.