diff options
author | Benji Dial <benji3.141@gmail.com> | 2020-05-24 21:55:12 -0400 |
---|---|---|
committer | Benji Dial <benji3.141@gmail.com> | 2020-05-24 21:55:12 -0400 |
commit | 021ea9b271f2144f7b16ae41a9236292dea7897d (patch) | |
tree | 77bae3af854f9ff1fb0298ae1f71b1395a392cc1 /src/kernel/fat.h | |
parent | 02f14113cbf14c6f842fb43ecbc68d0c851ef3b0 (diff) | |
download | portland-os-021ea9b271f2144f7b16ae41a9236292dea7897d.tar.gz |
basic fs type stuff, fat16, removing stack segment and using data segment
Diffstat (limited to 'src/kernel/fat.h')
-rw-r--r-- | src/kernel/fat.h | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/src/kernel/fat.h b/src/kernel/fat.h index 0fbf59f..73eaaae 100644 --- a/src/kernel/fat.h +++ b/src/kernel/fat.h @@ -1,4 +1,5 @@ #include <stdint.h> +#include <stdbool.h> #define FAT_INFO ((struct fat_info *)0x7c03) @@ -24,9 +25,37 @@ struct fat_info { uint8_t fs_type[8]; } __attribute__ ((packed)); -#define FAT ((void *)0x00026000) +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(); -uint16_t get_cluster(uint16_t n); -void set_cluster(uint16_t n, uint16_t v); -uint16_t get_start_cluster(uint8_t *path);
\ No newline at end of file +#define CTOS(c) (FAT_INFO->reserved_sectors + FAT_INFO->sectors_per_fat + (FAT_INFO->root_entries >> 4) + (c) - 2) + +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 |