diff options
author | RSDuck <RSDuck@users.noreply.github.com> | 2021-01-09 18:31:12 +0100 |
---|---|---|
committer | RSDuck <RSDuck@users.noreply.github.com> | 2021-01-09 18:31:12 +0100 |
commit | c4753723722790715aa799160041041cb37b6992 (patch) | |
tree | 440bfa7f4eeab6f8c3f7f628daee09596a48d37b | |
parent | 7081c2de65ded60fb59b44009a5b5a07201f6fcb (diff) |
mask off upper bits when incrementing RX addr
fixes #931
-rw-r--r-- | src/Wifi.cpp | 13 |
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; } } |