DEV9: Correct implementation of SPD_R_DBUF_STAT reset

This commit is contained in:
TheLastRar 2024-10-15 21:48:25 +01:00 committed by Ty
parent 1bdd53a6c5
commit 3276c0db9c
2 changed files with 12 additions and 8 deletions

View File

@ -688,16 +688,19 @@ void SpeedWrite(u32 addr, u16 value, int width)
case SPD_R_DBUF_STAT:
//DevCon.WriteLn("DEV9: SPD_R_DBUF_STAT %dbit write %x", width, value);
if ((value & SPD_DBUF_RESET_FIFO) != 0)
if ((value & SPD_DBUF_RESET_READ_CNT) != 0)
{
//DevCon.WriteLn("DEV9: SPD_R_DBUF_STAT Reset FIFO");
dev9.fifo_bytes_write = 0;
//DevCon.WriteLn("DEV9: SPD_R_DBUF_STAT Reset read counter");
dev9.fifo_bytes_read = 0;
dev9.xfr_ctrl &= ~SPD_XFR_WRITE; //?
dev9.if_ctrl |= SPD_IF_READ; //?
FIFOIntr();
}
if ((value & SPD_DBUF_RESET_WRITE_CNT) != 0)
{
//DevCon.WriteLn("DEV9: SPD_R_DBUF_STAT Reset write counter");
dev9.fifo_bytes_write = 0;
}
if (value != 0)
FIFOIntr();
if (value != 3)
Console.Error("DEV9: SPD_R_DBUF_STAT 16bit write %x Which != 3!!!", value);

View File

@ -168,7 +168,8 @@ extern int ThreadRun;
#define SPD_DBUF_STAT_FULL (1 << 7)
//HDD->SPEED: both SPD_DBUF_STAT_2 and SPD_DBUF_STAT_FULL set to 1 indicates overflow
//Write
#define SPD_DBUF_RESET_FIFO (1 << 1) //Set SPD_DBUF_STAT_1 & SPD_DBUF_STAT_2, SPD_DBUF_AVAIL set to 0
#define SPD_DBUF_RESET_READ_CNT (1 << 0)
#define SPD_DBUF_RESET_WRITE_CNT (1 << 1)
#define SPD_R_IF_CTRL (SPD_REGBASE + 0x64)
#define SPD_IF_UDMA (1 << 0)