Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve OpenVMS/VAX compatibility (issue #1117) #1123

Merged
merged 4 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cpp/devices/disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
// 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
Expand Down
3 changes: 2 additions & 1 deletion cpp/test/mocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2022 Uwe Seimet
// Copyright (C) 2022-2023 Uwe Seimet
//
//---------------------------------------------------------------------------

Expand Down Expand Up @@ -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
{
FRIEND_TEST(ScsiHdNecTest, SetUpModePages);
FRIEND_TEST(ScsiHdNecTest, TestAddErrorPage);
FRIEND_TEST(ScsiHdNecTest, TestAddFormatPage);
FRIEND_TEST(ScsiHdNecTest, TestAddDrivePage);
FRIEND_TEST(PiscsiExecutorTest, ProcessDeviceCmd);
Expand Down
16 changes: 15 additions & 1 deletion cpp/test/scsihd_nec_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SCSI Target Emulator PiSCSI
// for Raspberry Pi
//
// Copyright (C) 2022 Uwe Seimet
// Copyright (C) 2022-2023 Uwe Seimet
//
//---------------------------------------------------------------------------

Expand Down Expand Up @@ -47,6 +47,20 @@ TEST(ScsiHdNecTest, SetUpModePages)
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)
{
map<int, vector<byte>> pages;
Expand Down