diff --git a/devices/common/scsi/sc53c94.cpp b/devices/common/scsi/sc53c94.cpp
index 2f73156..cf6db9c 100644
--- a/devices/common/scsi/sc53c94.cpp
+++ b/devices/common/scsi/sc53c94.cpp
@@ -602,6 +602,35 @@ bool Sc53C94::rcv_data()
return true;
}
+void Sc53C94::real_dma_xfer(int direction)
+{
+ bool is_done = false;
+
+ if (direction) {
+ ABORT_F("Sc53C94: real DMA transfers from host to target not implemented yet");
+ } else { // transfer data from target to host's memory
+ while (this->xfer_count) {
+ if (this->data_fifo_pos) {
+ this->dma_ch->push_data((char*)this->data_fifo, this->data_fifo_pos);
+
+ this->xfer_count -= this->data_fifo_pos;
+ this->data_fifo_pos = 0;
+ if (!this->xfer_count) {
+ is_done = true;
+ this->status |= STAT_TC; // signal zero transfer count
+ this->cur_state = SeqState::XFER_END;
+ this->sequencer();
+ }
+ }
+
+ // see if we need to refill FIFO
+ if (!this->data_fifo_pos && !is_done) {
+ this->sequencer();
+ }
+ }
+ }
+}
+
static const DeviceDescription Sc53C94_Descriptor = {
Sc53C94::create, {}, {}
};
diff --git a/devices/common/scsi/sc53c94.h b/devices/common/scsi/sc53c94.h
index 1f16064..ed95b3b 100644
--- a/devices/common/scsi/sc53c94.h
+++ b/devices/common/scsi/sc53c94.h
@@ -29,6 +29,7 @@ along with this program. If not, see .
#ifndef SC_53C94_H
#define SC_53C94_H
+#include
#include
#include
@@ -160,6 +161,13 @@ public:
void write(uint8_t reg_offset, uint8_t value);
uint16_t pseudo_dma_read();
+ // real DMA control
+ void real_dma_xfer(int direction);
+
+ void set_dma_channel(DmaBidirChannel *dma_ch) {
+ this->dma_ch = dma_ch;
+ };
+
// ScsiDevice methods
void notify(ScsiBus* bus_obj, ScsiMsg msg_type, int param);
bool prepare_data() { return false; };
@@ -220,6 +228,9 @@ private:
InterruptCtrl* int_ctrl = nullptr;
uint32_t irq_id = 0;
uint8_t irq = 0;
+
+ // DMA related stuff
+ DmaBidirChannel* dma_ch;
};
#endif // SC_53C94_H