Cleanup failed stuff....

This commit is contained in:
akuker 2020-07-07 16:41:12 -05:00
parent 6815f75836
commit 64c621d36b
3 changed files with 50 additions and 462 deletions

View File

@ -4535,247 +4535,6 @@ void FASTCALL SCSICD::GetBuf(
}
//===========================================================================
//
// SCSI Monitor Device
// This will monitor all of the traffic to this SCSI ID and dump it to
// STDOUT
//
//===========================================================================
//---------------------------------------------------------------------------
//
// Constructor
//
//---------------------------------------------------------------------------
MONITORHD::MONITORHD() : Disk()
{
// SCSI Monitor
disk.id = MAKEID('S', 'M', 'O', 'N');
}
//---------------------------------------------------------------------------
//
// Reset
//
//---------------------------------------------------------------------------
void FASTCALL MONITORHD::Reset()
{
// // Unlock and release attention
// disk.lock = FALSE;
// disk.attn = FALSE;
//
// // No reset, clear code
// disk.reset = FALSE;
// disk.code = 0x00;
}
//---------------------------------------------------------------------------
//
// Open
//
//---------------------------------------------------------------------------
BOOL FASTCALL MONITORHD::Open(const Filepath& path, BOOL /*attn*/)
{
// Fileio fio;
// off64_t size;
//
// ASSERT(this);
// ASSERT(!disk.ready);
//
// // read open required
// if (!fio.Open(path, Fileio::ReadOnly)) {
// return FALSE;
// }
//
// // Get file size
// size = fio.GetFileSize();
// fio.Close();
//
// // Must be 512 bytes
// if (size & 0x1ff) {
// return FALSE;
// }
//
// // 10MB or more
// if (size < 0x9f5400) {
// return FALSE;
// }
// // 2TB according to xm6i
// // There is a similar one in wxw/wxw_cfg.cpp
// if (size > 2LL * 1024 * 1024 * 1024 * 1024) {
// return FALSE;
// }
//
// // sector size and number of blocks
// disk.size = 9;
// disk.blocks = (DWORD)(size >> 9);
//
// // Call base class
// return Disk::Open(path);
}
//---------------------------------------------------------------------------
//
// INQUIRY
//
//---------------------------------------------------------------------------
int FASTCALL MONITORHD::Inquiry(
const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor)
{
//////// char vendor[32];
//////// char product[32];
//////// char rev[32];
int size = 0;
////////
//////// ASSERT(this);
//////// ASSERT(cdb);
//////// ASSERT(buf);
//////// ASSERT(cdb[0] == 0x12);
////////
//////// // EVPD check
//////// if (cdb[1] & 0x01) {
//////// disk.code = DISK_INVALIDCDB;
//////// return 0;
//////// }
////////
//////// // Ready check (Error if no image file)
//////// if (!disk.ready) {
//////// disk.code = DISK_NOTREADY;
//////// return 0;
//////// }
////////
//////// // Basic data
//////// // buf[0] ... Direct Access Device
//////// // buf[2] ... SCSI-2 compliant command system
//////// // buf[3] ... SCSI-2 compliant Inquiry response
//////// // buf[4] ... Inquiry additional data
//////// memset(buf, 0, 8);
////////
//////// // SCSI-2 p.104 4.4.3 Incorrect logical unit handling
//////// if (((cdb[1] >> 5) & 0x07) != disk.lun) {
//////// buf[0] = 0x7f;
//////// }
////////
//////// buf[2] = 0x02;
//////// buf[3] = 0x02;
//////// buf[4] = 122 + 3; // Value close to real HDD
////////
//////// // Fill with blanks
//////// memset(&buf[8], 0x20, buf[4] - 3);
////////
//////// // Determine vendor name/product name
//////// sprintf(vendor, BENDER_SIGNATURE);
//////// size = disk.blocks >> 11;
//////// if (size < 300)
//////// sprintf(product, "PRODRIVE LPS%dS", size);
//////// else if (size < 600)
//////// sprintf(product, "MAVERICK%dS", size);
//////// else if (size < 800)
//////// sprintf(product, "LIGHTNING%dS", size);
//////// else if (size < 1000)
//////// sprintf(product, "TRAILBRAZER%dS", size);
//////// else if (size < 2000)
//////// sprintf(product, "FIREBALL%dS", size);
//////// else
//////// sprintf(product, "FBSE%d.%dS", size / 1000, (size % 1000) / 100);
////////
//////// // Vendor name
//////// memcpy(&buf[8], vendor, strlen(vendor));
////////
//////// // Product name
//////// memcpy(&buf[16], product, strlen(product));
////////
//////// // Revision
//////// sprintf(rev, "0%01d%01d%01d",
//////// (int)major, (int)(minor >> 4), (int)(minor & 0x0f));
//////// memcpy(&buf[32], rev, 4);
////////
//////// // Size of data that can be returned
//////// size = (buf[4] + 5);
////////
//////// // Limit if the other buffer is small
//////// if (size > (int)cdb[4]) {
//////// size = (int)cdb[4];
//////// }
////////
//////// // Success
//////// disk.code = DISK_NOERROR;
return size;
}
//---------------------------------------------------------------------------
//
// MODE SELECT
// *Not affected by disk.code
//
//---------------------------------------------------------------------------
BOOL FASTCALL MONITORHD::ModeSelect(const DWORD *cdb, const BYTE *buf, int length)
{
// int page;
// int size;
//
// ASSERT(this);
// ASSERT(buf);
// ASSERT(length >= 0);
//
// // PF
// if (cdb[1] & 0x10) {
// // Mode Parameter header
// if (length >= 12) {
// // Check the block length bytes
// size = 1 << disk.size;
// if (buf[9] != (BYTE)(size >> 16) ||
// buf[10] != (BYTE)(size >> 8) ||
// buf[11] != (BYTE)size) {
// // currently does not allow changing sector length
// disk.code = DISK_INVALIDPRM;
// return FALSE;
// }
// buf += 12;
// length -= 12;
// }
//
// // Parsing the page
// while (length > 0) {
// // Get page
// page = buf[0];
//
// switch (page) {
// // format device
// case 0x03:
// // check the number of bytes in the physical sector
// size = 1 << disk.size;
// if (buf[0xc] != (BYTE)(size >> 8) ||
// buf[0xd] != (BYTE)size) {
// // currently does not allow changing sector length
// disk.code = DISK_INVALIDPRM;
// return FALSE;
// }
// break;
//
// // Other page
// default:
// break;
// }
//
// // Advance to the next page
// size = buf[1] + 2;
// length -= size;
// buf += size;
// }
// }
//
// // Do not generate an error for the time being (MINIX)
// disk.code = DISK_NOERROR;
return TRUE;
}
//===========================================================================
//
// SCSI Host Bridge
@ -6537,19 +6296,19 @@ BUS::phase_t FASTCALL SASIDEV::Process()
ctrl.bus->Aquire();
// For the monitor tool, we shouldn't need to reset. We're just logging information
//////// // Reset
//////// if (ctrl.bus->GetRST()) {
////////#if defined(DISK_LOG)
//////// Log(Log::Normal, "RESET signal received");
////////#endif // DISK_LOG
////////
//////// // Reset the controller
//////// Reset();
////////
//////// // Reset the bus
//////// ctrl.bus->Reset();
//////// return ctrl.phase;
//////// }
// Reset
if (ctrl.bus->GetRST()) {
#if defined(DISK_LOG)
Log(Log::Normal, "RESET signal received");
#endif // DISK_LOG
// Reset the controller
Reset();
// Reset the bus
ctrl.bus->Reset();
return ctrl.phase;
}
// Phase processing
switch (ctrl.phase) {
@ -6616,12 +6375,12 @@ void FASTCALL SASIDEV::BusFree()
// Phase Setting
ctrl.phase = BUS::busfree;
// // Set Signal lines
// ctrl.bus->SetREQ(FALSE);
// ctrl.bus->SetMSG(FALSE);
// ctrl.bus->SetCD(FALSE);
// ctrl.bus->SetIO(FALSE);
// ctrl.bus->SetBSY(FALSE);
Set Signal lines
ctrl.bus->SetREQ(FALSE);
ctrl.bus->SetMSG(FALSE);
ctrl.bus->SetCD(FALSE);
ctrl.bus->SetIO(FALSE);
ctrl.bus->SetBSY(FALSE);
// Initialize status and message
ctrl.status = 0x00;
@ -6702,10 +6461,10 @@ void FASTCALL SASIDEV::Command()
// Phase Setting
ctrl.phase = BUS::command;
// // Signal line operated by the target
// ctrl.bus->SetMSG(FALSE);
// ctrl.bus->SetCD(TRUE);
// ctrl.bus->SetIO(FALSE);
// Signal line operated by the target
ctrl.bus->SetMSG(FALSE);
ctrl.bus->SetCD(TRUE);
ctrl.bus->SetIO(FALSE);
// Data transfer is 6 bytes x 1 block
ctrl.offset = 0;
@ -6896,10 +6655,10 @@ void FASTCALL SASIDEV::Status()
// Phase Setting
ctrl.phase = BUS::status;
//////// // Signal line operated by the target
//////// ctrl.bus->SetMSG(FALSE);
//////// ctrl.bus->SetCD(TRUE);
//////// ctrl.bus->SetIO(TRUE);
// Signal line operated by the target
ctrl.bus->SetMSG(FALSE);
ctrl.bus->SetCD(TRUE);
ctrl.bus->SetIO(TRUE);
// Data transfer is 1 byte x 1 block
ctrl.offset = 0;
@ -6957,10 +6716,10 @@ void FASTCALL SASIDEV::MsgIn()
// Phase Setting
ctrl.phase = BUS::msgin;
////////// // Signal line operated by the target
////////// ctrl.bus->SetMSG(TRUE);
////////// ctrl.bus->SetCD(TRUE);
////////// ctrl.bus->SetIO(TRUE);
// Signal line operated by the target
ctrl.bus->SetMSG(TRUE);
ctrl.bus->SetCD(TRUE);
ctrl.bus->SetIO(TRUE);
// length, blocks are already set
ASSERT(ctrl.length > 0);
@ -7041,10 +6800,10 @@ void FASTCALL SASIDEV::DataIn()
// Phase Setting
ctrl.phase = BUS::datain;
//////// // Signal line operated by the target
//////// ctrl.bus->SetMSG(FALSE);
//////// ctrl.bus->SetCD(FALSE);
//////// ctrl.bus->SetIO(TRUE);
// Signal line operated by the target
ctrl.bus->SetMSG(FALSE);
ctrl.bus->SetCD(FALSE);
ctrl.bus->SetIO(TRUE);
// length, blocks are already set
ASSERT(ctrl.length > 0);
@ -7123,10 +6882,10 @@ void FASTCALL SASIDEV::DataOut()
// Phase Setting
ctrl.phase = BUS::dataout;
//////// // Signal line operated by the target
//////// ctrl.bus->SetMSG(FALSE);
//////// ctrl.bus->SetCD(FALSE);
//////// ctrl.bus->SetIO(FALSE);
// Signal line operated by the target
ctrl.bus->SetMSG(FALSE);
ctrl.bus->SetCD(FALSE);
ctrl.bus->SetIO(FALSE);
// length, blocks are already calculated
ASSERT(ctrl.length > 0);
@ -8369,12 +8128,12 @@ void FASTCALL SCSIDEV::BusFree()
// Phase setting
ctrl.phase = BUS::busfree;
//////// // Signal line
//////// ctrl.bus->SetREQ(FALSE);
//////// ctrl.bus->SetMSG(FALSE);
//////// ctrl.bus->SetCD(FALSE);
//////// ctrl.bus->SetIO(FALSE);
//////// ctrl.bus->SetBSY(FALSE);
// Signal line
ctrl.bus->SetREQ(FALSE);
ctrl.bus->SetMSG(FALSE);
ctrl.bus->SetCD(FALSE);
ctrl.bus->SetIO(FALSE);
ctrl.bus->SetBSY(FALSE);
// Initialize status and message
ctrl.status = 0x00;
@ -8643,10 +8402,10 @@ void FASTCALL SCSIDEV::MsgOut()
// Phase Setting
ctrl.phase = BUS::msgout;
//////// // Signal line operated by the target
//////// ctrl.bus->SetMSG(TRUE);
//////// ctrl.bus->SetCD(TRUE);
//////// ctrl.bus->SetIO(FALSE);
// Signal line operated by the target
ctrl.bus->SetMSG(TRUE);
ctrl.bus->SetCD(TRUE);
ctrl.bus->SetIO(FALSE);
// Data transfer is 1 byte x 1 block
ctrl.offset = 0;

View File

@ -401,26 +401,6 @@ public:
// MODE SELECT(6) command
};
class MONITORHD : public Disk
{
public:
// Basic Functions
MONITORHD();
// Constructor
void FASTCALL Reset();
// Reset
BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
// Open
// commands
int FASTCALL Inquiry(
const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
// INQUIRY command
BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length);
// MODE SELECT(6) command
BOOL FASTCALL IsMonitor() const {return TRUE;}
};
//===========================================================================
//
// SCSI hard disk (PC-9801-55 NEC genuine /Anex86/T98Next)
@ -723,31 +703,6 @@ private:
#endif
};
//////////===========================================================================
//////////
////////// SCSI Monitor Device (Interits SCSI device)
//////////
//////////===========================================================================
////////class SCSIMONDEV : public Disk
////////{
////////public:
//////// // Basic Functions
//////// SCSIMONDEV();
//////// // Constructor
//////// void FASTCALL Reset();
//////// // Reset
//////// BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
//////// // Open
////////
//////// // commands
//////// int FASTCALL Inquiry(
//////// const DWORD *cdb, BYTE *buf, DWORD major, DWORD minor);
//////// // INQUIRY command
//////// BOOL FASTCALL ModeSelect(const DWORD *cdb, const BYTE *buf, int length);
//////// // MODE SELECT(6) command
////////};
//===========================================================================
//
// SCSI Host Bridge
@ -1190,132 +1145,6 @@ private:
// Internal data
};
//===========================================================================
//
// SCSI Device (Interits SASI device)
//
//===========================================================================
class SCSIMONDEV : public SASIDEV
{
public:
// Internal data definition
typedef struct {
// Synchronous transfer
BOOL syncenable; // Synchronous transfer possible
int syncperiod; // Synchronous transfer period
int syncoffset; // Synchronous transfer offset
int syncack; // Number of synchronous transfer ACKs
// ATN message
BOOL atnmsg;
int msc;
BYTE msb[256];
} scsi_t;
BOOL FASTCALL IsMonitor() const {return TRUE;}
public:
// Basic Functions
#ifdef RASCSI
SCSIMONDEV();
#else
SCSIMONDEV(Device *dev);
#endif // RASCSI
// Constructor
void FASTCALL Reset();
// Device Reset
// 外部API
BUS::phase_t FASTCALL Process();
// Run
void FASTCALL SyncTransfer(BOOL enable) { scsi.syncenable = enable; }
// Synchronouse transfer enable setting
// Other
BOOL FASTCALL IsSASI() const {return FALSE;}
// SASI Check
BOOL FASTCALL IsSCSI() const {return TRUE;}
// SCSI check
private:
// Phase
void FASTCALL BusFree();
// Bus free phase
void FASTCALL Selection();
// Selection phase
void FASTCALL Execute();
// Execution phase
void FASTCALL MsgOut();
// Message out phase
void FASTCALL Error();
// Common erorr handling
// commands
void FASTCALL CmdInquiry();
// INQUIRY command
void FASTCALL CmdModeSelect();
// MODE SELECT command
void FASTCALL CmdModeSense();
// MODE SENSE command
void FASTCALL CmdStartStop();
// START STOP UNIT command
void FASTCALL CmdSendDiag();
// SEND DIAGNOSTIC command
void FASTCALL CmdRemoval();
// PREVENT/ALLOW MEDIUM REMOVAL command
void FASTCALL CmdReadCapacity();
// READ CAPACITY command
void FASTCALL CmdRead10();
// READ(10) command
void FASTCALL CmdWrite10();
// WRITE(10) command
void FASTCALL CmdSeek10();
// SEEK(10) command
void FASTCALL CmdVerify();
// VERIFY command
void FASTCALL CmdSynchronizeCache();
// SYNCHRONIZE CACHE command
void FASTCALL CmdReadDefectData10();
// READ DEFECT DATA(10) command
void FASTCALL CmdReadToc();
// READ TOC command
void FASTCALL CmdPlayAudio10();
// PLAY AUDIO(10) command
void FASTCALL CmdPlayAudioMSF();
// PLAY AUDIO MSF command
void FASTCALL CmdPlayAudioTrack();
// PLAY AUDIO TRACK INDEX command
void FASTCALL CmdModeSelect10();
// MODE SELECT(10) command
void FASTCALL CmdModeSense10();
// MODE SENSE(10) command
void FASTCALL CmdGetMessage10();
// GET MESSAGE(10) command
void FASTCALL CmdSendMessage10();
// SEND MESSAGE(10) command
// データ転送
void FASTCALL Send();
// Send data
#ifndef RASCSI
void FASTCALL SendNext();
// Continue sending data
#endif // RASCSI
void FASTCALL Receive();
// Receive data
#ifndef RASCSI
void FASTCALL ReceiveNext();
// Continue receiving data
#endif // RASCSI
BOOL FASTCALL XferMsg(DWORD msg);
// Data transfer message
scsi_t scsi;
// Internal data
};
#endif // disk_h

View File

@ -155,7 +155,7 @@ BOOL Init()
bus = new GPIOBUS();
// GPIO Initialization
if (!bus->Init(BUS::TARGET)) {
if (!bus->Init()) {
return FALSE;
}