diff --git a/Ethernet/Socket_APIs_V3.0.2.chm b/Ethernet/Socket_APIs_V3.0.2.chm deleted file mode 100644 index 5ed4b92..0000000 Binary files a/Ethernet/Socket_APIs_V3.0.2.chm and /dev/null differ diff --git a/Ethernet/Socket_APIs_V3.0.3.chm b/Ethernet/Socket_APIs_V3.0.3.chm new file mode 100644 index 0000000..35ed512 Binary files /dev/null and b/Ethernet/Socket_APIs_V3.0.3.chm differ diff --git a/Ethernet/socket.c b/Ethernet/socket.c index 4d16129..b289da4 100644 --- a/Ethernet/socket.c +++ b/Ethernet/socket.c @@ -199,7 +199,9 @@ int8_t close(uint8_t sn) CHECK_SOCKNUM(); //A20160426 : Applied the erratum 1 of W5300 #if (_WIZCHIP_ == 5300) - if( ((getSn_MR(s)& 0x0F) == Sn_MR_TCP) && (getSn_TX_FSR(s) != getSn_TxMAX(s)) ) + //M20160503 : Wrong socket parameter. s -> sn + //if( ((getSn_MR(s)& 0x0F) == Sn_MR_TCP) && (getSn_TX_FSR(s) != getSn_TxMAX(s)) ) + if( ((getSn_MR(sn)& 0x0F) == Sn_MR_TCP) && (getSn_TX_FSR(sn) != getSn_TxMAX(sn)) ) { uint8 destip[4] = {0, 0, 0, 1}; // TODO @@ -209,8 +211,15 @@ int8_t close(uint8_t sn) // ex> wait_1s(); // if (getSn_TX_FSR(s) == getSn_TxMAX(s)) continue; // - socket(s,Sn_MR_UDP,0x3000,0); - sendto(s,destip,1,destip,0x3000); // send the dummy data to an unknown destination(0.0.0.1). + //M20160503 : The socket() of close() calls close() itself again. It occures a infinite loop - close()->socket()->close()->socket()-> ~ + //socket(s,Sn_MR_UDP,0x3000,0); + //sendto(s,destip,1,destip,0x3000); // send the dummy data to an unknown destination(0.0.0.1). + setSn_MR(sn,Sn_MR_UDP); + setSn_PORTR(sn, 0x3000); + setSn_CR(sn,Sn_CR_OPEN); + while(getSn_CR(sn) != 0); + while(getSn_SR(sn) != SOCK_UDP); + sendto(sn,destip,1,destip,0x3000); // send the dummy data to an unknown destination(0.0.0.1). }; #endif setSn_CR(sn,Sn_CR_CLOSE); diff --git a/README.md b/README.md index 5c09e42..e6d130f 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,9 @@ This driver provides the Berkeley Socket type APIs. - Define what Host I/F mode is used in **wizchip_conf.h** ## Revision History + * ioLibrary V3.0.3 Released : 03, May, 2016 + * In W5300, Fixed some compile errors in close(). Refer to M20160503 + * In close(), replace socket() with some command sequences. * ioLibrary V3.0.2 Released : 26, April, 2016 * Applied the erratum #1 in close() of socket.c (Refer to A20160426) * ioLibrary V3.0.1 Released : 15, July, 2015