mirror of
https://github.com/akuker/RASCSI.git
synced 2024-09-25 02:55:00 +00:00
f3553c5480
* Resolved issues 772, 827, 909 * Added numerous unit tests * Code cleanup * Improved type safety by using PbDeviceType instead of string * Do not flush cache on failed STOP UNIT * Error message and error handling updates * Removed duplicate code * Use map for mapping shift counts * Reject read/write access if the drive has 0 sectors * Updated logging configuration for tests
65 lines
1.6 KiB
C++
65 lines
1.6 KiB
C++
//---------------------------------------------------------------------------
|
||
//
|
||
// SCSI Target Emulator RaSCSI Reloaded
|
||
// for Raspberry Pi
|
||
//
|
||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||
// Copyright (C) 2014-2020 GIMONS
|
||
// Copyright (C) akuker
|
||
//
|
||
// Licensed under the BSD 3-Clause License.
|
||
// See LICENSE file in the project root folder.
|
||
//
|
||
// [ SCSI NEC "Genuine" Hard Disk]
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
|
||
#pragma once
|
||
|
||
#include "scsihd.h"
|
||
#include <unordered_set>
|
||
#include <map>
|
||
#include <array>
|
||
#include <vector>
|
||
|
||
using namespace std;
|
||
|
||
//===========================================================================
|
||
//
|
||
// SCSI hard disk (PC-9801-55 NEC genuine / Anex86 / T98Next)
|
||
//
|
||
//===========================================================================
|
||
class SCSIHD_NEC : public SCSIHD //NOSONAR The inheritance hierarchy depth is acceptable in this case
|
||
{
|
||
public:
|
||
|
||
explicit SCSIHD_NEC(int lun) : SCSIHD(lun, sector_sizes, false) {}
|
||
~SCSIHD_NEC() override = default;
|
||
|
||
void Open() override;
|
||
|
||
protected:
|
||
|
||
vector<byte> InquiryInternal() const override;
|
||
|
||
void AddFormatPage(map<int, vector<byte>>&, bool) const override;
|
||
void AddDrivePage(map<int, vector<byte>>&, bool) const override;
|
||
|
||
private:
|
||
|
||
pair<int, int> SetParameters(const string&, const array<BYTE, 512>&, int);
|
||
|
||
static int GetInt16LittleEndian(const BYTE *);
|
||
static int GetInt32LittleEndian(const BYTE *);
|
||
|
||
static const unordered_set<uint32_t> sector_sizes;
|
||
|
||
// Image file offset (NEC only)
|
||
off_t image_offset = 0;
|
||
|
||
// Geometry data
|
||
int cylinders = 0;
|
||
int heads = 0;
|
||
int sectors = 0;
|
||
};
|