summaryrefslogtreecommitdiff
path: root/src/kernel/fat.h
diff options
context:
space:
mode:
authorBenji Dial <Benji3.141@gmail.com>2020-08-11 11:33:21 -0400
committerBenji Dial <Benji3.141@gmail.com>2020-08-11 11:33:21 -0400
commit63167f223e1f54910f6b80e698390ee60aec79ee (patch)
tree41844f646bdcb5c9ba241bb5867c5e4f51737d52 /src/kernel/fat.h
parent77d7a284c02bc6b1b3a3a92ad5d957172cee9b81 (diff)
downloadportland-os-63167f223e1f54910f6b80e698390ee60aec79ee.tar.gz
lots of progress
currently, BAR fields of IDE drives are all returning zero, and the ATA read function isn't working. i'm not sure why. i'm going to work on VESA next, and come back to the IDE driver later
Diffstat (limited to 'src/kernel/fat.h')
-rw-r--r--src/kernel/fat.h63
1 files changed, 7 insertions, 56 deletions
diff --git a/src/kernel/fat.h b/src/kernel/fat.h
index 73eaaae..d9db906 100644
--- a/src/kernel/fat.h
+++ b/src/kernel/fat.h
@@ -1,61 +1,12 @@
+#ifndef FAT_H
+#define FAT_H
+
#include <stdint.h>
#include <stdbool.h>
+#include "drive.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));
-
-enum {
- FA_READ_ONLY = 0x01,
- FA_HIDDEN = 0x02,
- FA_SYSTEM = 0x04,
- FA_LABEL = 0x08,
- FA_DIRECTORY = 0x10,
- FA_ARCHIVE = 0x20,
-
- FA_LFN = 0x0f
-};
-
-struct directory_entry {
- uint8_t name[11];
- uint8_t attrib;
- uint8_t name_case;
- uint8_t created_decimal;
- uint16_t created_time;
- uint16_t created_date;
- uint16_t accessed_date;
- uint16_t ignore;
- uint16_t modified_time;
- uint16_t modified_date;
- uint16_t first_cluster;
- uint32_t length;
-} __attribute__ ((packed));
-
-#define FAT ((uint16_t *)0x00020000)
-void load_fat();
+void init_fat();
-#define CTOS(c) (FAT_INFO->reserved_sectors + FAT_INFO->sectors_per_fat + (FAT_INFO->root_entries >> 4) + (c) - 2)
+bool try_fat_init_drive(struct drive *d);
-bool get_entry(uint8_t *path, struct directory_entry *at);
-bool update_entry(uint8_t *path, struct directory_entry *value);
-bool create_entry(uint8_t *path, struct directory_entry *value); \ No newline at end of file
+#endif \ No newline at end of file