mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-03 12:30:08 +00:00
sc53c94: Split real_dma_xfer.
Create real_dma_xfer_out and real_dma_xfer_in methods.
This commit is contained in:
parent
bc5153dd4a
commit
e1e00c951b
@ -632,15 +632,13 @@ bool Sc53C94::rcv_data()
|
||||
return true;
|
||||
}
|
||||
|
||||
void Sc53C94::real_dma_xfer(int direction)
|
||||
void Sc53C94::real_dma_xfer_out()
|
||||
{
|
||||
bool is_done = false;
|
||||
|
||||
if (direction) {
|
||||
uint32_t got_bytes;
|
||||
uint8_t* src_ptr;
|
||||
// transfer data from host's memory to target
|
||||
|
||||
while (this->xfer_count) {
|
||||
uint32_t got_bytes;
|
||||
uint8_t* src_ptr;
|
||||
this->dma_ch->pull_data(std::min((int)this->xfer_count, DATA_FIFO_MAX),
|
||||
&got_bytes, &src_ptr);
|
||||
std::memcpy(this->data_fifo, src_ptr, got_bytes);
|
||||
@ -650,13 +648,19 @@ void Sc53C94::real_dma_xfer(int direction)
|
||||
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();
|
||||
}
|
||||
}
|
||||
} else { // transfer data from target to host's memory
|
||||
}
|
||||
|
||||
void Sc53C94::real_dma_xfer_in()
|
||||
{
|
||||
bool is_done = false;
|
||||
|
||||
// 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);
|
||||
@ -677,7 +681,6 @@ void Sc53C94::real_dma_xfer(int direction)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static const DeviceDescription Sc53C94_Descriptor = {
|
||||
Sc53C94::create, {}, {}
|
||||
|
@ -207,7 +207,8 @@ public:
|
||||
void pseudo_dma_write(uint16_t data);
|
||||
|
||||
// real DMA control
|
||||
void real_dma_xfer(int direction);
|
||||
void real_dma_xfer_out();
|
||||
void real_dma_xfer_in();
|
||||
|
||||
void set_dma_channel(DmaBidirChannel *dma_ch) {
|
||||
this->dma_ch = dma_ch;
|
||||
|
@ -384,7 +384,10 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size)
|
||||
}
|
||||
if (value & 2) { // RUN bit set?
|
||||
this->curio_dma->reinit(this->scsi_dma_base);
|
||||
this->scsi->real_dma_xfer((value >> 6) & 1);
|
||||
if (value & (1 << 6))
|
||||
this->scsi->real_dma_xfer_out();
|
||||
else
|
||||
this->scsi->real_dma_xfer_in();
|
||||
}
|
||||
this->curio_dma->write_ctrl(value);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user