summaryrefslogtreecommitdiff
path: root/src/kernel/fat.h
blob: 0fbf59f1adc4d8def9b0e37742b60c2a874552fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdint.h>

#define FAT_INFO ((struct fat_info *)0x7c03)

struct fat_info {
  uint8_t  oem[8];
  uint16_t bytes_per_sector;//Assumed to be 512
  uint8_t  sectors_per_cluster;//Assumed to be 1
  uint16_t reserved_sectors;
  uint8_t  fats;//Assumed to be 1
  uint16_t root_entries;
  uint16_t sectors;//Assumed not to be 0
  uint8_t  media_type;
  uint16_t sectors_per_fat;
  uint16_t sectors_per_track;
  uint16_t heads;
  uint32_t hidden_sectors;
  uint32_t sectors_long;
  uint8_t  drive_number;
  uint8_t  reserved;
  uint8_t  ext_boot_marker;
  uint32_t volume_id;
  uint8_t  label[11];
  uint8_t  fs_type[8];
} __attribute__ ((packed));

#define FAT ((void *)0x00026000)
void load_fat();
uint16_t get_cluster(uint16_t n);
void set_cluster(uint16_t n, uint16_t v);

uint16_t get_start_cluster(uint8_t *path);