mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-11 20:29:46 +00:00
sc3c94: implement real DMA.
This commit is contained in:
parent
ca5f81417f
commit
a00b87790b
@ -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, {}, {}
|
||||
};
|
||||
|
@ -29,6 +29,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#ifndef SC_53C94_H
|
||||
#define SC_53C94_H
|
||||
|
||||
#include <devices/common/dmacore.h>
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/common/hwinterrupt.h>
|
||||
|
||||
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user