aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRSDuck <RSDuck@users.noreply.github.com>2021-01-09 18:31:12 +0100
committerRSDuck <RSDuck@users.noreply.github.com>2021-01-09 18:31:12 +0100
commitc4753723722790715aa799160041041cb37b6992 (patch)
tree440bfa7f4eeab6f8c3f7f628daee09596a48d37b
parent7081c2de65ded60fb59b44009a5b5a07201f6fcb (diff)
mask off upper bits when incrementing RX addr
fixes #931
-rw-r--r--src/Wifi.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/Wifi.cpp b/src/Wifi.cpp
index 4502f18..e00f72b 100644
--- a/src/Wifi.cpp
+++ b/src/Wifi.cpp
@@ -791,22 +791,15 @@ bool ProcessTX(TXSlot* slot, int num)
}
-inline void IncrementRXAddr(u16& addr, u16 inc)
+inline void IncrementRXAddr(u16& addr, u16 inc = 2)
{
addr += inc;
+ addr &= 0x1FFE;
if (addr >= (IOPORT(W_RXBufEnd) & 0x1FFE))
{
addr -= (IOPORT(W_RXBufEnd) & 0x1FFE);
addr += (IOPORT(W_RXBufBegin) & 0x1FFE);
- }
-}
-
-inline void IncrementRXAddr(u16& addr)
-{
- addr += 2;
- if (addr == (IOPORT(W_RXBufEnd) & 0x1FFE))
- {
- addr = (IOPORT(W_RXBufBegin) & 0x1FFE);
+ addr &= 0x1FFE;
}
}