RASCSI/src/raspberrypi/monitor/data_sample.cpp
Uwe Seimet ca23d9b7a3
Merged FileSupport into Disk, improved granularity, more unit tests, code cleanup (#897)
* Merged FileSupport into Disk

* Improved code granularity

* Made classes previously directly writing to cout testable

* Added numerous unit tests

* Fixed minor issues uncovered by unit tests
 
* Fixed SonarCloud issues

* Replaced remaining proprietary data types (WORD/DWORD) except for files in hal/
2022-10-08 19:26:04 +02:00

40 lines
856 B
C++

//---------------------------------------------------------------------------
//
// SCSI Target Emulator RaSCSI Reloaded
// for Raspberry Pi
//
// Copyright (C) 2020-2021 akuker
//
// [ SCSI Bus Monitor ]
//
//---------------------------------------------------------------------------
#include "os.h"
#include "scsi.h"
#include "data_sample.h"
const char *GetPhaseStr(const data_capture *sample)
{
return BUS::GetPhaseStrRaw(GetPhase(sample));
}
BUS::phase_t GetPhase(const data_capture *sample)
{
// Selection Phase
if (GetSel(sample))
{
return BUS::phase_t::selection;
}
// Bus busy phase
if (!GetBsy(sample))
{
return BUS::phase_t::busfree;
}
// Get target phase from bus signal line
uint32_t mci = GetMsg(sample) ? 0x04 : 0x00;
mci |= GetCd(sample) ? 0x02 : 0x00;
mci |= GetIo(sample) ? 0x01 : 0x00;
return BUS::GetPhase(mci);
}