Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of WIZnet_Library by
Diff: WIZnetInterface/WIZnet/W5500.cpp
- Revision:
- 4:37a5586c4f64
- Parent:
- 2:c2eb7a08d7e6
- Child:
- 6:ca8405b9564d
diff -r 48348a6eaa72 -r 37a5586c4f64 WIZnetInterface/WIZnet/W5500.cpp
--- 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;
}
