Cleanup to merge in with main branch

This commit is contained in:
Tony Kuker
2020-07-09 15:34:29 -05:00
parent 15bd9d7dd4
commit 6bdb841dfc
4 changed files with 100 additions and 183 deletions

View File

@@ -45,7 +45,9 @@
//#define DISK_LOG //#define DISK_LOG
#ifdef RASCSI #ifdef RASCSI
#define BENDER_SIGNATURE "SONY " #define BENDER_SIGNATURE "RaSCSI"
// The following line was to mimic Apple's CDROM ID
// #define BENDER_SIGNATURE "SONY "
#else #else
#define BENDER_SIGNATURE "XM6" #define BENDER_SIGNATURE "XM6"
#endif #endif
@@ -1346,20 +1348,16 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf)
// Get changeable flag // Get changeable flag
if ((cdb[2] & 0xc0) == 0x40) { if ((cdb[2] & 0xc0) == 0x40) {
//** printf("MODESENSE: Change = TRUE\n");
change = TRUE; change = TRUE;
} else { } else {
//** printf("MODESENSE: Change = FALSE\n");
change = FALSE; change = FALSE;
} }
// Get page code (0x00 is valid from the beginning) // Get page code (0x00 is valid from the beginning)
page = cdb[2] & 0x3f; page = cdb[2] & 0x3f;
if (page == 0x00) { if (page == 0x00) {
//** printf("MODESENSE: Page code: OK %02X\n", cdb[2]);
valid = TRUE; valid = TRUE;
} else { } else {
//** printf("MODESENSE: Invalid page code received %02X\n", cdb[2]);
valid = FALSE; valid = FALSE;
} }
@@ -1373,7 +1371,6 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf)
// DEVICE SPECIFIC PARAMETER // DEVICE SPECIFIC PARAMETER
if (disk.writep) { if (disk.writep) {
//** printf("MODESENSE: Write protect\n");
buf[2] = 0x80; buf[2] = 0x80;
} }
@@ -1384,7 +1381,6 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf)
// Only if ready // Only if ready
if (disk.ready) { if (disk.ready) {
//** printf("MODESENSE: Disk is ready\n");
// Block descriptor (number of blocks) // Block descriptor (number of blocks)
buf[5] = (BYTE)(disk.blocks >> 16); buf[5] = (BYTE)(disk.blocks >> 16);
buf[6] = (BYTE)(disk.blocks >> 8); buf[6] = (BYTE)(disk.blocks >> 8);
@@ -1461,13 +1457,10 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf)
// Unsupported page // Unsupported page
if (!valid) { if (!valid) {
//** printf("MODESENSE: Something was invalid...\n");
disk.code = DISK_INVALIDCDB; disk.code = DISK_INVALIDCDB;
return 0; return 0;
} }
//** printf("MODESENSE: mode sense length is %d\n",length);
// MODE SENSE success // MODE SENSE success
disk.code = DISK_NOERROR; disk.code = DISK_NOERROR;
return length; return length;
@@ -2829,7 +2822,7 @@ BOOL FASTCALL SCSIHD_NEC::Open(const Filepath& path, BOOL /*attn*/)
cylinders = (int)(size >> 9); cylinders = (int)(size >> 9);
cylinders >>= 3; cylinders >>= 3;
cylinders /= 25; cylinders /= 25;
} else if (xstrcasecmp(ext, _T(".HDI")) == 0) { // Anex86 HD image? } else if (xstrcasecmp(ext, _T(".HDI")) == 0) { // Anex86 HD image?
imgoffset = getDwordLE(&hdr[4 + 4]); imgoffset = getDwordLE(&hdr[4 + 4]);
imgsize = getDwordLE(&hdr[4 + 4 + 4]); imgsize = getDwordLE(&hdr[4 + 4 + 4]);
sectorsize = getDwordLE(&hdr[4 + 4 + 4 + 4]); sectorsize = getDwordLE(&hdr[4 + 4 + 4 + 4]);
@@ -2953,7 +2946,7 @@ int FASTCALL SCSIHD_NEC::AddFormat(BOOL change, BYTE *buf)
// 1ゾーンのトラック数を設定(PC-9801-55はこの値を見ているようだ) // 1ゾーンのトラック数を設定(PC-9801-55はこの値を見ているようだ)
buf[0x2] = (BYTE)(heads >> 8); buf[0x2] = (BYTE)(heads >> 8);
buf[0x3] = (BYTE)heads; buf[0x3] = (BYTE)heads;
// 1トラックのセクタ数を設定 // 1トラックのセクタ数を設定
buf[0xa] = (BYTE)(sectors >> 8); buf[0xa] = (BYTE)(sectors >> 8);
buf[0xb] = (BYTE)sectors; buf[0xb] = (BYTE)sectors;
@@ -2996,7 +2989,7 @@ int FASTCALL SCSIHD_NEC::AddDrive(BOOL change, BYTE *buf)
buf[0x2] = (BYTE)(cylinders >> 16); buf[0x2] = (BYTE)(cylinders >> 16);
buf[0x3] = (BYTE)(cylinders >> 8); buf[0x3] = (BYTE)(cylinders >> 8);
buf[0x4] = (BYTE)cylinders; buf[0x4] = (BYTE)cylinders;
// ヘッド数を設定 // ヘッド数を設定
buf[0x5] = (BYTE)heads; buf[0x5] = (BYTE)heads;
} }
@@ -3410,29 +3403,29 @@ int FASTCALL SCSIMO::AddVendor(int page, BOOL change, BYTE *buf)
mode page code 20h - Vendor Unique Format Page mode page code 20h - Vendor Unique Format Page
format mode XXh type 0 format mode XXh type 0
information: http://h20628.www2.hp.com/km-ext/kmcsdirect/emr_na-lpg28560-1.pdf information: http://h20628.www2.hp.com/km-ext/kmcsdirect/emr_na-lpg28560-1.pdf
offset description offset description
02h format mode 02h format mode
03h type of format (0) 03h type of format (0)
04~07h size of user band (total sectors?) 04~07h size of user band (total sectors?)
08~09h size of spare band (spare sectors?) 08~09h size of spare band (spare sectors?)
0A~0Bh number of bands 0A~0Bh number of bands
actual value of each 3.5inches optical medium (grabbed by Fujitsu M2513EL) actual value of each 3.5inches optical medium (grabbed by Fujitsu M2513EL)
128M 230M 540M 640M 128M 230M 540M 640M
--------------------------------------------------- ---------------------------------------------------
size of user band 3CBFAh 6CF75h FE45Ch 4BC50h size of user band 3CBFAh 6CF75h FE45Ch 4BC50h
size of spare band 0400h 0401h 08CAh 08C4h size of spare band 0400h 0401h 08CAh 08C4h
number of bands 0001h 000Ah 0012h 000Bh number of bands 0001h 000Ah 0012h 000Bh
further information: http://r2089.blog36.fc2.com/blog-entry-177.html further information: http://r2089.blog36.fc2.com/blog-entry-177.html
*/ */
if (disk.ready) { if (disk.ready) {
unsigned spare = 0; unsigned spare = 0;
unsigned bands = 0; unsigned bands = 0;
if (disk.size == 9) switch (disk.blocks) { if (disk.size == 9) switch (disk.blocks) {
// 128MB // 128MB
case 248826: case 248826:
@@ -4135,7 +4128,7 @@ int FASTCALL SCSICD::Inquiry(
buf[1] = 0x80; buf[1] = 0x80;
buf[2] = 0x02; buf[2] = 0x02;
buf[3] = 0x02; buf[3] = 0x02;
buf[4] = 42; // Required buf[4] = 36 - 5; // Required
// Fill with blanks // Fill with blanks
memset(&buf[8], 0x20, buf[4] - 3); memset(&buf[8], 0x20, buf[4] - 3);
@@ -4144,16 +4137,34 @@ int FASTCALL SCSICD::Inquiry(
memcpy(&buf[8], BENDER_SIGNATURE, strlen(BENDER_SIGNATURE)); memcpy(&buf[8], BENDER_SIGNATURE, strlen(BENDER_SIGNATURE));
// Product name // Product name
memcpy(&buf[16], "CD-ROM CDU-8003A", 16); memcpy(&buf[16], "CD-ROM CDU-55S", 14);
// Revision (XM6 version number) // Revision (XM6 version number)
// sprintf(rev, "1.9a", sprintf(rev, "0%01d%01d%01d",
// (int)major, (int)(minor >> 4), (int)(minor & 0x0f)); (int)major, (int)(minor >> 4), (int)(minor & 0x0f));
memcpy(&buf[32], "1.9a", 4); memcpy(&buf[32], rev, 4);
//
//strcpy(&buf[35],"A1.9a"); // The following code worked with the modified Apple CD-ROM drivers. Need to
buf[36]=0x20; // test with the original code to see if it works as well....
memcpy(&buf[37],"1999/01/01",10); // buf[4] = 42; // Required
//
// // Fill with blanks
// memset(&buf[8], 0x20, buf[4] - 3);
//
// // Vendor name
// memcpy(&buf[8], BENDER_SIGNATURE, strlen(BENDER_SIGNATURE));
//
// // Product name
// memcpy(&buf[16], "CD-ROM CDU-8003A", 16);
//
// // Revision (XM6 version number)
//// sprintf(rev, "1.9a",
// //// (int)major, (int)(minor >> 4), (int)(minor & 0x0f));
// memcpy(&buf[32], "1.9a", 4);
//
// //strcpy(&buf[35],"A1.9a");
// buf[36]=0x20;
// memcpy(&buf[37],"1999/01/01",10);
// Size of data that can be returned // Size of data that can be returned
size = (buf[4] + 5); size = (buf[4] + 5);
@@ -4534,7 +4545,6 @@ void FASTCALL SCSICD::GetBuf(
ASSERT(this); ASSERT(this);
} }
//=========================================================================== //===========================================================================
// //
// SCSI Host Bridge // SCSI Host Bridge
@@ -5003,7 +5013,7 @@ void FASTCALL SCSIBR::FS_CheckDir(BYTE *buf)
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
fsresult = fs->CheckDir(nUnit, pNamests); fsresult = fs->CheckDir(nUnit, pNamests);
} }
@@ -5027,10 +5037,10 @@ void FASTCALL SCSIBR::FS_MakeDir(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
fsresult = fs->MakeDir(nUnit, pNamests); fsresult = fs->MakeDir(nUnit, pNamests);
} }
@@ -5054,10 +5064,10 @@ void FASTCALL SCSIBR::FS_RemoveDir(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
fsresult = fs->RemoveDir(nUnit, pNamests); fsresult = fs->RemoveDir(nUnit, pNamests);
} }
@@ -5082,13 +5092,13 @@ void FASTCALL SCSIBR::FS_Rename(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
pNamestsNew = (Human68k::namests_t*)&buf[i]; pNamestsNew = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
fsresult = fs->Rename(nUnit, pNamests, pNamestsNew); fsresult = fs->Rename(nUnit, pNamests, pNamestsNew);
} }
@@ -5112,10 +5122,10 @@ void FASTCALL SCSIBR::FS_Delete(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
fsresult = fs->Delete(nUnit, pNamests); fsresult = fs->Delete(nUnit, pNamests);
} }
@@ -5140,14 +5150,14 @@ void FASTCALL SCSIBR::FS_Attribute(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
dp = (DWORD*)&buf[i]; dp = (DWORD*)&buf[i];
nHumanAttribute = ntohl(*dp); nHumanAttribute = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
fsresult = fs->Attribute(nUnit, pNamests, nHumanAttribute); fsresult = fs->Attribute(nUnit, pNamests, nHumanAttribute);
} }
@@ -5177,7 +5187,7 @@ void FASTCALL SCSIBR::FS_Files(BYTE *buf)
dp = (DWORD*)&buf[i]; dp = (DWORD*)&buf[i];
nKey = ntohl(*dp); nKey = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
@@ -5284,7 +5294,7 @@ void FASTCALL SCSIBR::FS_Create(BYTE *buf)
dp = (DWORD*)&buf[i]; dp = (DWORD*)&buf[i];
nKey = ntohl(*dp); nKey = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
@@ -5346,7 +5356,7 @@ void FASTCALL SCSIBR::FS_Open(BYTE *buf)
dp = (DWORD*)&buf[i]; dp = (DWORD*)&buf[i];
nKey = ntohl(*dp); nKey = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pNamests = (Human68k::namests_t*)&buf[i]; pNamests = (Human68k::namests_t*)&buf[i];
i += sizeof(Human68k::namests_t); i += sizeof(Human68k::namests_t);
@@ -5399,7 +5409,7 @@ void FASTCALL SCSIBR::FS_Close(BYTE *buf)
dp = (DWORD*)&buf[i]; dp = (DWORD*)&buf[i];
nKey = ntohl(*dp); nKey = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pFcb = (Human68k::fcb_t*)&buf[i]; pFcb = (Human68k::fcb_t*)&buf[i];
i += sizeof(Human68k::fcb_t); i += sizeof(Human68k::fcb_t);
@@ -5448,7 +5458,7 @@ void FASTCALL SCSIBR::FS_Read(BYTE *buf)
pFcb = (Human68k::fcb_t*)&buf[i]; pFcb = (Human68k::fcb_t*)&buf[i];
i += sizeof(Human68k::fcb_t); i += sizeof(Human68k::fcb_t);
dp = (DWORD*)&buf[i]; dp = (DWORD*)&buf[i];
nSize = ntohl(*dp); nSize = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
@@ -5497,7 +5507,7 @@ void FASTCALL SCSIBR::FS_Write(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nKey = ntohl(*dp); nKey = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pFcb = (Human68k::fcb_t*)&buf[i]; pFcb = (Human68k::fcb_t*)&buf[i];
i += sizeof(Human68k::fcb_t); i += sizeof(Human68k::fcb_t);
@@ -5549,7 +5559,7 @@ void FASTCALL SCSIBR::FS_Seek(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nKey = ntohl(*dp); nKey = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pFcb = (Human68k::fcb_t*)&buf[i]; pFcb = (Human68k::fcb_t*)&buf[i];
i += sizeof(Human68k::fcb_t); i += sizeof(Human68k::fcb_t);
@@ -5608,7 +5618,7 @@ void FASTCALL SCSIBR::FS_TimeStamp(BYTE *buf)
dp = (DWORD*)&buf[i]; dp = (DWORD*)&buf[i];
nKey = ntohl(*dp); nKey = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pFcb = (Human68k::fcb_t*)&buf[i]; pFcb = (Human68k::fcb_t*)&buf[i];
i += sizeof(Human68k::fcb_t); i += sizeof(Human68k::fcb_t);
@@ -5689,10 +5699,10 @@ void FASTCALL SCSIBR::FS_CtrlDrive(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
pCtrlDrive = (Human68k::ctrldrive_t*)&buf[i]; pCtrlDrive = (Human68k::ctrldrive_t*)&buf[i];
i += sizeof(Human68k::ctrldrive_t); i += sizeof(Human68k::ctrldrive_t);
fsresult = fs->CtrlDrive(nUnit, pCtrlDrive); fsresult = fs->CtrlDrive(nUnit, pCtrlDrive);
memcpy(fsout, pCtrlDrive, sizeof(Human68k::ctrldrive_t)); memcpy(fsout, pCtrlDrive, sizeof(Human68k::ctrldrive_t));
@@ -5719,7 +5729,7 @@ void FASTCALL SCSIBR::FS_GetDPB(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
fsresult = fs->GetDPB(nUnit, &dpb); fsresult = fs->GetDPB(nUnit, &dpb);
dpb.sector_size = htons(dpb.sector_size); dpb.sector_size = htons(dpb.sector_size);
@@ -5762,7 +5772,7 @@ void FASTCALL SCSIBR::FS_DiskRead(BYTE *buf)
dp = (DWORD*)&buf[i]; dp = (DWORD*)&buf[i];
nSize = ntohl(*dp); nSize = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
fsresult = fs->DiskRead(nUnit, fsout, nSector, nSize); fsresult = fs->DiskRead(nUnit, fsout, nSector, nSize);
fsoutlen = 0x200; fsoutlen = 0x200;
} }
@@ -5786,7 +5796,7 @@ void FASTCALL SCSIBR::FS_DiskWrite(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
fsresult = fs->DiskWrite(nUnit); fsresult = fs->DiskWrite(nUnit);
} }
@@ -5863,7 +5873,7 @@ void FASTCALL SCSIBR::FS_Flush(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
fsresult = fs->Flush(nUnit); fsresult = fs->Flush(nUnit);
} }
@@ -5886,7 +5896,7 @@ void FASTCALL SCSIBR::FS_CheckMedia(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
fsresult = fs->CheckMedia(nUnit); fsresult = fs->CheckMedia(nUnit);
} }
@@ -5909,7 +5919,7 @@ void FASTCALL SCSIBR::FS_Lock(BYTE *buf)
dp = (DWORD*)buf; dp = (DWORD*)buf;
nUnit = ntohl(*dp); nUnit = ntohl(*dp);
i += sizeof(DWORD); i += sizeof(DWORD);
fsresult = fs->Lock(nUnit); fsresult = fs->Lock(nUnit);
} }
@@ -6474,13 +6484,7 @@ void FASTCALL SASIDEV::Command()
#ifdef RASCSI #ifdef RASCSI
// Command reception handshake (10 bytes are automatically received at the first command) // Command reception handshake (10 bytes are automatically received at the first command)
count = ctrl.bus->CommandHandShake(ctrl.buffer); count = ctrl.bus->CommandHandShake(ctrl.buffer);
//** printf("Command received: " );
//** for(int i=0; i< count; i++)
//** {
//** printf("%02X ", ctrl.buffer[i]);
//** }
//** printf("\n");
// If no byte can be received move to the status phase // If no byte can be received move to the status phase
if (count == 0) { if (count == 0) {
Error(); Error();
@@ -6668,8 +6672,8 @@ void FASTCALL SASIDEV::Status()
#ifndef RASCSI #ifndef RASCSI
// Request status // Request status
// ctrl.bus->SetDAT(ctrl.buffer[0]); ctrl.bus->SetDAT(ctrl.buffer[0]);
// ctrl.bus->SetREQ(TRUE); ctrl.bus->SetREQ(TRUE);
#if defined(DISK_LOG) #if defined(DISK_LOG)
Log(Log::Normal, "Status Phase $%02X", ctrl.status); Log(Log::Normal, "Status Phase $%02X", ctrl.status);
@@ -7302,7 +7306,7 @@ void FASTCALL SASIDEV::CmdAssign()
return; return;
} }
// 4Request 4 bytes of data // Request 4 bytes of data
ctrl.length = 4; ctrl.length = 4;
// Write phase // Write phase
@@ -7712,14 +7716,7 @@ BOOL FASTCALL SASIDEV::XferIn(BYTE *buf)
// Read from disk // Read from disk
ctrl.length = ctrl.unit[lun]->Read(buf, ctrl.next); ctrl.length = ctrl.unit[lun]->Read(buf, ctrl.next);
ctrl.next++; ctrl.next++;
//** printf("XferIn read data from disk: ");
//** for (int i=0; i<ctrl.length; i++)
//** {
//** printf("%02X ", ctrl.buffer[i]);
//** }
//** printf("\n");
// If there is an error, go to the status phase // If there is an error, go to the status phase
if (ctrl.length <= 0) { if (ctrl.length <= 0) {
// Cancel data-in // Cancel data-in
@@ -7860,12 +7857,13 @@ void FASTCALL SASIDEV::FlushUnit()
} }
break; break;
default: default:
printf("Received an invalid flush command %02X!!!!!\n",ctrl.cmd[0]); printf("Received an invalid flush command %08X!!!!!\n",ctrl.cmd[0]);
ASSERT(FALSE); ASSERT(FALSE);
break; break;
} }
} }
#ifdef DISK_LOG
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// Get the current phase as a string // Get the current phase as a string
@@ -7913,11 +7911,13 @@ void SASIDEV::GetPhaseStr(char *str)
break; break;
} }
} }
#endif
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// Log output // Log output
// //
// TODO: This function needs some cleanup. Its very kludgey
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL SASIDEV::Log(Log::loglevel level, const char *format, ...) void FASTCALL SASIDEV::Log(Log::loglevel level, const char *format, ...)
{ {
@@ -7942,6 +7942,7 @@ void FASTCALL SASIDEV::Log(Log::loglevel level, const char *format, ...)
#endif // DISK_LOG #endif // DISK_LOG
#endif // RASCSI #endif // RASCSI
#ifdef DISK_LOG
// format // format
vsprintf(buffer, format, args); vsprintf(buffer, format, args);
@@ -7975,6 +7976,7 @@ void FASTCALL SASIDEV::Log(Log::loglevel level, const char *format, ...)
host->GetVM()->GetLog()->Format(level, host, buffer); host->GetVM()->GetLog()->Format(level, host, buffer);
#endif // RASCSI #endif // RASCSI
#endif // BAREMETAL #endif // BAREMETAL
#endif // DISK_LOG
} }
//=========================================================================== //===========================================================================
@@ -8029,7 +8031,6 @@ void FASTCALL SCSIDEV::Reset()
BUS::phase_t FASTCALL SCSIDEV::Process() BUS::phase_t FASTCALL SCSIDEV::Process()
{ {
ASSERT(this); ASSERT(this);
//** printf("SCSIDEV::Process() %d\n", ctrl.id);
// Do nothing if not connected // Do nothing if not connected
if (ctrl.id < 0 || ctrl.bus == NULL) { if (ctrl.id < 0 || ctrl.bus == NULL) {
@@ -8590,13 +8591,6 @@ void FASTCALL SCSIDEV::CmdModeSense()
Log(Log::Normal, "MODE SENSE Command "); Log(Log::Normal, "MODE SENSE Command ");
#endif // DISK_LOG #endif // DISK_LOG
//** printf("Received a Mode Sense command. Contents....");
//** for(int i=0; i<10; i++)
//** {
//** printf("%08X ", ctrl.cmd[i]);
//** }
//** printf("\n");
// Logical Unit // Logical Unit
lun = (ctrl.cmd[1] >> 5) & 0x07; lun = (ctrl.cmd[1] >> 5) & 0x07;
if (!ctrl.unit[lun]) { if (!ctrl.unit[lun]) {

View File

@@ -229,8 +229,6 @@ public:
// NULL check // NULL check
BOOL FASTCALL IsSASI() const; BOOL FASTCALL IsSASI() const;
// SASI Check // SASI Check
virtual BOOL FASTCALL IsMonitor() const {return FALSE;}
// Check if this is a monitor device
// Media Operations // Media Operations
virtual BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE); virtual BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
@@ -922,8 +920,10 @@ public:
// Other // Other
BUS::phase_t FASTCALL GetPhase() {return ctrl.phase;} BUS::phase_t FASTCALL GetPhase() {return ctrl.phase;}
// Get the phase // Get the phase
#ifdef DISK_LOG
// Function to get the current phase as a String.
void FASTCALL GetPhaseStr(char *str); void FASTCALL GetPhaseStr(char *str);
#endif
int FASTCALL GetID() {return ctrl.id;} int FASTCALL GetID() {return ctrl.id;}
// Get the ID // Get the ID
@@ -935,8 +935,6 @@ public:
// SASI Check // SASI Check
virtual BOOL FASTCALL IsSCSI() const {return FALSE;} virtual BOOL FASTCALL IsSCSI() const {return FALSE;}
// SCSI check // SCSI check
virtual BOOL FASTCALL IsMonitor() const {return FALSE;}
// Check to see if this is a monitor device
Disk* FASTCALL GetBusyUnit(); Disk* FASTCALL GetBusyUnit();
// Get the busy unit // Get the busy unit

View File

@@ -65,7 +65,7 @@ DWORD bcm_host_get_peripheral_address(void)
char buf[1024]; char buf[1024];
size_t len = sizeof(buf); size_t len = sizeof(buf);
DWORD address; DWORD address;
if (sysctlbyname("hw.model", buf, &len, NULL, 0) || if (sysctlbyname("hw.model", buf, &len, NULL, 0) ||
strstr(buf, "ARM1176JZ-S") != buf) { strstr(buf, "ARM1176JZ-S") != buf) {
// Failed to get CPU model || Not BCM2835 // Failed to get CPU model || Not BCM2835
@@ -88,7 +88,7 @@ extern uint32_t RPi_IO_Base_Addr;
// Core frequency // Core frequency
extern uint32_t RPi_Core_Freq; extern uint32_t RPi_Core_Freq;
#ifdef USE_SEL_EVENT_ENABLE #ifdef USE_SEL_EVENT_ENABLE
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// Interrupt control function // Interrupt control function
@@ -521,7 +521,7 @@ DWORD FASTCALL GPIOBUS::Aquire()
// Invert if negative logic (internal processing is unified to positive logic) // Invert if negative logic (internal processing is unified to positive logic)
signals = ~signals; signals = ~signals;
#endif // SIGNAL_CONTROL_MODE #endif // SIGNAL_CONTROL_MODE
return signals; return signals;
} }
@@ -552,15 +552,9 @@ BOOL FASTCALL GPIOBUS::GetBSY()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetBSY(BOOL ast) void FASTCALL GPIOBUS::SetBSY(BOOL ast)
{ {
if(actmode == MONITOR) // Set BSY signal
{ SetSignal(PIN_BSY, ast);
printf("WARNING!!! SOMEONE TRIED TO SET BSY IN MONITOR MODE");
}
else
{
// Set BSY signal
SetSignal(PIN_BSY, ast);
}
if (actmode == TARGET) { if (actmode == TARGET) {
if (ast) { if (ast) {
// Turn on ACTIVE signal // Turn on ACTIVE signal
@@ -612,14 +606,8 @@ void FASTCALL GPIOBUS::SetSEL(BOOL ast)
SetControl(PIN_ACT, ACT_ON); SetControl(PIN_ACT, ACT_ON);
} }
if (actmode != MONITOR) // Set SEL signal
{ SetSignal(PIN_SEL, ast);
// Set SEL signal
SetSignal(PIN_SEL, ast);
}
else{
printf("WARNING!!! SOMEONE TRIED TO SET SEL IN MONITOR MODE");
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -639,14 +627,7 @@ BOOL FASTCALL GPIOBUS::GetATN()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetATN(BOOL ast) void FASTCALL GPIOBUS::SetATN(BOOL ast)
{ {
if(actmode == MONITOR) SetSignal(PIN_ATN, ast);
{
printf("WARNING!!! SOMEONE TRIED TO SET ATN IN MONITOR MODE");
}
else
{
SetSignal(PIN_ATN, ast);
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -666,14 +647,7 @@ BOOL FASTCALL GPIOBUS::GetACK()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetACK(BOOL ast) void FASTCALL GPIOBUS::SetACK(BOOL ast)
{ {
if(actmode == MONITOR)
{
printf("WARNING!!! SOMEONE TRIED TO SET ACK IN MONITOR MODE");
}
else
{
SetSignal(PIN_ACK, ast); SetSignal(PIN_ACK, ast);
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -693,14 +667,7 @@ BOOL FASTCALL GPIOBUS::GetRST()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetRST(BOOL ast) void FASTCALL GPIOBUS::SetRST(BOOL ast)
{ {
if(actmode == MONITOR)
{
printf("WARNING!!! SOMEONE TRIED TO SET RST IN MONITOR MODE");
}
else
{
SetSignal(PIN_RST, ast); SetSignal(PIN_RST, ast);
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -720,13 +687,7 @@ BOOL FASTCALL GPIOBUS::GetMSG()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetMSG(BOOL ast) void FASTCALL GPIOBUS::SetMSG(BOOL ast)
{ {
if(actmode == MONITOR) SetSignal(PIN_MSG, ast);
{
printf("WARNING!!! SOMEONE TRIED TO SET MSG IN MONITOR MODE");
}
else{
SetSignal(PIN_MSG, ast);
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -746,14 +707,7 @@ BOOL FASTCALL GPIOBUS::GetCD()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetCD(BOOL ast) void FASTCALL GPIOBUS::SetCD(BOOL ast)
{ {
if(actmode == MONITOR) SetSignal(PIN_CD, ast);
{
printf("WARNING!!! SOMEONE TRIED TO SET CD IN MONITOR MODE");
}
else
{
SetSignal(PIN_CD, ast);
}
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@@ -803,21 +757,6 @@ BOOL FASTCALL GPIOBUS::GetIO()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetIO(BOOL ast) void FASTCALL GPIOBUS::SetIO(BOOL ast)
{ {
if(actmode == MONITOR)
{
printf("WARNING!!! SOMEONE TRIED TO SET IO IN MONITOR MODE");
SetControl(PIN_DTD, DTD_IN);
SetMode(PIN_DT0, IN);
SetMode(PIN_DT1, IN);
SetMode(PIN_DT2, IN);
SetMode(PIN_DT3, IN);
SetMode(PIN_DT4, IN);
SetMode(PIN_DT5, IN);
SetMode(PIN_DT6, IN);
SetMode(PIN_DT7, IN);
SetMode(PIN_DP, IN);
}
SetSignal(PIN_IO, ast); SetSignal(PIN_IO, ast);
if (actmode == TARGET) { if (actmode == TARGET) {
@@ -866,12 +805,6 @@ BOOL FASTCALL GPIOBUS::GetREQ()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetREQ(BOOL ast) void FASTCALL GPIOBUS::SetREQ(BOOL ast)
{ {
if(actmode == MONITOR)
{
printf("WARNING!!! SOMEONE TRIED TO SET REQ IN MONITOR MODE");
return;
}
SetSignal(PIN_REQ, ast); SetSignal(PIN_REQ, ast);
} }
@@ -905,14 +838,6 @@ BYTE FASTCALL GPIOBUS::GetDAT()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void FASTCALL GPIOBUS::SetDAT(BYTE dat) void FASTCALL GPIOBUS::SetDAT(BYTE dat)
{ {
if(actmode == MONITOR)
{
printf("WARNING!!! SOMEONE TRIED TO SET Data IN MONITOR MODE");
return;
}
// Write to port // Write to port
#if SIGNAL_CONTROL_MODE == 0 #if SIGNAL_CONTROL_MODE == 0
DWORD fsel; DWORD fsel;
@@ -1230,7 +1155,7 @@ int FASTCALL GPIOBUS::SendHandShake(BYTE *buf, int count)
} }
// Already waiting for REQ assertion // Already waiting for REQ assertion
// Assert the ACK signal // Assert the ACK signal
SetSignal(PIN_ACK, ON); SetSignal(PIN_ACK, ON);
@@ -1474,7 +1399,7 @@ void FASTCALL GPIOBUS::SetMode(int pin, int mode)
gpio[index] = data; gpio[index] = data;
gpfsel[index] = data; gpfsel[index] = data;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// Get input signal value // Get input signal value
@@ -1484,7 +1409,7 @@ BOOL FASTCALL GPIOBUS::GetSignal(int pin)
{ {
return (signals >> pin) & 1; return (signals >> pin) & 1;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// Set output signal value // Set output signal value

View File

@@ -79,7 +79,7 @@ void Banner(int argc, char* argv[])
FPRT(stdout,"Connect type : %s\n", CONNECT_DESC); FPRT(stdout,"Connect type : %s\n", CONNECT_DESC);
if ((argc > 1 && strcmp(argv[1], "-h") == 0) || if ((argc > 1 && strcmp(argv[1], "-h") == 0) ||
(argc > 1 && strcmp(argv[1], "--help") == 0)){ (argc > 1 && strcmp(argv[1], "--help") == 0)){
FPRT(stdout,"\n"); FPRT(stdout,"\n");
FPRT(stdout,"Usage: %s [-IDn FILE] ...\n\n", argv[0]); FPRT(stdout,"Usage: %s [-IDn FILE] ...\n\n", argv[0]);
FPRT(stdout," n is SCSI identification number(0-7).\n"); FPRT(stdout," n is SCSI identification number(0-7).\n");
@@ -154,7 +154,7 @@ BOOL Init()
// GPIOBUS creation // GPIOBUS creation
bus = new GPIOBUS(); bus = new GPIOBUS();
// GPIO Initialization // GPIO Initialization
if (!bus->Init()) { if (!bus->Init()) {
return FALSE; return FALSE;
@@ -207,7 +207,7 @@ void Cleanup()
// Cleanup the Bus // Cleanup the Bus
bus->Cleanup(); bus->Cleanup();
// Discard the GPIOBUS object // Discard the GPIOBUS object
delete bus; delete bus;
@@ -307,7 +307,7 @@ void ListDevice(FILE *fp)
FPRT(fp, "No device is installed.\n"); FPRT(fp, "No device is installed.\n");
return; return;
} }
FPRT(fp, "+----+----+------+-------------------------------------\n"); FPRT(fp, "+----+----+------+-------------------------------------\n");
} }
@@ -863,7 +863,7 @@ static void *MonThread(void *param)
{ {
struct sched_param schedparam; struct sched_param schedparam;
struct sockaddr_in client; struct sockaddr_in client;
socklen_t len; socklen_t len;
int fd; int fd;
FILE *fp; FILE *fp;
char buf[BUFSIZ]; char buf[BUFSIZ];
@@ -893,8 +893,8 @@ static void *MonThread(void *param)
while (1) { while (1) {
// Wait for connection // Wait for connection
memset(&client, 0, sizeof(client)); memset(&client, 0, sizeof(client));
len = sizeof(client); len = sizeof(client);
fd = accept(monsocket, (struct sockaddr*)&client, &len); fd = accept(monsocket, (struct sockaddr*)&client, &len);
if (fd < 0) { if (fd < 0) {
break; break;