more ata stuff
This commit is contained in:
@@ -1,27 +1,32 @@
|
||||
#ifndef KATA_H
|
||||
#define KATA_H
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#define IDE_PRIMARY_IO_BASE 0x1F0
|
||||
#define IDE_PRIMARY_CRTL_BASE 0x3F6
|
||||
#define IDE_PRIMARY_IO_BASE 0x01F0
|
||||
#define IDE_PRIMARY_CRTL_BASE 0x03F6
|
||||
|
||||
#define IDE_SECONDARY_IO_BASE 0x170
|
||||
#define IDE_SECONDARY_CRTL_BASE 0x376
|
||||
#define IDE_SECONDARY_IO_BASE 0x0170
|
||||
#define IDE_SECONDARY_CRTL_BASE 0x0376
|
||||
|
||||
#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 IDE_DRIVE_MASTER 0xA0
|
||||
#define IDE_DRIVE_SLAVE 0xB0
|
||||
|
||||
#define IO_DATA_REG 0x0000
|
||||
#define IO_ERROR_REG 0x0001
|
||||
#define IO_FEATURE_REG 0x0001
|
||||
#define IO_SECTOR_COUNT_REG 0x0002
|
||||
#define IO_SECTOR_NUM_REG 0x0003
|
||||
#define IO_LBA_LO_REG 0x0003
|
||||
#define IO_CYL_LO_REG 0x0004
|
||||
#define IO_LBA_MID_REG 0x0004
|
||||
#define IO_LBA_HI_REG 0x0005
|
||||
#define IO_CYL_HI_REG 0x0005
|
||||
#define IO_DRIVE_SELECT_REG 0x0006
|
||||
#define IO_STATUS_REG 0x0007
|
||||
#define IO_CMD_REG 0x0007
|
||||
|
||||
#define CTRL_ALT_STATUS_REG 0x00
|
||||
#define CTRL_DEV_CTRL_REG 0x00
|
||||
@@ -53,8 +58,36 @@
|
||||
#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
|
||||
#define DRIVE_ADDR_REG_DS0 0b00000001
|
||||
#define DRIVE_ADDR_REG_DS1 0b00000010
|
||||
#define DRIVE_ADDR_REG_HEAD 0b00111100
|
||||
#define DRIVE_ADDR_REG_WTG 0b01000000
|
||||
|
||||
#define ATAPI_CMD_IDENTIFY_PACKET 0xA1
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
uint8_t ident_device(uint16_t bus, uint8_t drive_select, uint8_t* buffer);
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint16_t bus;
|
||||
uint8_t device;
|
||||
uint8_t type;
|
||||
void* ident_info_struct;
|
||||
} ide_device_t;
|
||||
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint16_t gen_config;
|
||||
uint16_t reserved_1[9];
|
||||
char serial_number[20];
|
||||
uint16_t vendor_1[3];
|
||||
char firmware_v[8];
|
||||
char model_num[40];
|
||||
uint16_t vendor_2[2];
|
||||
uint16_t capabilities;
|
||||
uint16_t reserved_2;
|
||||
uint16_t pio_dma_timing;
|
||||
} atapi_identify_data_t;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user