RASCSI/cpp/devices/scsihd_nec.h
Daniel Markstedt 08194af424
Move C++ code into cpp/ dir (#941)
- Moved C++ code to cpp/ from src/raspberrypi
- Related updates to Makefile, easyinstall.sh, and the github build rules
- Removed the native X68k C code in src/x68k from the repo
2022-10-25 12:59:30 -07:00

65 lines
1.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//---------------------------------------------------------------------------
//
// SCSI Target Emulator RaSCSI Reloaded
// for Raspberry Pi
//
// Copyright (C) 2001-2006 (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 Compatible 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 compatible / 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 array<char, 512>&, int);
static int GetInt16LittleEndian(const BYTE *);
static int GetInt32LittleEndian(const BYTE *);
static const unordered_set<uint32_t> sector_sizes;
// Image file offset
off_t image_offset = 0;
// Geometry data
int cylinders = 0;
int heads = 0;
int sectors = 0;
};