openMSX
|
#include <AbstractIDEDevice.hh>
Public Member Functions | |
void | reset (EmuTime::param time) override |
word | readData (EmuTime::param time) override |
byte | readReg (nibble reg, EmuTime::param time) override |
void | writeData (word value, EmuTime::param time) override |
void | writeReg (nibble reg, byte value, EmuTime::param time) override |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned version) |
Public Member Functions inherited from openmsx::IDEDevice | |
virtual | ~IDEDevice ()=default |
Protected Member Functions | |
AbstractIDEDevice (MSXMotherBoard &motherBoard) | |
~AbstractIDEDevice () override=default | |
virtual bool | isPacketDevice ()=0 |
Is this device a packet (ATAPI) device? | |
virtual std::string_view | getDeviceName ()=0 |
Gets the device name to insert as "model number" into the identify block. | |
virtual void | fillIdentifyBlock (AlignedBuffer &buffer)=0 |
Tells a subclass to fill the device specific parts of the identify block located in the buffer. | |
virtual unsigned | readBlockStart (AlignedBuffer &buffer, unsigned count)=0 |
Called when a block of read data should be buffered by the controller: when the buffer is empty or at the start of the transfer. | |
virtual void | readEnd () |
Called when a read transfer completes. | |
virtual void | writeBlockComplete (AlignedBuffer &buffer, unsigned count)=0 |
Called when a block of written data has been buffered by the controller: when the buffer is full or at the end of the transfer. | |
virtual void | executeCommand (byte cmd) |
Starts execution of an IDE command. | |
void | setError (byte error) |
Indicates an error: sets error register, error flag, aborts transfers. | |
unsigned | getSectorNumber () const |
Creates an LBA sector address from the contents of the sectorNumReg, cylinderLowReg, cylinderHighReg and devHeadReg registers. | |
unsigned | getNumSectors () const |
Gets the number of sectors indicated by the sector count register. | |
void | setInterruptReason (byte value) |
Writes the interrupt reason register. | |
unsigned | getByteCount () const |
Reads the byte count limit of a packet transfer in the registers. | |
void | setByteCount (unsigned count) |
Writes the byte count of a packet transfer in the registers. | |
void | setSectorNumber (unsigned lba) |
Writes a 28-bit LBA sector number in the registers. | |
void | startLongReadTransfer (unsigned count) |
Indicates the start of a read data transfer which uses blocks. | |
AlignedBuffer & | startShortReadTransfer (unsigned count) |
Indicates the start of a read data transfer where all data fits into the buffer at once. | |
void | abortReadTransfer (byte error) |
Aborts the read transfer in progress. | |
void | startWriteTransfer (unsigned count) |
Indicates the start of a write data transfer. | |
void | abortWriteTransfer (byte error) |
Aborts the write transfer in progress. | |
byte | getFeatureReg () const |
void | setLBALow (byte value) |
void | setLBAMid (byte value) |
void | setLBAHigh (byte value) |
MSXMotherBoard & | getMotherBoard () const |
Static Protected Attributes | |
static constexpr byte | DRDY = 0x40 |
static constexpr byte | DSC = 0x10 |
static constexpr byte | DRQ = 0x08 |
static constexpr byte | ERR = 0x01 |
static constexpr byte | UNC = 0x40 |
static constexpr byte | IDNF = 0x10 |
static constexpr byte | ABORT = 0x04 |
Definition at line 13 of file AbstractIDEDevice.hh.
|
explicitprotected |
Definition at line 14 of file AbstractIDEDevice.cc.
References ranges::fill().
|
overrideprotecteddefault |
|
protected |
Aborts the read transfer in progress.
Definition at line 362 of file AbstractIDEDevice.cc.
References ABORT, and setError().
Referenced by openmsx::IDECDROM::readBlockStart().
|
protected |
Aborts the write transfer in progress.
Definition at line 376 of file AbstractIDEDevice.cc.
References ABORT, and setError().
|
protectedvirtual |
Starts execution of an IDE command.
Override this to implement additional commands and make sure you call the superclass implementation for all commands that you don't handle.
Reimplemented in openmsx::IDECDROM.
Definition at line 277 of file AbstractIDEDevice.cc.
References ABORT, DRDY, DSC, getFeatureReg(), isPacketDevice(), setError(), and startShortReadTransfer().
Referenced by openmsx::IDECDROM::executeCommand(), and writeReg().
|
protectedpure virtual |
Tells a subclass to fill the device specific parts of the identify block located in the buffer.
The generic part is already written there.
buffer | Array of 512 bytes. |
Implemented in openmsx::IDECDROM.
|
protected |
Reads the byte count limit of a packet transfer in the registers.
The cylinder low/high registers are used for this.
Definition at line 254 of file AbstractIDEDevice.cc.
Referenced by openmsx::IDECDROM::executeCommand().
|
protectedpure virtual |
Gets the device name to insert as "model number" into the identify block.
Implemented in openmsx::IDECDROM.
|
inlineprotected |
Definition at line 154 of file AbstractIDEDevice.hh.
Referenced by executeCommand(), and openmsx::IDECDROM::executeCommand().
|
inlineprotected |
Definition at line 159 of file AbstractIDEDevice.hh.
Referenced by openmsx::IDECDROM::eject(), openmsx::IDECDROM::IDECDROM(), openmsx::IDECDROM::insert(), and openmsx::IDECDROM::~IDECDROM().
|
protected |
Gets the number of sectors indicated by the sector count register.
Definition at line 244 of file AbstractIDEDevice.cc.
|
protected |
Creates an LBA sector address from the contents of the sectorNumReg, cylinderLowReg, cylinderHighReg and devHeadReg registers.
Definition at line 238 of file AbstractIDEDevice.cc.
|
protectedpure virtual |
Is this device a packet (ATAPI) device?
Implemented in openmsx::IDECDROM.
Referenced by executeCommand().
|
protectedpure virtual |
Called when a block of read data should be buffered by the controller: when the buffer is empty or at the start of the transfer.
buffer | Pointer to the start of a byte array. |
count | Number of bytes to be filled by this method. This number will not exceed the array size nor the transfer length. |
Implemented in openmsx::IDECDROM.
|
overridevirtual |
Implements openmsx::IDEDevice.
Definition at line 157 of file AbstractIDEDevice.cc.
References readEnd().
|
protectedvirtual |
Called when a read transfer completes.
The default implementation does nothing.
Reimplemented in openmsx::IDECDROM.
Definition at line 273 of file AbstractIDEDevice.cc.
Referenced by readData().
Implements openmsx::IDEDevice.
Definition at line 61 of file AbstractIDEDevice.cc.
References UNREACHABLE.
|
overridevirtual |
Implements openmsx::IDEDevice.
Definition at line 51 of file AbstractIDEDevice.cc.
void openmsx::AbstractIDEDevice::serialize | ( | Archive & | ar, |
unsigned | version | ||
) |
Definition at line 439 of file AbstractIDEDevice.cc.
|
protected |
Writes the byte count of a packet transfer in the registers.
The cylinder low/high registers are used for this.
Definition at line 259 of file AbstractIDEDevice.cc.
|
protected |
Indicates an error: sets error register, error flag, aborts transfers.
error | Value to be written to the error register. |
Definition at line 225 of file AbstractIDEDevice.cc.
References ERR.
Referenced by abortReadTransfer(), abortWriteTransfer(), executeCommand(), and openmsx::IDECDROM::executeCommand().
|
protected |
Writes the interrupt reason register.
This is the same as register as sector count, but serves a different purpose.
Definition at line 249 of file AbstractIDEDevice.cc.
Referenced by openmsx::IDECDROM::executeCommand(), and openmsx::IDECDROM::readEnd().
|
inlineprotected |
Definition at line 157 of file AbstractIDEDevice.hh.
Referenced by openmsx::IDECDROM::executeCommand().
|
inlineprotected |
Definition at line 155 of file AbstractIDEDevice.hh.
|
inlineprotected |
Definition at line 156 of file AbstractIDEDevice.hh.
Referenced by openmsx::IDECDROM::executeCommand().
|
protected |
Writes a 28-bit LBA sector number in the registers.
The cylinder low/high registers are used for this.
Definition at line 265 of file AbstractIDEDevice.cc.
|
protected |
Indicates the start of a read data transfer which uses blocks.
The readBlockStart() method is called at the start of each block. The first block will be read immediately, so make sure you initialise all variables needed by readBlockStart() before calling this method.
count | Total number of bytes to transfer. |
Definition at line 348 of file AbstractIDEDevice.cc.
|
protected |
Indicates the start of a read data transfer where all data fits into the buffer at once.
count | Total number of bytes to transfer. |
Definition at line 335 of file AbstractIDEDevice.cc.
References openmsx::AlignedByteArray< N >::data(), and ranges::fill().
Referenced by executeCommand().
|
protected |
Indicates the start of a write data transfer.
count | Total number of bytes to transfer. |
Definition at line 368 of file AbstractIDEDevice.cc.
References DRQ.
Referenced by openmsx::IDECDROM::executeCommand().
|
protectedpure virtual |
Called when a block of written data has been buffered by the controller: when the buffer is full or at the end of the transfer.
buffer | Pointer to the start of a byte array. |
count | Number of data bytes in the array. |
Implemented in openmsx::IDECDROM.
Referenced by writeData().
|
overridevirtual |
Implements openmsx::IDEDevice.
Definition at line 191 of file AbstractIDEDevice.cc.
References writeBlockComplete().
|
overridevirtual |
Implements openmsx::IDEDevice.
Definition at line 103 of file AbstractIDEDevice.cc.
References DRQ, ERR, executeCommand(), and UNREACHABLE.
|
staticconstexprprotected |
Definition at line 37 of file AbstractIDEDevice.hh.
Referenced by abortReadTransfer(), abortWriteTransfer(), and executeCommand().
|
staticconstexprprotected |
Definition at line 29 of file AbstractIDEDevice.hh.
Referenced by executeCommand(), and reset().
|
staticconstexprprotected |
Definition at line 31 of file AbstractIDEDevice.hh.
Referenced by startWriteTransfer(), and writeReg().
|
staticconstexprprotected |
Definition at line 30 of file AbstractIDEDevice.hh.
Referenced by executeCommand(), and reset().
|
staticconstexprprotected |
Definition at line 32 of file AbstractIDEDevice.hh.
Referenced by setError(), and writeReg().
|
staticconstexprprotected |
Definition at line 36 of file AbstractIDEDevice.hh.
|
staticconstexprprotected |
Definition at line 35 of file AbstractIDEDevice.hh.