mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-23 21:29:28 +00:00
Add ATAPI commands, clean up formatting.
This commit is contained in:
parent
0f8e68d4bf
commit
e36150a5ca
@ -44,27 +44,41 @@ enum {
|
||||
|
||||
/** ATA register offsets. */
|
||||
enum ATA_Reg : int {
|
||||
DATA = 0x0,
|
||||
ERROR = 0x1, // error (read)
|
||||
FEATURES = 0x1, // features (write)
|
||||
SEC_COUNT = 0x2, // sector count
|
||||
SEC_NUM = 0x3, // sector number
|
||||
CYL_LOW = 0x4, // cylinder low
|
||||
CYL_HIGH = 0x5, // cylinder high
|
||||
DEVICE_HEAD = 0x6, // device/head
|
||||
STATUS = 0x7, // status (read)
|
||||
COMMAND = 0x7, // command (write)
|
||||
ALT_STATUS = 0x16, // alt status (read)
|
||||
DEV_CTRL = 0x16, // device control (write)
|
||||
TIME_CONFIG = 0x20 // Apple ASIC specific timing configuration
|
||||
DATA = 0x00, // 16-bit data (read & write)
|
||||
ERROR = 0x01, // error (read)
|
||||
FEATURES = 0x01, // features (write)
|
||||
SEC_COUNT = 0x02, // sector count
|
||||
SEC_NUM = 0x03, // sector number
|
||||
CYL_LOW = 0x04, // cylinder low
|
||||
CYL_HIGH = 0x05, // cylinder high
|
||||
DEVICE_HEAD = 0x06, // device/head
|
||||
STATUS = 0x07, // status (read)
|
||||
COMMAND = 0x07, // command (write)
|
||||
ALT_STATUS = 0x16, // alt status (read)
|
||||
DEV_CTRL = 0x16, // device control (write)
|
||||
TIME_CONFIG = 0x20 // Apple ASIC specific timing configuration
|
||||
};
|
||||
|
||||
/** ATAPI specific register offsets. */
|
||||
enum ATAPI_Reg : int {
|
||||
INT_REASON = 0x2, // interrupt reason (read-only)
|
||||
BYTE_COUNT_LO = 0x4, // byte count (bits 0-7)
|
||||
BYTE_COUNT_HI = 0x5, // byte count (bits 8-15)
|
||||
};
|
||||
|
||||
/** ATAPI Interrupt Reason bits. */
|
||||
enum ATAPI_Int_Reason : uint8_t {
|
||||
CoD = 1 << 0,
|
||||
IO = 1 << 1,
|
||||
RELEASE = 1 << 2,
|
||||
};
|
||||
|
||||
/** Status register bits. */
|
||||
enum ATA_Status : int {
|
||||
ERR = 0x1,
|
||||
IDX = 0x2,
|
||||
CORR = 0x4,
|
||||
DRQ = 0x8,
|
||||
enum ATA_Status : uint8_t {
|
||||
ERR = 0x01,
|
||||
IDX = 0x02,
|
||||
CORR = 0x04,
|
||||
DRQ = 0x08,
|
||||
DSC = 0x10,
|
||||
DWF = 0x20,
|
||||
DRDY = 0x40,
|
||||
@ -72,28 +86,28 @@ enum ATA_Status : int {
|
||||
};
|
||||
|
||||
/** Error register bits. */
|
||||
enum ATA_Error : int {
|
||||
ANMF = 0x1, //no address mark
|
||||
TK0NF = 0x2, //track 0 not found
|
||||
ABRT = 0x4, //abort command
|
||||
MCR = 0x8,
|
||||
enum ATA_Error : uint8_t {
|
||||
ANMF = 0x01, //no address mark
|
||||
TK0NF = 0x02, //track 0 not found
|
||||
ABRT = 0x04, //abort command
|
||||
MCR = 0x08,
|
||||
IDNF = 0x10, //id mark not found
|
||||
MC = 0x20, //media change request
|
||||
UNC = 0x40,
|
||||
BBK = 0x80 //bad block
|
||||
BBK = 0x80, //bad block
|
||||
};
|
||||
|
||||
/** Bit definition for the device control register. */
|
||||
enum ATA_CTRL : int{
|
||||
IEN = 0x2,
|
||||
SRST = 0x4,
|
||||
enum ATA_CTRL : uint8_t {
|
||||
IEN = 0x02,
|
||||
SRST = 0x04,
|
||||
HOB = 0x80,
|
||||
};
|
||||
|
||||
/* ATA commands. */
|
||||
enum ATA_Cmd : int {
|
||||
enum ATA_Cmd : uint8_t {
|
||||
NOP = 0x00,
|
||||
RESET_ATAPI = 0x08,
|
||||
ATAPI_SOFT_RESET = 0x08,
|
||||
RECALIBRATE = 0x10,
|
||||
READ_SECTOR = 0x20,
|
||||
READ_SECTOR_NR = 0x21,
|
||||
@ -107,8 +121,9 @@ enum ATA_Cmd : int {
|
||||
IDE_SEEK = 0x70,
|
||||
DIAGNOSTICS = 0x90,
|
||||
INIT_DEV_PARAM = 0x91,
|
||||
PACKET = 0xA0,
|
||||
IDFY_PKT_DEV = 0xA1,
|
||||
ATAPI_PACKET = 0xA0,
|
||||
ATAPI_IDFY_DEV = 0xA1,
|
||||
ATAPI_SERVICE = 0xA2,
|
||||
READ_MULTIPLE = 0xC4,
|
||||
WRITE_MULTIPLE = 0xC5,
|
||||
READ_DMA = 0xC8,
|
||||
@ -116,6 +131,7 @@ enum ATA_Cmd : int {
|
||||
WRITE_BUFFER_DMA = 0xE9,
|
||||
READ_BUFFER_DMA = 0xEB,
|
||||
IDENTIFY_DEVICE = 0xEC,
|
||||
SET_FEATURES = 0xEF,
|
||||
};
|
||||
|
||||
}; // namespace ata_interface
|
||||
|
@ -55,9 +55,6 @@ int AtaHardDisk::perform_command()
|
||||
switch (this->r_command) {
|
||||
case NOP:
|
||||
break;
|
||||
case RESET_ATAPI:
|
||||
device_reset(true);
|
||||
break;
|
||||
case RECALIBRATE:
|
||||
hdd_img.seekg(0, std::ios::beg);
|
||||
this->r_error = 0;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-22 divingkatae and maximum
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
@ -84,21 +84,22 @@ enum ScsiMsg : int {
|
||||
MESSAGE_END,
|
||||
};
|
||||
|
||||
enum ScsiCommand : int {
|
||||
TEST_UNIT_READY = 0x0,
|
||||
REWIND = 0x1,
|
||||
REQ_SENSE = 0x3,
|
||||
FORMAT = 0x4,
|
||||
READ_BLK_LIMITS = 0x5,
|
||||
READ_6 = 0x8,
|
||||
WRITE_6 = 0xA,
|
||||
SEEK_6 = 0xB,
|
||||
enum ScsiCommand : uint8_t {
|
||||
TEST_UNIT_READY = 0x00,
|
||||
REWIND = 0x01,
|
||||
REQ_SENSE = 0x03,
|
||||
FORMAT = 0x04,
|
||||
READ_BLK_LIMITS = 0x05,
|
||||
READ_6 = 0x08,
|
||||
WRITE_6 = 0x0A,
|
||||
SEEK_6 = 0x0B,
|
||||
INQUIRY = 0x12,
|
||||
VERIFY_6 = 0x13,
|
||||
MODE_SELECT_6 = 0x15,
|
||||
RELEASE_UNIT = 0x17,
|
||||
ERASE_6 = 0x19,
|
||||
MODE_SENSE_6 = 0x1A,
|
||||
START_STOP_UNIT = 0x1B,
|
||||
DIAG_RESULTS = 0x1C,
|
||||
SEND_DIAGS = 0x1D,
|
||||
PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E,
|
||||
@ -107,6 +108,7 @@ enum ScsiCommand : int {
|
||||
WRITE_10 = 0x2A,
|
||||
VERIFY_10 = 0x2F,
|
||||
READ_LONG_10 = 0x35,
|
||||
READ_12 = 0xA8,
|
||||
|
||||
// CD-ROM specific commands
|
||||
READ_TOC = 0x43,
|
||||
|
Loading…
Reference in New Issue
Block a user