mirror of https://github.com/akuker/RASCSI.git
* Set TB, PER and DTE bits in read/write error recovery page * Fixed typo * Added unit test * Comment update
This commit is contained in:
parent
b6cc6a23af
commit
ef6cd97656
|
@ -396,7 +396,12 @@ void Disk::SetUpModePages(map<int, vector<byte>>& pages, int page, bool changeab
|
||||||
void Disk::AddErrorPage(map<int, vector<byte>>& pages, bool) const
|
void Disk::AddErrorPage(map<int, vector<byte>>& pages, bool) const
|
||||||
{
|
{
|
||||||
// Retry count is 0, limit time uses internal default value
|
// Retry count is 0, limit time uses internal default value
|
||||||
pages[1] = vector<byte>(12);
|
vector<byte> buf(12);
|
||||||
|
|
||||||
|
// TB, PER, DTE (required for OpenVMS/VAX compatibility, see issue #1117)
|
||||||
|
buf[2] = (byte)0x26;
|
||||||
|
|
||||||
|
pages[1] = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Disk::AddFormatPage(map<int, vector<byte>>& pages, bool changeable) const
|
void Disk::AddFormatPage(map<int, vector<byte>>& pages, bool changeable) const
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SCSI Target Emulator PiSCSI
|
// SCSI Target Emulator PiSCSI
|
||||||
// for Raspberry Pi
|
// for Raspberry Pi
|
||||||
//
|
//
|
||||||
// Copyright (C) 2022 Uwe Seimet
|
// Copyright (C) 2022-2023 Uwe Seimet
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -358,6 +358,7 @@ class MockSCSIHD : public SCSIHD //NOSONAR Ignore inheritance hierarchy depth in
|
||||||
class MockSCSIHD_NEC : public SCSIHD_NEC //NOSONAR Ignore inheritance hierarchy depth in unit tests
|
class MockSCSIHD_NEC : public SCSIHD_NEC //NOSONAR Ignore inheritance hierarchy depth in unit tests
|
||||||
{
|
{
|
||||||
FRIEND_TEST(ScsiHdNecTest, SetUpModePages);
|
FRIEND_TEST(ScsiHdNecTest, SetUpModePages);
|
||||||
|
FRIEND_TEST(ScsiHdNecTest, TestAddErrorPage);
|
||||||
FRIEND_TEST(ScsiHdNecTest, TestAddFormatPage);
|
FRIEND_TEST(ScsiHdNecTest, TestAddFormatPage);
|
||||||
FRIEND_TEST(ScsiHdNecTest, TestAddDrivePage);
|
FRIEND_TEST(ScsiHdNecTest, TestAddDrivePage);
|
||||||
FRIEND_TEST(PiscsiExecutorTest, ProcessDeviceCmd);
|
FRIEND_TEST(PiscsiExecutorTest, ProcessDeviceCmd);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// SCSI Target Emulator PiSCSI
|
// SCSI Target Emulator PiSCSI
|
||||||
// for Raspberry Pi
|
// for Raspberry Pi
|
||||||
//
|
//
|
||||||
// Copyright (C) 2022 Uwe Seimet
|
// Copyright (C) 2022-2023 Uwe Seimet
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -47,6 +47,20 @@ TEST(ScsiHdNecTest, SetUpModePages)
|
||||||
ScsiHdNecTest_SetUpModePages(pages);
|
ScsiHdNecTest_SetUpModePages(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(ScsiHdNecTest, TestAddErrorPage)
|
||||||
|
{
|
||||||
|
map<int, vector<byte>> pages;
|
||||||
|
MockSCSIHD_NEC hd(0);
|
||||||
|
|
||||||
|
hd.SetBlockCount(0x1234);
|
||||||
|
hd.SetReady(true);
|
||||||
|
// Non changeable
|
||||||
|
hd.SetUpModePages(pages, 0x01, false);
|
||||||
|
EXPECT_EQ(1, pages.size()) << "Unexpected number of mode pages";
|
||||||
|
const vector<byte>& page_1 = pages[1];
|
||||||
|
EXPECT_EQ(0x26, to_integer<int>(page_1[2]));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(ScsiHdNecTest, TestAddFormatPage)
|
TEST(ScsiHdNecTest, TestAddFormatPage)
|
||||||
{
|
{
|
||||||
map<int, vector<byte>> pages;
|
map<int, vector<byte>> pages;
|
||||||
|
|
Loading…
Reference in New Issue