2022-11-13 23:52:53 +00:00
|
|
|
/*
|
|
|
|
DingusPPC - The Experimental PowerPC Macintosh emulator
|
2024-03-10 07:24:05 +00:00
|
|
|
Copyright (C) 2018-24 divingkatae and maximum
|
2022-11-13 23:52:53 +00:00
|
|
|
(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>
|
2023-12-08 10:10:56 +00:00
|
|
|
#include <devices/storage/cdromdrive.h>
|
2023-09-16 21:17:27 +00:00
|
|
|
#include <utils/imgfile.h>
|
2022-11-13 23:52:53 +00:00
|
|
|
|
|
|
|
#include <cinttypes>
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
2023-12-08 10:10:56 +00:00
|
|
|
class ScsiCdrom : public ScsiDevice, public CdromDrive {
|
2022-11-13 23:52:53 +00:00
|
|
|
public:
|
2023-12-04 21:41:01 +00:00
|
|
|
ScsiCdrom(std::string name, int my_id);
|
2022-11-13 23:52:53 +00:00
|
|
|
~ScsiCdrom() = default;
|
|
|
|
|
|
|
|
static std::unique_ptr<HWComponent> create() {
|
2023-12-04 21:41:01 +00:00
|
|
|
return std::unique_ptr<ScsiCdrom>(new ScsiCdrom("SCSI-CDROM", 3));
|
2022-11-13 23:52:53 +00:00
|
|
|
}
|
|
|
|
|
2023-12-08 10:10:56 +00:00
|
|
|
virtual void process_command() override;
|
|
|
|
virtual bool prepare_data() override;
|
|
|
|
virtual bool get_more_data() override;
|
2022-11-13 23:52:53 +00:00
|
|
|
|
|
|
|
protected:
|
2024-03-10 07:24:05 +00:00
|
|
|
int test_unit_ready();
|
2023-12-08 10:10:56 +00:00
|
|
|
void read(uint32_t lba, uint16_t nblocks, uint8_t cmd_len);
|
2022-11-13 23:52:53 +00:00
|
|
|
void inquiry();
|
|
|
|
void mode_sense();
|
|
|
|
void read_toc();
|
2024-03-10 07:28:03 +00:00
|
|
|
void read_capacity_10();
|
2022-11-13 23:52:53 +00:00
|
|
|
|
|
|
|
private:
|
2023-12-08 10:10:56 +00:00
|
|
|
bool eject_allowed = true;
|
|
|
|
int bytes_out = 0;
|
|
|
|
uint8_t data_buf[2048] = {};
|
2022-11-13 23:52:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SCSI_CDROM_H
|