mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-21 23:29:39 +00:00
Cleanup to merge in with main branch
This commit is contained in:
parent
15bd9d7dd4
commit
6bdb841dfc
@ -45,7 +45,9 @@
|
||||
//#define DISK_LOG
|
||||
|
||||
#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
|
||||
#define BENDER_SIGNATURE "XM6"
|
||||
#endif
|
||||
@ -1346,20 +1348,16 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf)
|
||||
|
||||
// Get changeable flag
|
||||
if ((cdb[2] & 0xc0) == 0x40) {
|
||||
//** printf("MODESENSE: Change = TRUE\n");
|
||||
change = TRUE;
|
||||
} else {
|
||||
//** printf("MODESENSE: Change = FALSE\n");
|
||||
change = FALSE;
|
||||
}
|
||||
|
||||
// Get page code (0x00 is valid from the beginning)
|
||||
page = cdb[2] & 0x3f;
|
||||
if (page == 0x00) {
|
||||
//** printf("MODESENSE: Page code: OK %02X\n", cdb[2]);
|
||||
valid = TRUE;
|
||||
} else {
|
||||
//** printf("MODESENSE: Invalid page code received %02X\n", cdb[2]);
|
||||
valid = FALSE;
|
||||
}
|
||||
|
||||
@ -1373,7 +1371,6 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf)
|
||||
|
||||
// DEVICE SPECIFIC PARAMETER
|
||||
if (disk.writep) {
|
||||
//** printf("MODESENSE: Write protect\n");
|
||||
buf[2] = 0x80;
|
||||
}
|
||||
|
||||
@ -1384,7 +1381,6 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf)
|
||||
|
||||
// Only if ready
|
||||
if (disk.ready) {
|
||||
//** printf("MODESENSE: Disk is ready\n");
|
||||
// Block descriptor (number of blocks)
|
||||
buf[5] = (BYTE)(disk.blocks >> 16);
|
||||
buf[6] = (BYTE)(disk.blocks >> 8);
|
||||
@ -1461,13 +1457,10 @@ int FASTCALL Disk::ModeSense(const DWORD *cdb, BYTE *buf)
|
||||
|
||||
// Unsupported page
|
||||
if (!valid) {
|
||||
//** printf("MODESENSE: Something was invalid...\n");
|
||||
disk.code = DISK_INVALIDCDB;
|
||||
return 0;
|
||||
}
|
||||
|
||||
//** printf("MODESENSE: mode sense length is %d\n",length);
|
||||
|
||||
// MODE SENSE success
|
||||
disk.code = DISK_NOERROR;
|
||||
return length;
|
||||
@ -2829,7 +2822,7 @@ BOOL FASTCALL SCSIHD_NEC::Open(const Filepath& path, BOOL /*attn*/)
|
||||
cylinders = (int)(size >> 9);
|
||||
cylinders >>= 3;
|
||||
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]);
|
||||
imgsize = getDwordLE(&hdr[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はこの値を見ているようだ)
|
||||
buf[0x2] = (BYTE)(heads >> 8);
|
||||
buf[0x3] = (BYTE)heads;
|
||||
|
||||
|
||||
// 1トラックのセクタ数を設定
|
||||
buf[0xa] = (BYTE)(sectors >> 8);
|
||||
buf[0xb] = (BYTE)sectors;
|
||||
@ -2996,7 +2989,7 @@ int FASTCALL SCSIHD_NEC::AddDrive(BOOL change, BYTE *buf)
|
||||
buf[0x2] = (BYTE)(cylinders >> 16);
|
||||
buf[0x3] = (BYTE)(cylinders >> 8);
|
||||
buf[0x4] = (BYTE)cylinders;
|
||||
|
||||
|
||||
// ヘッド数を設定
|
||||
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
|
||||
format mode XXh type 0
|
||||
information: http://h20628.www2.hp.com/km-ext/kmcsdirect/emr_na-lpg28560-1.pdf
|
||||
|
||||
|
||||
offset description
|
||||
02h format mode
|
||||
03h type of format (0)
|
||||
04~07h size of user band (total sectors?)
|
||||
08~09h size of spare band (spare sectors?)
|
||||
0A~0Bh number of bands
|
||||
|
||||
|
||||
actual value of each 3.5inches optical medium (grabbed by Fujitsu M2513EL)
|
||||
|
||||
|
||||
128M 230M 540M 640M
|
||||
---------------------------------------------------
|
||||
size of user band 3CBFAh 6CF75h FE45Ch 4BC50h
|
||||
size of spare band 0400h 0401h 08CAh 08C4h
|
||||
number of bands 0001h 000Ah 0012h 000Bh
|
||||
|
||||
|
||||
further information: http://r2089.blog36.fc2.com/blog-entry-177.html
|
||||
*/
|
||||
|
||||
if (disk.ready) {
|
||||
unsigned spare = 0;
|
||||
unsigned bands = 0;
|
||||
|
||||
|
||||
if (disk.size == 9) switch (disk.blocks) {
|
||||
// 128MB
|
||||
case 248826:
|
||||
@ -4135,7 +4128,7 @@ int FASTCALL SCSICD::Inquiry(
|
||||
buf[1] = 0x80;
|
||||
buf[2] = 0x02;
|
||||
buf[3] = 0x02;
|
||||
buf[4] = 42; // Required
|
||||
buf[4] = 36 - 5; // Required
|
||||
|
||||
// Fill with blanks
|
||||
memset(&buf[8], 0x20, buf[4] - 3);
|
||||
@ -4144,16 +4137,34 @@ int FASTCALL SCSICD::Inquiry(
|
||||
memcpy(&buf[8], BENDER_SIGNATURE, strlen(BENDER_SIGNATURE));
|
||||
|
||||
// Product name
|
||||
memcpy(&buf[16], "CD-ROM CDU-8003A", 16);
|
||||
memcpy(&buf[16], "CD-ROM CDU-55S", 14);
|
||||
|
||||
// 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);
|
||||
sprintf(rev, "0%01d%01d%01d",
|
||||
(int)major, (int)(minor >> 4), (int)(minor & 0x0f));
|
||||
memcpy(&buf[32], rev, 4);
|
||||
//
|
||||
// The following code worked with the modified Apple CD-ROM drivers. Need to
|
||||
// test with the original code to see if it works as well....
|
||||
// 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 = (buf[4] + 5);
|
||||
@ -4534,7 +4545,6 @@ void FASTCALL SCSICD::GetBuf(
|
||||
ASSERT(this);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// SCSI Host Bridge
|
||||
@ -5003,7 +5013,7 @@ void FASTCALL SCSIBR::FS_CheckDir(BYTE *buf)
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
|
||||
fsresult = fs->CheckDir(nUnit, pNamests);
|
||||
}
|
||||
|
||||
@ -5027,10 +5037,10 @@ void FASTCALL SCSIBR::FS_MakeDir(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
|
||||
fsresult = fs->MakeDir(nUnit, pNamests);
|
||||
}
|
||||
|
||||
@ -5054,10 +5064,10 @@ void FASTCALL SCSIBR::FS_RemoveDir(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
|
||||
fsresult = fs->RemoveDir(nUnit, pNamests);
|
||||
}
|
||||
|
||||
@ -5082,13 +5092,13 @@ void FASTCALL SCSIBR::FS_Rename(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
pNamestsNew = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
|
||||
fsresult = fs->Rename(nUnit, pNamests, pNamestsNew);
|
||||
}
|
||||
|
||||
@ -5112,10 +5122,10 @@ void FASTCALL SCSIBR::FS_Delete(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
|
||||
fsresult = fs->Delete(nUnit, pNamests);
|
||||
}
|
||||
|
||||
@ -5140,14 +5150,14 @@ void FASTCALL SCSIBR::FS_Attribute(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
dp = (DWORD*)&buf[i];
|
||||
nHumanAttribute = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
fsresult = fs->Attribute(nUnit, pNamests, nHumanAttribute);
|
||||
}
|
||||
|
||||
@ -5177,7 +5187,7 @@ void FASTCALL SCSIBR::FS_Files(BYTE *buf)
|
||||
dp = (DWORD*)&buf[i];
|
||||
nKey = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
@ -5284,7 +5294,7 @@ void FASTCALL SCSIBR::FS_Create(BYTE *buf)
|
||||
dp = (DWORD*)&buf[i];
|
||||
nKey = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
@ -5346,7 +5356,7 @@ void FASTCALL SCSIBR::FS_Open(BYTE *buf)
|
||||
dp = (DWORD*)&buf[i];
|
||||
nKey = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pNamests = (Human68k::namests_t*)&buf[i];
|
||||
i += sizeof(Human68k::namests_t);
|
||||
|
||||
@ -5399,7 +5409,7 @@ void FASTCALL SCSIBR::FS_Close(BYTE *buf)
|
||||
dp = (DWORD*)&buf[i];
|
||||
nKey = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pFcb = (Human68k::fcb_t*)&buf[i];
|
||||
i += sizeof(Human68k::fcb_t);
|
||||
|
||||
@ -5448,7 +5458,7 @@ void FASTCALL SCSIBR::FS_Read(BYTE *buf)
|
||||
|
||||
pFcb = (Human68k::fcb_t*)&buf[i];
|
||||
i += sizeof(Human68k::fcb_t);
|
||||
|
||||
|
||||
dp = (DWORD*)&buf[i];
|
||||
nSize = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
@ -5497,7 +5507,7 @@ void FASTCALL SCSIBR::FS_Write(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nKey = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pFcb = (Human68k::fcb_t*)&buf[i];
|
||||
i += sizeof(Human68k::fcb_t);
|
||||
|
||||
@ -5549,7 +5559,7 @@ void FASTCALL SCSIBR::FS_Seek(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nKey = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pFcb = (Human68k::fcb_t*)&buf[i];
|
||||
i += sizeof(Human68k::fcb_t);
|
||||
|
||||
@ -5608,7 +5618,7 @@ void FASTCALL SCSIBR::FS_TimeStamp(BYTE *buf)
|
||||
dp = (DWORD*)&buf[i];
|
||||
nKey = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pFcb = (Human68k::fcb_t*)&buf[i];
|
||||
i += sizeof(Human68k::fcb_t);
|
||||
|
||||
@ -5689,10 +5699,10 @@ void FASTCALL SCSIBR::FS_CtrlDrive(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
pCtrlDrive = (Human68k::ctrldrive_t*)&buf[i];
|
||||
i += sizeof(Human68k::ctrldrive_t);
|
||||
|
||||
|
||||
fsresult = fs->CtrlDrive(nUnit, pCtrlDrive);
|
||||
|
||||
memcpy(fsout, pCtrlDrive, sizeof(Human68k::ctrldrive_t));
|
||||
@ -5719,7 +5729,7 @@ void FASTCALL SCSIBR::FS_GetDPB(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
fsresult = fs->GetDPB(nUnit, &dpb);
|
||||
|
||||
dpb.sector_size = htons(dpb.sector_size);
|
||||
@ -5762,7 +5772,7 @@ void FASTCALL SCSIBR::FS_DiskRead(BYTE *buf)
|
||||
dp = (DWORD*)&buf[i];
|
||||
nSize = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
fsresult = fs->DiskRead(nUnit, fsout, nSector, nSize);
|
||||
fsoutlen = 0x200;
|
||||
}
|
||||
@ -5786,7 +5796,7 @@ void FASTCALL SCSIBR::FS_DiskWrite(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
fsresult = fs->DiskWrite(nUnit);
|
||||
}
|
||||
|
||||
@ -5863,7 +5873,7 @@ void FASTCALL SCSIBR::FS_Flush(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
fsresult = fs->Flush(nUnit);
|
||||
}
|
||||
|
||||
@ -5886,7 +5896,7 @@ void FASTCALL SCSIBR::FS_CheckMedia(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
fsresult = fs->CheckMedia(nUnit);
|
||||
}
|
||||
|
||||
@ -5909,7 +5919,7 @@ void FASTCALL SCSIBR::FS_Lock(BYTE *buf)
|
||||
dp = (DWORD*)buf;
|
||||
nUnit = ntohl(*dp);
|
||||
i += sizeof(DWORD);
|
||||
|
||||
|
||||
fsresult = fs->Lock(nUnit);
|
||||
}
|
||||
|
||||
@ -6474,13 +6484,7 @@ void FASTCALL SASIDEV::Command()
|
||||
#ifdef RASCSI
|
||||
// Command reception handshake (10 bytes are automatically received at the first command)
|
||||
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 (count == 0) {
|
||||
Error();
|
||||
@ -6668,8 +6672,8 @@ void FASTCALL SASIDEV::Status()
|
||||
|
||||
#ifndef RASCSI
|
||||
// Request status
|
||||
// ctrl.bus->SetDAT(ctrl.buffer[0]);
|
||||
// ctrl.bus->SetREQ(TRUE);
|
||||
ctrl.bus->SetDAT(ctrl.buffer[0]);
|
||||
ctrl.bus->SetREQ(TRUE);
|
||||
|
||||
#if defined(DISK_LOG)
|
||||
Log(Log::Normal, "Status Phase $%02X", ctrl.status);
|
||||
@ -7302,7 +7306,7 @@ void FASTCALL SASIDEV::CmdAssign()
|
||||
return;
|
||||
}
|
||||
|
||||
// 4Request 4 bytes of data
|
||||
// Request 4 bytes of data
|
||||
ctrl.length = 4;
|
||||
|
||||
// Write phase
|
||||
@ -7712,14 +7716,7 @@ BOOL FASTCALL SASIDEV::XferIn(BYTE *buf)
|
||||
// Read from disk
|
||||
ctrl.length = ctrl.unit[lun]->Read(buf, 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 (ctrl.length <= 0) {
|
||||
// Cancel data-in
|
||||
@ -7860,12 +7857,13 @@ void FASTCALL SASIDEV::FlushUnit()
|
||||
}
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DISK_LOG
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Get the current phase as a string
|
||||
@ -7913,11 +7911,13 @@ void SASIDEV::GetPhaseStr(char *str)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Log output
|
||||
//
|
||||
// TODO: This function needs some cleanup. Its very kludgey
|
||||
//---------------------------------------------------------------------------
|
||||
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 // RASCSI
|
||||
|
||||
#ifdef DISK_LOG
|
||||
// format
|
||||
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);
|
||||
#endif // RASCSI
|
||||
#endif // BAREMETAL
|
||||
#endif // DISK_LOG
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
@ -8029,7 +8031,6 @@ void FASTCALL SCSIDEV::Reset()
|
||||
BUS::phase_t FASTCALL SCSIDEV::Process()
|
||||
{
|
||||
ASSERT(this);
|
||||
//** printf("SCSIDEV::Process() %d\n", ctrl.id);
|
||||
|
||||
// Do nothing if not connected
|
||||
if (ctrl.id < 0 || ctrl.bus == NULL) {
|
||||
@ -8590,13 +8591,6 @@ void FASTCALL SCSIDEV::CmdModeSense()
|
||||
Log(Log::Normal, "MODE SENSE Command ");
|
||||
#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
|
||||
lun = (ctrl.cmd[1] >> 5) & 0x07;
|
||||
if (!ctrl.unit[lun]) {
|
||||
|
@ -229,8 +229,6 @@ public:
|
||||
// NULL check
|
||||
BOOL FASTCALL IsSASI() const;
|
||||
// SASI Check
|
||||
virtual BOOL FASTCALL IsMonitor() const {return FALSE;}
|
||||
// Check if this is a monitor device
|
||||
|
||||
// Media Operations
|
||||
virtual BOOL FASTCALL Open(const Filepath& path, BOOL attn = TRUE);
|
||||
@ -922,8 +920,10 @@ public:
|
||||
// Other
|
||||
BUS::phase_t FASTCALL GetPhase() {return ctrl.phase;}
|
||||
// Get the phase
|
||||
|
||||
#ifdef DISK_LOG
|
||||
// Function to get the current phase as a String.
|
||||
void FASTCALL GetPhaseStr(char *str);
|
||||
#endif
|
||||
|
||||
int FASTCALL GetID() {return ctrl.id;}
|
||||
// Get the ID
|
||||
@ -935,8 +935,6 @@ public:
|
||||
// SASI Check
|
||||
virtual BOOL FASTCALL IsSCSI() const {return FALSE;}
|
||||
// SCSI check
|
||||
virtual BOOL FASTCALL IsMonitor() const {return FALSE;}
|
||||
// Check to see if this is a monitor device
|
||||
Disk* FASTCALL GetBusyUnit();
|
||||
// Get the busy unit
|
||||
|
||||
|
@ -65,7 +65,7 @@ DWORD bcm_host_get_peripheral_address(void)
|
||||
char buf[1024];
|
||||
size_t len = sizeof(buf);
|
||||
DWORD address;
|
||||
|
||||
|
||||
if (sysctlbyname("hw.model", buf, &len, NULL, 0) ||
|
||||
strstr(buf, "ARM1176JZ-S") != buf) {
|
||||
// Failed to get CPU model || Not BCM2835
|
||||
@ -88,7 +88,7 @@ extern uint32_t RPi_IO_Base_Addr;
|
||||
// Core frequency
|
||||
extern uint32_t RPi_Core_Freq;
|
||||
|
||||
#ifdef USE_SEL_EVENT_ENABLE
|
||||
#ifdef USE_SEL_EVENT_ENABLE
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Interrupt control function
|
||||
@ -521,7 +521,7 @@ DWORD FASTCALL GPIOBUS::Aquire()
|
||||
// Invert if negative logic (internal processing is unified to positive logic)
|
||||
signals = ~signals;
|
||||
#endif // SIGNAL_CONTROL_MODE
|
||||
|
||||
|
||||
return signals;
|
||||
}
|
||||
|
||||
@ -552,15 +552,9 @@ BOOL FASTCALL GPIOBUS::GetBSY()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetBSY(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET BSY IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set BSY signal
|
||||
SetSignal(PIN_BSY, ast);
|
||||
}
|
||||
// Set BSY signal
|
||||
SetSignal(PIN_BSY, ast);
|
||||
|
||||
if (actmode == TARGET) {
|
||||
if (ast) {
|
||||
// Turn on ACTIVE signal
|
||||
@ -612,14 +606,8 @@ void FASTCALL GPIOBUS::SetSEL(BOOL ast)
|
||||
SetControl(PIN_ACT, ACT_ON);
|
||||
}
|
||||
|
||||
if (actmode != MONITOR)
|
||||
{
|
||||
// Set SEL signal
|
||||
SetSignal(PIN_SEL, ast);
|
||||
}
|
||||
else{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET SEL IN MONITOR MODE");
|
||||
}
|
||||
// Set SEL signal
|
||||
SetSignal(PIN_SEL, ast);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -639,14 +627,7 @@ BOOL FASTCALL GPIOBUS::GetATN()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetATN(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET ATN IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSignal(PIN_ATN, ast);
|
||||
}
|
||||
SetSignal(PIN_ATN, ast);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -666,14 +647,7 @@ BOOL FASTCALL GPIOBUS::GetACK()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetACK(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET ACK IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSignal(PIN_ACK, ast);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -693,14 +667,7 @@ BOOL FASTCALL GPIOBUS::GetRST()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetRST(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET RST IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSignal(PIN_RST, ast);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -720,13 +687,7 @@ BOOL FASTCALL GPIOBUS::GetMSG()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetMSG(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET MSG IN MONITOR MODE");
|
||||
}
|
||||
else{
|
||||
SetSignal(PIN_MSG, ast);
|
||||
}
|
||||
SetSignal(PIN_MSG, ast);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -746,14 +707,7 @@ BOOL FASTCALL GPIOBUS::GetCD()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetCD(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET CD IN MONITOR MODE");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSignal(PIN_CD, ast);
|
||||
}
|
||||
SetSignal(PIN_CD, ast);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -803,21 +757,6 @@ BOOL FASTCALL GPIOBUS::GetIO()
|
||||
//---------------------------------------------------------------------------
|
||||
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);
|
||||
|
||||
if (actmode == TARGET) {
|
||||
@ -866,12 +805,6 @@ BOOL FASTCALL GPIOBUS::GetREQ()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetREQ(BOOL ast)
|
||||
{
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET REQ IN MONITOR MODE");
|
||||
return;
|
||||
}
|
||||
|
||||
SetSignal(PIN_REQ, ast);
|
||||
}
|
||||
|
||||
@ -905,14 +838,6 @@ BYTE FASTCALL GPIOBUS::GetDAT()
|
||||
//---------------------------------------------------------------------------
|
||||
void FASTCALL GPIOBUS::SetDAT(BYTE dat)
|
||||
{
|
||||
|
||||
|
||||
if(actmode == MONITOR)
|
||||
{
|
||||
printf("WARNING!!! SOMEONE TRIED TO SET Data IN MONITOR MODE");
|
||||
return;
|
||||
}
|
||||
|
||||
// Write to port
|
||||
#if SIGNAL_CONTROL_MODE == 0
|
||||
DWORD fsel;
|
||||
@ -1230,7 +1155,7 @@ int FASTCALL GPIOBUS::SendHandShake(BYTE *buf, int count)
|
||||
}
|
||||
|
||||
// Already waiting for REQ assertion
|
||||
|
||||
|
||||
// Assert the ACK signal
|
||||
SetSignal(PIN_ACK, ON);
|
||||
|
||||
@ -1474,7 +1399,7 @@ void FASTCALL GPIOBUS::SetMode(int pin, int mode)
|
||||
gpio[index] = data;
|
||||
gpfsel[index] = data;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Get input signal value
|
||||
@ -1484,7 +1409,7 @@ BOOL FASTCALL GPIOBUS::GetSignal(int pin)
|
||||
{
|
||||
return (signals >> pin) & 1;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Set output signal value
|
||||
|
@ -79,7 +79,7 @@ void Banner(int argc, char* argv[])
|
||||
FPRT(stdout,"Connect type : %s\n", CONNECT_DESC);
|
||||
|
||||
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,"Usage: %s [-IDn FILE] ...\n\n", argv[0]);
|
||||
FPRT(stdout," n is SCSI identification number(0-7).\n");
|
||||
@ -154,7 +154,7 @@ BOOL Init()
|
||||
|
||||
// GPIOBUS creation
|
||||
bus = new GPIOBUS();
|
||||
|
||||
|
||||
// GPIO Initialization
|
||||
if (!bus->Init()) {
|
||||
return FALSE;
|
||||
@ -207,7 +207,7 @@ void Cleanup()
|
||||
|
||||
// Cleanup the Bus
|
||||
bus->Cleanup();
|
||||
|
||||
|
||||
// Discard the GPIOBUS object
|
||||
delete bus;
|
||||
|
||||
@ -307,7 +307,7 @@ void ListDevice(FILE *fp)
|
||||
FPRT(fp, "No device is installed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FPRT(fp, "+----+----+------+-------------------------------------\n");
|
||||
}
|
||||
|
||||
@ -863,7 +863,7 @@ static void *MonThread(void *param)
|
||||
{
|
||||
struct sched_param schedparam;
|
||||
struct sockaddr_in client;
|
||||
socklen_t len;
|
||||
socklen_t len;
|
||||
int fd;
|
||||
FILE *fp;
|
||||
char buf[BUFSIZ];
|
||||
@ -893,8 +893,8 @@ static void *MonThread(void *param)
|
||||
|
||||
while (1) {
|
||||
// Wait for connection
|
||||
memset(&client, 0, sizeof(client));
|
||||
len = sizeof(client);
|
||||
memset(&client, 0, sizeof(client));
|
||||
len = sizeof(client);
|
||||
fd = accept(monsocket, (struct sockaddr*)&client, &len);
|
||||
if (fd < 0) {
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user