summaryrefslogtreecommitdiff
path: root/src/kernel/ata.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/ata.h')
-rw-r--r--src/kernel/ata.h77
1 files changed, 73 insertions, 4 deletions
diff --git a/src/kernel/ata.h b/src/kernel/ata.h
index 605f991..7c42cdb 100644
--- a/src/kernel/ata.h
+++ b/src/kernel/ata.h
@@ -1,6 +1,75 @@
-#include <stdint.h>
+enum {
+ ATA_STATUS_BUSY = 0x80,
+ ATA_STATUS_DRIVE_READY = 0x40,
+ ATA_STATUS_DRIVE_FAULT = 0x20,
+ ATA_STATUS_SEEK_DONE = 0x10,
+ ATA_STATUS_DATA_READY = 0x08,
+ ATA_STATUS_CORRECTED = 0x04,
+ ATA_STATUS_INDEX = 0x02,
+ ATA_STATUS_ERROR = 0x01
+};
-void init_ata();
+enum {
+ ATA_ERROR_BAD_BLOCK = 0x80,
+ ATA_ERROR_UNCORRECTABLE = 0x40,
+ ATA_ERROR_MEDIA_SWAPPED = 0x20,
+ ATA_ERROR_NO_ID_MARK = 0x10,
+ ATA_ERROR_MEDIA_SWAPPING = 0x08,
+ ATA_ERROR_ABORTED_CMD = 0x04,
+ ATA_ERROR_NO_TRACK_ZERO = 0x02,
+ ATA_ERROR_NO_ADDR_MARK = 0x01
+};
-uint8_t read_sectors(uint16_t start, uint8_t count, void *buffer);
-uint8_t write_sectors(uint16_t start, uint8_t count, void *buffer); \ No newline at end of file
+enum {
+ ATA_CMD_READ = 0x20,
+ ATA_CMD_WRITE = 0x30,
+ ATA_CMD_WRITE_EXT = 0x34,
+ ATA_CMD_READ_EXT = 0x40,
+ ATAPI_CMD = 0xa0,
+ ATAPI_CMD_ID = 0xa1,
+ ATA_CMD_FLUSH = 0xe7,
+ ATA_CMD_FLUSH_EXT = 0xea,
+ ATA_CMD_ID = 0xec,
+};
+
+enum {
+ ATAPI_CMD_EJECT = 0x1b,
+ ATAPI_CMD_READ = 0xa8
+};
+
+enum {
+ ATA_REG_DATA = 0x0,
+ ATA_REG_ERROR = 0x1,
+ ATA_REG_FEAT = 0x1,
+ ATA_REG_COUNT_LOW = 0x2,
+ ATA_REG_LBA0 = 0x3,
+ ATA_REG_LBA1 = 0x4,
+ ATA_REG_LBA2 = 0x5,
+ ATA_REG_SELECT = 0x6,
+ ATA_REG_CMD = 0x7,
+ ATA_REG_STATUS = 0x7,
+ ATA_REG_COUNT_HIGH = 0x8,
+ ATA_REG_LBA3 = 0x9,
+ ATA_REG_LBA4 = 0xa,
+ ATA_REG_LBA5 = 0xb,
+ ATA_REG_CONTROL = 0xc,
+ ATA_REG_ALT_STATUS = 0xc,
+ ATA_REG_ADDR = 0xd
+};
+
+enum {
+ ATA_MASTER_SELECT = 0xa0,
+ ATA_SLAVE_SELECT = 0xb0
+};
+
+enum {
+ ATA_SET_EXT = 0x04000000
+};
+
+enum {
+ ATA_CAP_LBA = 0x00000200
+};
+
+enum {
+ ATA_CONTROL_NO_IRQS = 0x02
+}; \ No newline at end of file