summaryrefslogtreecommitdiff
path: root/src/kernel/diskio.h
diff options
context:
space:
mode:
authorBenji Dial <benji3.141@gmail.com>2020-01-05 22:26:40 -0500
committerBenji Dial <benji3.141@gmail.com>2020-01-05 22:26:40 -0500
commit243e28075e223bd9be145251161b692873918764 (patch)
treeb8b2314ae2e7303149780b7bfb25a7e61c6ebcfa /src/kernel/diskio.h
parent3ec928b8ca8cbf51310bce62afafe0874e920c24 (diff)
downloadportland-os-243e28075e223bd9be145251161b692873918764.tar.gz
function to return pointers to functions to read from a constant interface, so we only have to check the interface once per macro operation
Diffstat (limited to 'src/kernel/diskio.h')
-rw-r--r--src/kernel/diskio.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/kernel/diskio.h b/src/kernel/diskio.h
index 2f83864..0e16423 100644
--- a/src/kernel/diskio.h
+++ b/src/kernel/diskio.h
@@ -29,6 +29,11 @@ enum interface {
ATA
};
+#define N_INTERFACES 3
+
+typedef uint32_t (*const read_sectors_t)(uint8_t, uint32_t, uint32_t, void *);
+typedef uint32_t (*const write_sectors_t)(uint8_t, uint32_t, uint32_t, void *);
+
enum drive_flags {
SPUN = 0x01,
DISK_IN = 0x02,
@@ -45,8 +50,8 @@ struct drive_info {
struct drive_info drives[26];
-uint32_t read_sectors(uint8_t drive, uint32_t start, uint32_t count, void *buffer);
-uint32_t write_sectors(uint8_t drive, uint32_t start, uint32_t count, void *buffer);
+read_sectors_t get_read_sectors_function(uint8_t drive);
+write_sectors_t get_write_sectors_function(uint8_t drive);
void update_status(uint8_t drive);
#endif \ No newline at end of file