21 Commits

Author SHA1 Message Date
b8e3c63cff Revert "MDIO added" 2018-07-25 18:33:15 +09:00
8ebd860b08 Merge pull request #51 from javakys/master
MDIO added
2018-07-25 18:05:59 +09:00
aaaf41eff1 Merge branch 'master' into master 2018-07-25 18:05:45 +09:00
433f4bb409 fixed bug
issue #23
2018-07-05 14:50:41 +09:00
18c878db9c fixed bug
issue #43
2018-07-05 14:50:14 +09:00
e20beebfc2 fixed bug
issue #46
2018-07-05 14:16:25 +09:00
7bac9a1f99 fixed commnet
issue #35
2018-07-05 11:17:26 +09:00
74bf44ddc0 fixed bug
issue #44
2018-07-05 11:13:56 +09:00
879b8a1828 fixed typo
issue #45
2018-07-05 11:09:32 +09:00
01d6b321bc fixed bug
issue #39
2018-07-05 11:07:41 +09:00
1c6b068fa0 MDIO added
MDIO Folder Added
2018-05-28 17:05:15 +09:00
2166370f1d Merge pull request #42 from fishjimi/master
Remove redundant blocking in "MQTTClient.c"
2018-05-15 16:25:28 +09:00
556bee8d4a Merge pull request #41 from coolizard/patch-1
Socket buffer size set always as on < W5200
2018-05-15 16:24:55 +09:00
a8b1f0a05c Merge pull request #40 from drojf/master
Fix #39 - Fix typo where `_WIZCHIP_` was written as `__WIZCHIP_` in two places in wizchip_conf.c
2018-05-15 16:24:29 +09:00
640eb5a863 Merge pull request #34 from yous/fix-w5300
Fix getSn_PORTR for W5300
2018-05-15 16:24:03 +09:00
e3855b86e8 Remove redundant blocking 2018-05-11 21:57:53 +08:00
81d0d9d981 Socket buffer size set always as on < W5200
Then on W5500 it was using always 1kB buffer. 
__WIZCHIP_ changed to _WIZCHIP_
2018-05-10 09:56:32 +02:00
d96daf13f0 Fix #39 - Fix typo where _WIZCHIP_ was written as __WIZCHIP_ in two places in wizchip_conf.c 2018-05-09 21:52:52 +10:00
47b6ea8bf7 Fix getSn_PORTR for W5300 2018-04-13 21:58:10 +09:00
4ddea28229 Merge branch 'develop' 2018-04-06 11:06:00 +09:00
fdeac309b6 Merge branch 'hotfix/W5500_PHY_LINK' into develop 2018-04-06 11:00:43 +09:00
9 changed files with 36 additions and 27 deletions

View File

@ -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

View File

@ -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];

View File

@ -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]);

View File

@ -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);
}

View File

@ -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"

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);