Files
RockOS/kernel/drivers/atapi/ata.h
2026-06-19 00:27:08 -05:00

60 lines
1.7 KiB
C

#ifndef KATA_H
#define KATA_H
#include <stdint.h>
#define IDE_PRIMARY_IO_BASE 0x1F0
#define IDE_PRIMARY_CRTL_BASE 0x3F6
#define IDE_SECONDARY_IO_BASE 0x170
#define IDE_SECONDARY_CRTL_BASE 0x376
#define IO_DATA_REG 0x00
#define IO_ERROR_REG 0x01
#define IO_FEATURE_REG 0x01
#define IO_SECTOR_COUNT_REG 0x02
#define IO_SECTOR_NUM_REG 0x03
#define IO_LBA_LO_REG 0x03
#define IO_CYL_LO_REG 0x04
#define IO_LBA_MID_REG 0x04
#define IO_LBA_HI_REG 0x05
#define IO_CYL_HI_REG 0x05
#define IO_DRIVE_SELECT_REG 0x06
#define IO_STATUS_REG 0x07
#define IO_CMD_REG 0x07
#define CTRL_ALT_STATUS_REG 0x00
#define CTRL_DEV_CTRL_REG 0x00
#define CTRL_DRIVE_ADDR_REG 0x01
#define ERROR_REG_AMNF 0b00000001 // Address mark not found
#define ERROR_REG_TKZNF 0b00000010 // Track zero not found
#define ERROR_REG_ABRT 0b00000100 // Aborted command
#define ERROR_REG_MCR 0b00001000 // Media change request
#define ERROR_REG_IDNF 0b00010000 // ID not found
#define ERROR_REG_MC 0b00100000 // Media changed
#define ERROR_REG_UNC 0b01000000 // Uncorrectable data error
#define ERROR_REG_BBK 0b10000000 // Bad Block detected
#define DRIVE_SELECT_REG_BN 0b00000111
#define DRIVE_SELECT_REG_DRV 0b00010000
#define DRIVE_SELECT_REG_LBAA 0b01000000
#define STATUS_REG_ERR 0b00000001
#define STATUS_REG_IDX 0b00000010
#define STATUS_REG_CORR 0b00000100
#define STATUS_REG_DRQ 0b00001000
#define STATUS_REG_SRV 0b00010000
#define STATUS_REG_DF 0b00100000
#define STATUS_REG_RDY 0b01000000
#define STATUS_REG_BSY 0b10000000
#define DEV_CTRL_REG_nIEN 0b00000001
#define DEV_CTRL_REG_SRST 0b00000010
#define DEV_CTRL_REG_HOB 0b10000000
#define DRIVE_ADDR_REG_DS0 0b00000001
#define DRIVE_ADDR_REG_DS1 0b00000010
#define DRIVE_ADDR_REG 0b00111100
#endif