openMSX
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
openmsx::IDECDROM Class Referencefinal

#include <IDECDROM.hh>

Inheritance diagram for openmsx::IDECDROM:
Inheritance graph
[legend]
Collaboration diagram for openmsx::IDECDROM:
Collaboration graph
[legend]

Public Types

using CDInUse = std::bitset< MAX_CD >
 

Public Member Functions

 IDECDROM (const DeviceConfig &config)
 
 IDECDROM (const IDECDROM &)=delete
 
 IDECDROM (IDECDROM &&)=delete
 
IDECDROMoperator= (const IDECDROM &)=delete
 
IDECDROMoperator= (IDECDROM &&)=delete
 
 ~IDECDROM () override
 
void eject ()
 
void insert (const std::string &filename)
 
void getMediaInfo (TclObject &result) override
 This method gets called when information is required on the media inserted in the media slot of the provider.
 
template<typename Archive >
void serialize (Archive &ar, unsigned version)
 
- Public Member Functions inherited from openmsx::AbstractIDEDevice
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
 
- Public Member Functions inherited from openmsx::MediaInfoProvider
 MediaInfoProvider (const MediaInfoProvider &)=delete
 
 MediaInfoProvider (MediaInfoProvider &&)=delete
 
MediaInfoProvideroperator= (const MediaInfoProvider &)=delete
 
MediaInfoProvideroperator= (MediaInfoProvider &&)=delete
 

Static Public Member Functions

static std::shared_ptr< CDInUsegetDrivesInUse (MSXMotherBoard &motherBoard)
 

Static Public Attributes

static constexpr unsigned MAX_CD = 26
 

Protected Member Functions

bool isPacketDevice () override
 Is this device a packet (ATAPI) device?
 
std::string_view getDeviceName () override
 Gets the device name to insert as "model number" into the identify block.
 
void fillIdentifyBlock (AlignedBuffer &buffer) override
 Tells a subclass to fill the device specific parts of the identify block located in the buffer.
 
unsigned readBlockStart (AlignedBuffer &buffer, unsigned count) override
 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.
 
void readEnd () override
 Called when a read transfer completes.
 
void writeBlockComplete (AlignedBuffer &buffer, unsigned count) override
 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.
 
void executeCommand (byte cmd) override
 Starts execution of an IDE command.
 
- Protected Member Functions inherited from openmsx::AbstractIDEDevice
 AbstractIDEDevice (MSXMotherBoard &motherBoard)
 
 ~AbstractIDEDevice () override=default
 
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.
 
AlignedBufferstartShortReadTransfer (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)
 
MSXMotherBoardgetMotherBoard () const
 
- Protected Member Functions inherited from openmsx::MediaInfoProvider
 MediaInfoProvider ()=default
 
 ~MediaInfoProvider ()=default
 

Friends

class CDXCommand
 

Additional Inherited Members

- Static Protected Attributes inherited from openmsx::AbstractIDEDevice
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
 

Detailed Description

Definition at line 31 of file IDECDROM.hh.

Member Typedef Documentation

◆ CDInUse

using openmsx::IDECDROM::CDInUse = std::bitset<MAX_CD>

Definition at line 35 of file IDECDROM.hh.

Constructor & Destructor Documentation

◆ IDECDROM() [1/3]

openmsx::IDECDROM::IDECDROM ( const DeviceConfig config)
explicit

◆ IDECDROM() [2/3]

openmsx::IDECDROM::IDECDROM ( const IDECDROM )
delete

◆ IDECDROM() [3/3]

openmsx::IDECDROM::IDECDROM ( IDECDROM &&  )
delete

◆ ~IDECDROM()

openmsx::IDECDROM::~IDECDROM ( )
override

Member Function Documentation

◆ eject()

void openmsx::IDECDROM::eject ( )

◆ executeCommand()

void openmsx::IDECDROM::executeCommand ( byte  cmd)
overrideprotectedvirtual

◆ fillIdentifyBlock()

void openmsx::IDECDROM::fillIdentifyBlock ( AlignedBuffer buffer)
overrideprotectedvirtual

Tells a subclass to fill the device specific parts of the identify block located in the buffer.

The generic part is already written there.

Parameters
bufferArray of 512 bytes.

Implements openmsx::AbstractIDEDevice.

Definition at line 86 of file IDECDROM.cc.

◆ getDeviceName()

std::string_view openmsx::IDECDROM::getDeviceName ( )
overrideprotectedvirtual

Gets the device name to insert as "model number" into the identify block.

Returns
An ASCII string, up to 40 characters long.

Implements openmsx::AbstractIDEDevice.

Definition at line 81 of file IDECDROM.cc.

◆ getDrivesInUse()

std::shared_ptr< IDECDROM::CDInUse > openmsx::IDECDROM::getDrivesInUse ( MSXMotherBoard motherBoard)
static

Definition at line 23 of file IDECDROM.cc.

References openmsx::MSXMotherBoard::getSharedStuff().

Referenced by IDECDROM().

◆ getMediaInfo()

void openmsx::IDECDROM::getMediaInfo ( TclObject result)
overridevirtual

This method gets called when information is required on the media inserted in the media slot of the provider.

The provider must attach the info as a dictionary to the given TclObject.

Implements openmsx::MediaInfoProvider.

Definition at line 71 of file IDECDROM.cc.

References openmsx::TclObject::addDictKeyValue(), openmsx::File::getURL(), and openmsx::File::is_open().

◆ insert()

void openmsx::IDECDROM::insert ( const std::string &  filename)

◆ isPacketDevice()

bool openmsx::IDECDROM::isPacketDevice ( )
overrideprotectedvirtual

Is this device a packet (ATAPI) device?

Returns
True iff this device supports the packet commands.

Implements openmsx::AbstractIDEDevice.

Definition at line 76 of file IDECDROM.cc.

◆ operator=() [1/2]

IDECDROM & openmsx::IDECDROM::operator= ( const IDECDROM )
delete

◆ operator=() [2/2]

IDECDROM & openmsx::IDECDROM::operator= ( IDECDROM &&  )
delete

◆ readBlockStart()

unsigned openmsx::IDECDROM::readBlockStart ( AlignedBuffer buffer,
unsigned  count 
)
overrideprotectedvirtual

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.

Parameters
bufferPointer to the start of a byte array.
countNumber of bytes to be filled by this method. This number will not exceed the array size nor the transfer length.
Returns
The number of bytes that was added to the array, or 0 if the transfer was aborted (the implementation of this method must set the relevant error flags as well).

Implements openmsx::AbstractIDEDevice.

Definition at line 106 of file IDECDROM.cc.

References openmsx::AbstractIDEDevice::abortReadTransfer(), openmsx::AlignedBuffer::data(), openmsx::File::is_open(), openmsx::File::read(), and openmsx::File::seek().

◆ readEnd()

void openmsx::IDECDROM::readEnd ( )
overrideprotectedvirtual

Called when a read transfer completes.

The default implementation does nothing.

Reimplemented from openmsx::AbstractIDEDevice.

Definition at line 123 of file IDECDROM.cc.

References openmsx::AbstractIDEDevice::setInterruptReason().

◆ serialize()

template<typename Archive >
void openmsx::IDECDROM::serialize ( Archive &  ar,
unsigned  version 
)

Definition at line 392 of file IDECDROM.cc.

References eject(), openmsx::File::getURL(), insert(), and openmsx::File::is_open().

◆ writeBlockComplete()

void openmsx::IDECDROM::writeBlockComplete ( AlignedBuffer buffer,
unsigned  count 
)
overrideprotectedvirtual

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.

Parameters
bufferPointer to the start of a byte array.
countNumber of data bytes in the array.

Implements openmsx::AbstractIDEDevice.

Definition at line 128 of file IDECDROM.cc.

Friends And Related Symbol Documentation

◆ CDXCommand

friend class CDXCommand
friend

Definition at line 97 of file IDECDROM.hh.

Member Data Documentation

◆ MAX_CD

constexpr unsigned openmsx::IDECDROM::MAX_CD = 26
staticconstexpr

Definition at line 34 of file IDECDROM.hh.

Referenced by IDECDROM().


The documentation for this class was generated from the following files: