From c54c1cdb654f493db6318a4f4ee6acc7bbec9219 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Tue, 1 Nov 2022 02:11:06 +0100 Subject: [PATCH] Sc53C94: improve status register. --- devices/common/scsi/sc53c94.cpp | 5 +++-- devices/common/scsi/sc53c94.h | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/devices/common/scsi/sc53c94.cpp b/devices/common/scsi/sc53c94.cpp index 1073727..cef2b52 100644 --- a/devices/common/scsi/sc53c94.cpp +++ b/devices/common/scsi/sc53c94.cpp @@ -168,6 +168,7 @@ uint16_t Sc53C94::pseudo_dma_read() this->xfer_count -= 2; if (!this->xfer_count) { is_done = true; + this->status |= STAT_TC; // signal zero transfer count this->cur_state = SeqState::XFER_END; this->sequencer(); } @@ -206,7 +207,7 @@ void Sc53C94::update_command_reg(uint8_t cmd) } } else { LOG_F(ERROR, "SC53C94: the top of the command FIFO overwritten!"); - this->status |= 0x40; // signal IOE/Gross Error + this->status |= STAT_GE; // signal IOE/Gross Error } } @@ -312,7 +313,7 @@ void Sc53C94::fifo_push(const uint8_t data) this->data_fifo[this->data_fifo_pos++] = data; } else { LOG_F(ERROR, "SC53C94: data FIFO overflow!"); - this->status |= 0x40; // signal IOE/Gross Error + this->status |= STAT_GE; // signal IOE/Gross Error } } diff --git a/devices/common/scsi/sc53c94.h b/devices/common/scsi/sc53c94.h index 095de73..57dfb07 100644 --- a/devices/common/scsi/sc53c94.h +++ b/devices/common/scsi/sc53c94.h @@ -90,6 +90,12 @@ enum { CMD_ENA_SEL_RESEL = 0x44, }; +/** Status register bits. **/ +enum { + STAT_TC = 1 << 4, // Terminal count (NCR) / count to zero (AMD) + STAT_GE = 1 << 6, // Gross Error (NCR) / Illegal Operation Error (AMD) +}; + /** Interrupt status register bits. */ enum { INTSTAT_SRST = 0x80, // bus reset