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.
Diff: WIZnetInterface/WIZnet/W5100.cpp
- Revision:
- 8:cb8808b47e69
- Parent:
- 1:8138a268fbd2
diff -r 7c67a8922ec5 -r cb8808b47e69 WIZnetInterface/WIZnet/W5100.cpp
--- a/WIZnetInterface/WIZnet/W5100.cpp Sun May 31 10:06:41 2015 +0000
+++ b/WIZnetInterface/WIZnet/W5100.cpp Sun May 31 10:25:40 2015 +0000
@@ -140,6 +140,18 @@
return false;
}
+
+bool WIZnet_Chip::is_fin_received(int socket)
+{
+ uint8_t tmpSn_SR;
+ tmpSn_SR = sreg<uint8_t>(socket, Sn_SR);
+ // packet sending is possible, when state is SOCK_CLOSE_WAIT.
+ if (tmpSn_SR == SOCK_CLOSE_WAIT) {
+ return true;
+ }
+ return false;
+}
+
void WIZnet_Chip::reset()
{
reset_pin = 1;
@@ -202,7 +214,14 @@
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;
}