diff options
Diffstat (limited to 'src/kernel/fat.c')
-rw-r--r-- | src/kernel/fat.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/kernel/fat.c b/src/kernel/fat.c new file mode 100644 index 0000000..00fa61f --- /dev/null +++ b/src/kernel/fat.c @@ -0,0 +1,21 @@ +#include "fat.h" +#include "ata.h" +#include "panic.h" + +void load_fat() { + read_sectors(FAT_INFO->reserved_sectors, FAT_INFO->sectors_per_fat, FAT); +} + +uint16_t get_cluster(uint16_t n) { + uint32_t t = *(uint32_t *)(FAT + (n / 2) * 3); + return (n % 2 ? (t >> 12) : t) & 0xfff; +} + +void set_cluster(uint16_t n, uint16_t v) { + uint32_t *t = (uint32_t *)(FAT + (n / 2) * 3); + *t = (*t & (n % 2 ? 0xff000fff : 0xfffff000)) | (n % 2 ? v << 12 : v); +} + +uint16_t get_start_cluster(uint8_t *path) { + panic("Not implemented (get_start_cluster)."); +}
\ No newline at end of file |