mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-01 19:41:48 +00:00
2beb78727f
* Added support for new interfaces syntax * rasctl output update * Added operation parameters * Fixed typo * Manpage update * Added deprecation warning * Moved parser * Updated parser * Updated parameter override * Removed debug code * Made netmask handling more flexible * Updated logging * Logging update * Logging update * Comment update * Removed unused field * Replaced BOOL by bool * Moved code * Logging update * Removed useless comments * Added TODZ * Logging update * Logging update * Logging update * No need to report that an error is an error twice * Removed duplicate logging * Updated error handling * Updated error handling * Fixed typo * Removed magic constant * Fixed 32 bit platform issue * Signature update * Fixed message string * Comment update * Fixed SCSI command opcode * Updated StopPrint * Logging update * Removed obsolete casts * Renaming * Removed duplicate logging * Updated flushing caches * Added FlushCache() method * Reduced visibility * Reduced visibility * Reduced visibility * Code cleanup, removed useless comments * Removed useless comments * Updated error handling * Removed duplicate code * Manpage update
100 lines
2.4 KiB
C++
100 lines
2.4 KiB
C++
//---------------------------------------------------------------------------
|
||
//
|
||
// SCSI Target Emulator RaSCSI (*^..^*)
|
||
// 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 device controller ]
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
#pragma once
|
||
|
||
#include "controllers/sasidev_ctrl.h"
|
||
#include <map>
|
||
|
||
//===========================================================================
|
||
//
|
||
// SCSI Device (Interits SASI device)
|
||
//
|
||
//===========================================================================
|
||
class SCSIDEV : public SASIDEV
|
||
{
|
||
public:
|
||
|
||
enum rascsi_shutdown_mode {
|
||
NONE,
|
||
RASCSI,
|
||
PI
|
||
};
|
||
|
||
// Internal data definition
|
||
typedef struct {
|
||
// Synchronous transfer
|
||
BOOL syncenable; // Synchronous transfer possible
|
||
int syncperiod; // Synchronous transfer period
|
||
int syncoffset; // Synchronous transfer offset
|
||
int syncack; // Number of synchronous transfer ACKs
|
||
|
||
// ATN message
|
||
bool atnmsg;
|
||
int msc;
|
||
BYTE msb[256];
|
||
|
||
// -1 means that the initiator ID is unknown, e.g. with Atari ACSI and old host adapters
|
||
int initiator_id;
|
||
|
||
bool is_byte_transfer;
|
||
uint32_t bytes_to_transfer;
|
||
} scsi_t;
|
||
|
||
SCSIDEV();
|
||
~SCSIDEV();
|
||
|
||
void Reset() override;
|
||
|
||
BUS::phase_t Process(int) override;
|
||
|
||
void Receive() override;
|
||
|
||
bool IsSASI() const override { return false; }
|
||
bool IsSCSI() const override { return true; }
|
||
|
||
// Common error handling
|
||
void Error(ERROR_CODES::sense_key sense_key = ERROR_CODES::sense_key::NO_SENSE,
|
||
ERROR_CODES::asc asc = ERROR_CODES::asc::NO_ADDITIONAL_SENSE_INFORMATION,
|
||
ERROR_CODES::status status = ERROR_CODES::status::CHECK_CONDITION) override;
|
||
|
||
void ScheduleShutDown(rascsi_shutdown_mode shutdown_mode) { this->shutdown_mode = shutdown_mode; }
|
||
|
||
int GetInitiatorId() const { return scsi.initiator_id; }
|
||
bool IsByteTransfer() const { return scsi.is_byte_transfer; }
|
||
void SetByteTransfer(bool is_byte_transfer) { scsi.is_byte_transfer = is_byte_transfer; }
|
||
|
||
private:
|
||
typedef SASIDEV super;
|
||
|
||
// Phases
|
||
void BusFree() override;
|
||
void Selection() override;
|
||
void Execute() override;
|
||
void MsgOut();
|
||
|
||
// Data transfer
|
||
void Send() override;
|
||
bool XferMsg(int);
|
||
bool XferOut(bool);
|
||
void ReceiveBytes();
|
||
|
||
// Internal data
|
||
scsi_t scsi;
|
||
|
||
rascsi_shutdown_mode shutdown_mode;
|
||
};
|
||
|