Merge pull request #2840 from zeroZshadow/master

Ignore all writes to BBA_TXFIFOCNT
This commit is contained in:
Ryan Houdek 2015-08-17 10:38:00 -05:00
commit 4baaa3755e
2 changed files with 27 additions and 12 deletions

View File

@ -248,7 +248,7 @@ bool CEXIETHERNET::SendFrame(u8 *frame, u32 size)
OVERLAPPED overlap;
ZeroMemory(&overlap, sizeof(overlap));
//WriteFile will always return false because the TAP handle is async
// WriteFile will always return false because the TAP handle is async
WriteFile(mHAdapter, frame, size, NULL, &overlap);
DWORD res = GetLastError();
@ -304,19 +304,25 @@ bool CEXIETHERNET::RecvStart()
DWORD res = ReadFile(mHAdapter, mRecvBuffer, BBA_RECV_SIZE,
(LPDWORD)&mRecvBufferLength, &mReadOverlapped);
if (!res && (GetLastError() != ERROR_IO_PENDING))
if (res)
{
// error occurred
// Since the read is synchronous here, complete immediately
RecvHandlePacket();
return true;
}
else
{
DWORD err = GetLastError();
if (err == ERROR_IO_PENDING)
{
return true;
}
// Unexpected error
ERROR_LOG(SP1, "Failed to recieve packet with error 0x%X", err);
return false;
}
if (res)
{
// Completed immediately
RecvHandlePacket();
}
return true;
}
void CEXIETHERNET::RecvStop()
@ -326,6 +332,9 @@ void CEXIETHERNET::RecvStop()
UnregisterWaitEx(mHReadWait, INVALID_HANDLE_VALUE);
if (mHRecvEvent != INVALID_HANDLE_VALUE)
{
CloseHandle(mHRecvEvent);
mHRecvEvent = INVALID_HANDLE_VALUE;
}
}

View File

@ -358,6 +358,12 @@ void CEXIETHERNET::MXCommandHandler(u32 data, u32 size)
data &= (data & 0xff) ^ 0xff;
goto write_to_register;
case BBA_TXFIFOCNT:
case BBA_TXFIFOCNT+1:
// Ignore all writes to BBA_TXFIFOCNT
transfer.address += size;
return;
write_to_register:
default:
for (int i = size - 1; i >= 0; i--)