.
Fork of WIZnet_Library by
Revision 4:37a5586c4f64, committed 2014-08-20
- Comitter:
- Bongjun
- Date:
- Wed Aug 20 02:17:02 2014 +0000
- Parent:
- 3:48348a6eaa72
- Child:
- 5:89edb39d8707
- Commit message:
- change some code block in W5500.cpp which is related to Sn_RX_RSR, Sn_TX_FSR
Changed in this revision
WIZnetInterface/WIZnet/W5500.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/WIZnetInterface/WIZnet/W5500.cpp Mon Jul 21 05:35:40 2014 +0000 +++ b/WIZnetInterface/WIZnet/W5500.cpp Wed Aug 20 02:17:02 2014 +0000 @@ -189,7 +189,15 @@ t.reset(); t.start(); while(1) { - int size = sreg<uint16_t>(socket, Sn_RX_RSR); + //int size = sreg<uint16_t>(socket, Sn_RX_RSR); + // during the reading Sn_RX_RXR, it has the possible change of this register. + // so read twice and get same value then use size information. + int size, size2; + do { + size = sreg<uint16_t>(socket, Sn_RX_RSR); + size2 = sreg<uint16_t>(socket, Sn_RX_RSR); + } while (size != size2); + if (size > req_size) { return size; } @@ -209,7 +217,15 @@ t.reset(); t.start(); while(1) { - int size = sreg<uint16_t>(socket, Sn_TX_FSR); + //int size = sreg<uint16_t>(socket, Sn_TX_FSR); + // during the reading Sn_TX_FSR, it has the possible change of this register. + // so read twice and get same value then use size information. + int size, size2; + do { + size = sreg<uint16_t>(socket, Sn_TX_FSR); + size2 = sreg<uint16_t>(socket, Sn_TX_FSR); + } while (size != size2); + if (size > req_size) { return size; }