mirror of
https://github.com/akuker/RASCSI.git
synced 2024-05-29 01:41:27 +00:00
5622694701
* Initial RTC skeleton * Added device info * Added TEST UNIT READY * Fixed command dispatcher * First untested naive implementation * Comment update * Code cleanup * More code cleanup * Updated date/time encoding * Updated versioning * Use standard RaSCSI INQUIRY version for SCRT device * Manpage update * Added shortcut for SCRT type * Added support for rtc "filename" * RTC supports LUNs > 0 * Fixed LUN count * Renaming * Renaming * Manpage update * Initial naive implementation * SCRA is removable * Updated command list * Added controller field * Shut down works, bus free phase is not yet entered * Clear caches on shutdown * Expose BusFree() * Moved code * Logging update * Moved code * Moved code * Added comment * Logging update * Code cleanup * Service device is not removable anymore (was only needed for testing) * Manpage update * Added comment * Comment update * Version update * Renaming * Comment update * Comment update * Renaming * Fixed typo * Added convenience method * Property handling optimization * Code cleanup * Code cleanup * Code cleanup, introduced base class * Added TODO * More code cleanup * Removed unnecessary assignments * Moved code * Removed forward declaration * Added base class * INclude cleanup * Moved scsi_command enum * Fixed warnings * Addressing circular dependencies * Removed duplicate enum * include file cleanup * Include cleanup * Reduced dependencies to Disk class (replaced by Device), fixed TODO * Include cleanup * PrimaryDevice implements ReportLuns * Inheritance update * Removed duplicate code * Moved code to base class * Cleanup * Removed duplicate field * Updated command dispatchign * Comment update * Moved code * Updated method visibilities * Moved MODE SENSE/MODE SELECT base code
94 lines
2.3 KiB
C++
94 lines
2.3 KiB
C++
//---------------------------------------------------------------------------
|
||
//
|
||
// X68000 EMULATOR "XM6"
|
||
//
|
||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||
// Copyright (C) 2014-2020 GIMONS
|
||
//
|
||
// [ SCSI Common Functionality ]
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
|
||
#include "os.h"
|
||
#include "scsi.h"
|
||
|
||
//---------------------------------------------------------------------------
|
||
//
|
||
// Phase Acquisition
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
BUS::phase_t BUS::GetPhase()
|
||
{
|
||
// Selection Phase
|
||
if (GetSEL()) {
|
||
return selection;
|
||
}
|
||
|
||
// Bus busy phase
|
||
if (!GetBSY()) {
|
||
return busfree;
|
||
}
|
||
|
||
// Get target phase from bus signal line
|
||
DWORD mci = GetMSG() ? 0x04 : 0x00;
|
||
mci |= GetCD() ? 0x02 : 0x00;
|
||
mci |= GetIO() ? 0x01 : 0x00;
|
||
return GetPhase(mci);
|
||
}
|
||
|
||
//---------------------------------------------------------------------------
|
||
//
|
||
// Determine Phase String phase enum
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
const char* BUS::GetPhaseStrRaw(phase_t current_phase){
|
||
if(current_phase <= phase_t::reserved){
|
||
return phase_str_table[current_phase];
|
||
}
|
||
else
|
||
{
|
||
return "INVALID";
|
||
}
|
||
}
|
||
|
||
//---------------------------------------------------------------------------
|
||
//
|
||
// Phase Table
|
||
// Reference Table 8: https://www.staff.uni-mainz.de/tacke/scsi/SCSI2-06.html
|
||
// This determines the phase based upon the Msg, C/D and I/O signals.
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
const BUS::phase_t BUS::phase_table[8] = {
|
||
// | MSG|C/D|I/O |
|
||
dataout, // | 0 | 0 | 0 |
|
||
datain, // | 0 | 0 | 1 |
|
||
command, // | 0 | 1 | 0 |
|
||
status, // | 0 | 1 | 1 |
|
||
reserved, // | 1 | 0 | 0 |
|
||
reserved, // | 1 | 0 | 1 |
|
||
msgout, // | 1 | 1 | 0 |
|
||
msgin // | 1 | 1 | 1 |
|
||
};
|
||
|
||
|
||
//---------------------------------------------------------------------------
|
||
//
|
||
// Phase Table
|
||
// This MUST be kept in sync with the phase_t enum type!
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
const char* BUS::phase_str_table[] = {
|
||
"busfree",
|
||
"arbitration",
|
||
"selection",
|
||
"reselection",
|
||
"command",
|
||
"execute",
|
||
"datain",
|
||
"dataout",
|
||
"status",
|
||
"msgin",
|
||
"msgout",
|
||
"reserved"
|
||
};
|