Fat32 implementation basics
This commit is contained in:
parent
ce607a0452
commit
8e30051824
@ -6,4 +6,6 @@ set(CMAKE_C_STANDARD 11)
|
|||||||
add_library(embpart embpart.c
|
add_library(embpart embpart.c
|
||||||
mbr/mbr.c
|
mbr/mbr.c
|
||||||
mbr/mbr.h
|
mbr/mbr.h
|
||||||
../test/main.c)
|
../test/main.c
|
||||||
|
fs/fat32/fat32.c
|
||||||
|
fs/fat32/fat32.h)
|
5
fs/fat32/fat32.c
Normal file
5
fs/fat32/fat32.c
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
//
|
||||||
|
// Created by epagris on 2023.09.28..
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "fat32.h"
|
36
fs/fat32/fat32.h
Normal file
36
fs/fat32/fat32.h
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#ifndef EMBPART_FAT32_H
|
||||||
|
#define EMBPART_FAT32_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint8_t boot_jump[3]; // jump instruction used for bootable volume
|
||||||
|
uint8_t formatter_name[8]; // identification of application or OS formatted this device
|
||||||
|
uint16_t bytes_per_sector; // number of bytes per sector
|
||||||
|
uint8_t sectors_per_cluster; // number of sectors per cluster
|
||||||
|
uint16_t n_reserved_sectors; // number of reserved sectors
|
||||||
|
uint8_t n_fats; // number of FAT copies
|
||||||
|
uint8_t _unused0[2];
|
||||||
|
uint8_t _unused1[2];
|
||||||
|
uint8_t media_descriptor; // media descriptor differentiating between removable and non-removable devices
|
||||||
|
uint8_t _unused2[2];
|
||||||
|
uint16_t sectors_per_track; // number of sectors per track
|
||||||
|
uint16_t n_heads; // number of heads
|
||||||
|
uint32_t n_hidden_sectors; // number of hidden sectors preceding this volume
|
||||||
|
uint32_t n_total_sectors; // total number of sectors in this volume
|
||||||
|
uint32_t n_sectors_per_fat; // number of sectors per FAT
|
||||||
|
uint16_t flags; // flags, see docs.
|
||||||
|
uint16_t version; // FAT version number
|
||||||
|
uint32_t root_first_cluster; // first cluster of the root directory
|
||||||
|
uint16_t fsinfo_sector; // sector of the FSINFO structure
|
||||||
|
uint16_t boot_backup_sector; // sector of backup boot code in the reserved region
|
||||||
|
uint8_t _reserved0[12];
|
||||||
|
uint8_t logical_driver_number; // logical drive number of the partition
|
||||||
|
uint8_t _reserved1;
|
||||||
|
uint8_t extended_boot_signature; // extended boot signature
|
||||||
|
uint32_t volume_serial_number; // volume serial number
|
||||||
|
uint8_t volume_label[11]; // volume label string
|
||||||
|
uint8_t fs_type[8]; // file system type ("FAT32")
|
||||||
|
} __attribute__((packed)) Bpb_Fat32;
|
||||||
|
|
||||||
|
#endif //EMBPART_FAT32_H
|
Loading…
x
Reference in New Issue
Block a user