mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-09-10 00:54:39 +00:00
scsibus has a new method attach_scsi_devices which is used by all machines to populate a SCSI bus with one or more hard drives or CD-ROM drives. HDDs are specified by the hdd_img property. CDs are specified by the cdr_img property. Multiple images are delimited by a colon : attach_scsi_devices is called by the scsi controller after the scsi controller has attached itself to the scsi bus. The bus suffix is applied to the property name. Curio has no suffix so it will use hdd_img and cdr_img properties. Mesh is expected to have a suffix of 2 so it will use hdd_img2 and cdr_img2 properties. HDDs will skip SCSI ID 3 unless 7 HDDs are added, in which case, the seventh HDD will use ID 3. CDs will start at SCSI ID 3, go to 7, then down to 0. SCSI IDs are skipped if a device is already using that SCSI ID. ScsiCdrom and ScsiHD no longer use REGISTER_DEVICE or DeviceDescription or PropMap which is normal for devices that can have multiple instances.
59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
/*
|
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
|
Copyright (C) 2018-24 divingkatae and maximum
|
|
(theweirdo) spatium
|
|
|
|
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/** @file SCSI CD-ROM definitions. */
|
|
|
|
#ifndef SCSI_CDROM_H
|
|
#define SCSI_CDROM_H
|
|
|
|
#include <devices/common/scsi/scsi.h>
|
|
#include <devices/storage/cdromdrive.h>
|
|
#include <utils/imgfile.h>
|
|
|
|
#include <cinttypes>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
class ScsiCdrom : public ScsiDevice, public CdromDrive {
|
|
public:
|
|
ScsiCdrom(std::string name, int my_id);
|
|
~ScsiCdrom() = default;
|
|
|
|
virtual void process_command() override;
|
|
virtual bool prepare_data() override;
|
|
virtual bool get_more_data() override;
|
|
|
|
protected:
|
|
int test_unit_ready();
|
|
void read(uint32_t lba, uint16_t nblocks, uint8_t cmd_len);
|
|
void inquiry();
|
|
void mode_sense();
|
|
void read_toc();
|
|
void read_capacity_10();
|
|
|
|
private:
|
|
bool eject_allowed = true;
|
|
int bytes_out = 0;
|
|
uint8_t data_buf[2048] = {};
|
|
};
|
|
|
|
#endif // SCSI_CDROM_H
|