MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / HDDWriteFIFO

Function HDDWriteFIFO

pcsx2/DEV9/DEV9.cpp:233–258  ·  view source on GitHub ↗

SPEED <-> HDD FIFO

Source from the content-addressed store, hash-verified

231
232// SPEED <-> HDD FIFO
233void HDDWriteFIFO()
234{
235 pxAssert(dev9.ata->dmaReady && (dev9.if_ctrl & SPD_IF_ATA_DMAEN));
236 pxAssert((dev9.if_ctrl & SPD_IF_READ));
237
238 const int unread = (dev9.fifo_bytes_write - dev9.fifo_bytes_read);
239 const int space = (SPD_DBUF_AVAIL_MAX * 512 - unread);
240 const int base = dev9.fifo_bytes_write % (SPD_DBUF_AVAIL_MAX * 512);
241
242 pxAssert(unread <= SPD_DBUF_AVAIL_MAX * 512);
243
244 int read;
245 if (base + space > SPD_DBUF_AVAIL_MAX * 512)
246 {
247 const int was = SPD_DBUF_AVAIL_MAX * 512 - base;
248 read = dev9.ata->ReadDMAToFIFO(dev9.fifo + base, was);
249 if (read == was)
250 read += dev9.ata->ReadDMAToFIFO(dev9.fifo, space - was);
251 }
252 else
253 {
254 read = dev9.ata->ReadDMAToFIFO(dev9.fifo + base, space);
255 }
256
257 dev9.fifo_bytes_write += read;
258}
259void HDDReadFIFO()
260{
261 pxAssert(dev9.ata->dmaReady && (dev9.if_ctrl & SPD_IF_ATA_DMAEN));

Callers 1

DEV9runFIFOFunction · 0.85

Calls 1

ReadDMAToFIFOMethod · 0.80

Tested by

no test coverage detected