Compare commits
21 Commits
W5500_PHY_
...
revert-51-
Author | SHA1 | Date | |
---|---|---|---|
b8e3c63cff | |||
8ebd860b08 | |||
aaaf41eff1 | |||
433f4bb409 | |||
18c878db9c | |||
e20beebfc2 | |||
7bac9a1f99 | |||
74bf44ddc0 | |||
879b8a1828 | |||
01d6b321bc | |||
1c6b068fa0 | |||
2166370f1d | |||
556bee8d4a | |||
a8b1f0a05c | |||
640eb5a863 | |||
e3855b86e8 | |||
81d0d9d981 | |||
d96daf13f0 | |||
47b6ea8bf7 | |||
4ddea28229 | |||
fdeac309b6 |
@ -1988,7 +1988,7 @@ uint8_t getRMSR(uint8_t sn);
|
||||
* @return uint16_t. Variable of @ref Sn_PORTR.
|
||||
* @sa setSn_PORTR()
|
||||
*/
|
||||
#define getSn_PORTR(sn, port) \
|
||||
#define getSn_PORTR(sn) \
|
||||
WIZCHIP_READ(Sn_PORTR(sn))
|
||||
#define getSn_PORT(sn) getSn_PORTR(sn) ///< For compatible ioLibrary
|
||||
|
||||
|
@ -910,7 +910,7 @@ int8_t getsockopt(uint8_t sn, sockopt_type sotype, void* arg)
|
||||
*(uint8_t*) arg = getSn_SR(sn);
|
||||
break;
|
||||
case SO_REMAINSIZE:
|
||||
if(getSn_MR(sn) == Sn_MR_TCP)
|
||||
if(getSn_MR(sn) & Sn_MR_TCP)
|
||||
*(uint16_t*)arg = getSn_RX_RSR(sn);
|
||||
else
|
||||
*(uint16_t*)arg = sock_remained_size[sn];
|
||||
|
@ -439,9 +439,9 @@ int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize)
|
||||
|
||||
for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++)
|
||||
{
|
||||
#if __WIZCHIP_ < W5200 //2016.10.28 peter add condition for w5100 and w5100s
|
||||
#if _WIZCHIP_ < W5200 //2016.10.28 peter add condition for w5100 and w5100s
|
||||
j = 0;
|
||||
while(txsize[i] >> j != 1){j++;}
|
||||
while((txsize[i] >> j != 1)&&(txsize[i] !=0)){j++;}
|
||||
setSn_TXBUF_SIZE(i, j);
|
||||
#else
|
||||
setSn_TXBUF_SIZE(i, txsize[i]);
|
||||
@ -473,9 +473,9 @@ int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize)
|
||||
|
||||
for(i = 0 ; i < _WIZCHIP_SOCK_NUM_; i++)
|
||||
{
|
||||
#if __WIZCHIP_ < W5200 //2016.10.28 peter add condition for w5100 and w5100s
|
||||
#if _WIZCHIP_ < W5200 //2016.10.28 peter add condition for w5100 and w5100s
|
||||
j = 0;
|
||||
while(rxsize[i] >> j != 1){j++;}
|
||||
while((rxsize[i] >> j != 1)&&(txsize[i] !=0)){j++;}
|
||||
setSn_RXBUF_SIZE(i, j);
|
||||
#else
|
||||
setSn_RXBUF_SIZE(i, txsize[i]);
|
||||
|
@ -228,7 +228,8 @@ void (*dhcp_ip_conflict)(void) = default_ip_conflict; /* handler to be called
|
||||
|
||||
void reg_dhcp_cbfunc(void(*ip_assign)(void), void(*ip_update)(void), void(*ip_conflict)(void));
|
||||
|
||||
|
||||
char NibbleToHex(uint8_t nibble);
|
||||
|
||||
/* send DISCOVER message to DHCP server */
|
||||
void send_DHCP_DISCOVER(void);
|
||||
|
||||
@ -478,10 +479,13 @@ void send_DHCP_REQUEST(void)
|
||||
pDHCPMSG->OPT[k++] = 0; // length of hostname
|
||||
for(i = 0 ; HOST_NAME[i] != 0; i++)
|
||||
pDHCPMSG->OPT[k++] = HOST_NAME[i];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[3];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[4];
|
||||
pDHCPMSG->OPT[k++] = DHCP_CHADDR[5];
|
||||
pDHCPMSG->OPT[k - (i+3+1)] = i+3; // length of hostname
|
||||
pDHCPMSG->OPT[k++] = NibbleToHex(DHCP_CHADDR[3] >> 4);
|
||||
pDHCPMSG->OPT[k++] = NibbleToHex(DHCP_CHADDR[3]);
|
||||
pDHCPMSG->OPT[k++] = NibbleToHex(DHCP_CHADDR[4] >> 4);
|
||||
pDHCPMSG->OPT[k++] = NibbleToHex(DHCP_CHADDR[4]);
|
||||
pDHCPMSG->OPT[k++] = NibbleToHex(DHCP_CHADDR[5] >> 4);
|
||||
pDHCPMSG->OPT[k++] = NibbleToHex(DHCP_CHADDR[5]);
|
||||
pDHCPMSG->OPT[k - (i+6+1)] = i+6; // length of hostname
|
||||
|
||||
pDHCPMSG->OPT[k++] = dhcpParamRequest;
|
||||
pDHCPMSG->OPT[k++] = 0x08;
|
||||
@ -913,7 +917,6 @@ void DHCP_init(uint8_t s, uint8_t * buf)
|
||||
|
||||
// WIZchip Netinfo Clear
|
||||
setSIPR(zeroip);
|
||||
setSIPR(zeroip);
|
||||
setGAR(zeroip);
|
||||
|
||||
reset_DHCP_timeout();
|
||||
@ -971,6 +974,13 @@ uint32_t getDHCPLeasetime(void)
|
||||
return dhcp_lease_time;
|
||||
}
|
||||
|
||||
|
||||
char NibbleToHex(uint8_t nibble)
|
||||
{
|
||||
nibble &= 0x0F;
|
||||
if (nibble <= 9)
|
||||
return nibble + '0';
|
||||
else
|
||||
return nibble + ('A'-0x0A);
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
||||
#define DHCP_CLIENT_PORT 68 ///< DHCP client port number
|
||||
|
||||
|
||||
#define MAGIC_COOKIE 0x63825363 ///< Any number. You can be modifyed it any number
|
||||
#define MAGIC_COOKIE 0x63825363 ///< You should not modify it number.
|
||||
|
||||
#define DCHP_HOST_NAME "WIZnet\0"
|
||||
|
||||
|
@ -120,6 +120,7 @@ uint8_t DNS_SOCKET; // SOCKET number for DNS
|
||||
uint16_t DNS_MSGID; // DNS message ID
|
||||
|
||||
uint32_t dns_1s_tick; // for timout of DNS processing
|
||||
static uint8_t retry_count;
|
||||
|
||||
/* converts uint16_t from network buffer to a host byte order integer. */
|
||||
uint16_t get16(uint8_t * s)
|
||||
@ -472,7 +473,6 @@ int16_t dns_makequery(uint16_t op, char * name, uint8_t * buf, uint16_t len)
|
||||
|
||||
int8_t check_DNS_timeout(void)
|
||||
{
|
||||
static uint8_t retry_count;
|
||||
|
||||
if(dns_1s_tick >= DNS_WAIT_TIME)
|
||||
{
|
||||
@ -506,6 +506,9 @@ int8_t DNS_run(uint8_t * dns_ip, uint8_t * name, uint8_t * ip_from_dns)
|
||||
uint8_t ip[4];
|
||||
uint16_t len, port;
|
||||
int8_t ret_check_timeout;
|
||||
|
||||
retry_count = 0;
|
||||
dns_1s_tick = 0;
|
||||
|
||||
// Socket open
|
||||
socket(DNS_SOCKET, Sn_MR_UDP, 0, 0);
|
||||
|
@ -295,14 +295,10 @@ int MQTTYield(MQTTClient* c, int timeout_ms)
|
||||
TimerInit(&timer);
|
||||
TimerCountdownMS(&timer, timeout_ms);
|
||||
|
||||
do
|
||||
if (cycle(c, &timer) == FAILURE)
|
||||
{
|
||||
if (cycle(c, &timer) == FAILURE)
|
||||
{
|
||||
rc = FAILURE;
|
||||
break;
|
||||
}
|
||||
} while (!TimerIsExpired(&timer));
|
||||
rc = FAILURE;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ void NewNetwork(Network* n, int sn) {
|
||||
* buffer : pointer to a read buffer.
|
||||
* len : buffer length.
|
||||
*/
|
||||
int w5x00_read(Network* n, unsigned char* buffer, int len)
|
||||
int w5x00_read(Network* n, unsigned char* buffer, int len, long time)
|
||||
{
|
||||
|
||||
if((getSn_SR(n->my_socket) == SOCK_ESTABLISHED) && (getSn_RX_RSR(n->my_socket)>0))
|
||||
@ -137,7 +137,7 @@ int w5x00_read(Network* n, unsigned char* buffer, int len)
|
||||
* buffer : pointer to a read buffer.
|
||||
* len : buffer length.
|
||||
*/
|
||||
int w5x00_write(Network* n, unsigned char* buffer, int len)
|
||||
int w5x00_write(Network* n, unsigned char* buffer, int len, long time)
|
||||
{
|
||||
if(getSn_SR(n->my_socket) == SOCK_ESTABLISHED)
|
||||
return send(n->my_socket, buffer, len);
|
||||
@ -162,7 +162,7 @@ void w5x00_disconnect(Network* n)
|
||||
*/
|
||||
int ConnectNetwork(Network* n, char* ip, int port)
|
||||
{
|
||||
uint8_t myport = 12345;
|
||||
uint16_t myport = 12345;
|
||||
|
||||
socket(n->my_socket,Sn_MR_TCP,myport,0);
|
||||
connect(n->my_socket,ip,port);
|
||||
|
@ -251,8 +251,8 @@ int TimerLeftMS(Timer*);
|
||||
/*
|
||||
* @brief Network interface porting
|
||||
*/
|
||||
int w5x00_read(Network*, unsigned char*, int);
|
||||
int w5x00_write(Network*, unsigned char*, int);
|
||||
int w5x00_read(Network*, unsigned char*, int, long);
|
||||
int w5x00_write(Network*, unsigned char*, int, long);
|
||||
void w5x00_disconnect(Network*);
|
||||
void NewNetwork(Network* n, int sn);
|
||||
int ConnectNetwork(Network*, char*, int);
|
||||
|
Reference in New Issue
Block a user