Remember controller

This commit is contained in:
Uwe Seimet 2021-08-22 19:28:12 +02:00
parent e32c2af48c
commit 07da6bfa1c
4 changed files with 6 additions and 22 deletions

View File

@ -131,7 +131,7 @@ void SCSIDaynaPort::Open(const Filepath& path, BOOL attn)
bool SCSIDaynaPort::Dispatch(SCSIDEV *controller)
{
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
ctrl = controller->GetWorkAddr();
if (commands.count(static_cast<SCSIDEV::scsi_command>(ctrl->cmd[0]))) {
command_t *command = commands[static_cast<SCSIDEV::scsi_command>(ctrl->cmd[0])];
@ -525,8 +525,6 @@ void SCSIDaynaPort::CmdRead6(SASIDEV *controller)
{
LOGTRACE("%s",__PRETTY_FUNCTION__);
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
// Get record number and block number
DWORD record = ctrl->cmd[1] & 0x1f;
record <<= 8;
@ -551,8 +549,6 @@ void SCSIDaynaPort::CmdWrite6(SASIDEV *controller)
{
LOGTRACE("%s",__PRETTY_FUNCTION__);
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
// Reallocate buffer (because it is not transfer for each block)
if (ctrl->bufsize < DAYNAPORT_BUFFER_SIZE) {
free(ctrl->buffer);
@ -592,8 +588,6 @@ void SCSIDaynaPort::CmdRetrieveStats(SASIDEV *controller)
{
LOGTRACE("%s",__PRETTY_FUNCTION__);
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
ctrl->length = RetrieveStats(ctrl->cmd, ctrl->buffer);
if (ctrl->length <= 0) {
@ -614,8 +608,6 @@ void SCSIDaynaPort::CmdSetIfaceMode(SASIDEV *controller)
{
LOGTRACE("%s",__PRETTY_FUNCTION__);
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
// Check whether this command is telling us to "Set Interface Mode" or "Set MAC Address"
ctrl->length = RetrieveStats(ctrl->cmd, ctrl->buffer);
@ -639,8 +631,6 @@ void SCSIDaynaPort::CmdSetMcastAddr(SASIDEV *controller)
{
LOGTRACE("%s Set Multicast Address Command ", __PRETTY_FUNCTION__);
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
ctrl->length = (DWORD)ctrl->cmd[4];
// ASSERT(ctrl.length >= 0);
@ -659,8 +649,6 @@ void SCSIDaynaPort::CmdEnableInterface(SASIDEV *controller)
{
LOGTRACE("%s",__PRETTY_FUNCTION__);
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
bool status = EnableInterface(ctrl->cmd);
if (!status) {
// Failure (Error)

View File

@ -51,6 +51,8 @@ private:
} command_t;
std::map<SCSIDEV::scsi_command, command_t*> commands;
SASIDEV::ctrl_t *ctrl;
public:
// Basic Functions
SCSIDaynaPort();

View File

@ -273,7 +273,7 @@ void SCSICD::AddCommand(SCSIDEV::scsi_command opcode, const char* name, void (SC
bool SCSICD::Dispatch(SCSIDEV *controller)
{
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
ctrl = controller->GetWorkAddr();
if (commands.count(static_cast<SCSIDEV::scsi_command>(ctrl->cmd[0]))) {
command_t *command = commands[static_cast<SCSIDEV::scsi_command>(ctrl->cmd[0])];
@ -504,8 +504,6 @@ void SCSICD::OpenPhysical(const Filepath& path)
void SCSICD::CmdReadToc(SASIDEV *controller)
{
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
ctrl->length = ReadToc(ctrl->cmd, ctrl->buffer);
if (ctrl->length <= 0) {
// Failure (Error)
@ -519,8 +517,6 @@ void SCSICD::CmdReadToc(SASIDEV *controller)
void SCSICD::CmdPlayAudio10(SASIDEV *controller)
{
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
// Command processing on drive
bool status = PlayAudio(ctrl->cmd);
if (!status) {
@ -535,8 +531,6 @@ void SCSICD::CmdPlayAudio10(SASIDEV *controller)
void SCSICD::CmdPlayAudioMSF(SASIDEV *controller)
{
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
// Command processing on drive
bool status = PlayAudioMSF(ctrl->cmd);
if (!status) {
@ -551,8 +545,6 @@ void SCSICD::CmdPlayAudioMSF(SASIDEV *controller)
void SCSICD::CmdPlayAudioTrack(SASIDEV *controller)
{
SASIDEV::ctrl_t *ctrl = controller->GetWorkAddr();
// Command processing on drive
bool status = PlayAudioTrack(ctrl->cmd);
if (!status) {

View File

@ -78,6 +78,8 @@ private:
} command_t;
std::map<SCSIDEV::scsi_command, command_t*> commands;
SASIDEV::ctrl_t *ctrl;
public:
// Number of tracks
enum {