summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Moore <nick@zoic.org>2018-10-04 21:17:51 +1000
committerNick Moore <nick@zoic.org>2018-10-04 21:17:51 +1000
commit8670215ecc1fcb4b882549b2190af30d22b3c51a (patch)
tree579388c50075bfe8e1d4aab244660e19fdd46927
parent38d99b11c180c877fc4060d8383b0a949a94dc42 (diff)
Fixups for wiznet 5500 driver
-rw-r--r--drivers/wiznet5k/ethernet/socket.c3
-rw-r--r--drivers/wiznet5k/ethernet/wizchip_conf.h2
-rw-r--r--drivers/wiznet5k/internet/dns/dns.c8
3 files changed, 10 insertions, 3 deletions
diff --git a/drivers/wiznet5k/ethernet/socket.c b/drivers/wiznet5k/ethernet/socket.c
index ec25fcc79..4ca7113e8 100644
--- a/drivers/wiznet5k/ethernet/socket.c
+++ b/drivers/wiznet5k/ethernet/socket.c
@@ -286,7 +286,7 @@ int32_t WIZCHIP_EXPORT(send)(uint8_t sn, uint8_t * buf, uint16_t len)
if(tmp & Sn_IR_SENDOK)
{
setSn_IR(sn, Sn_IR_SENDOK);
- #if _WZICHIP_ == 5200
+ #if _WIZCHIP_ == 5200
if(getSn_TX_RD(sn) != sock_next_rd[sn])
{
setSn_CR(sn,Sn_CR_SEND);
@@ -525,6 +525,7 @@ int32_t WIZCHIP_EXPORT(recvfrom)(uint8_t sn, uint8_t * buf, uint16_t len, uint8_
// read peer's IP address, port number & packet length
sock_remained_size[sn] = head[0];
sock_remained_size[sn] = (sock_remained_size[sn] <<8) + head[1];
+ sock_remained_size[sn] -= 2; // len includes 2 len bytes
if(sock_remained_size[sn] > 1514)
{
WIZCHIP_EXPORT(close)(sn);
diff --git a/drivers/wiznet5k/ethernet/wizchip_conf.h b/drivers/wiznet5k/ethernet/wizchip_conf.h
index 4a7a7bd69..10f12a794 100644
--- a/drivers/wiznet5k/ethernet/wizchip_conf.h
+++ b/drivers/wiznet5k/ethernet/wizchip_conf.h
@@ -130,7 +130,7 @@
*/
#define _WIZCHIP_IO_BASE_ 0x00000000 //
-#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS
+#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS_
#ifndef _WIZCHIP_IO_BASE_
#error "You should be define _WIZCHIP_IO_BASE to fit your system memory map."
#endif
diff --git a/drivers/wiznet5k/internet/dns/dns.c b/drivers/wiznet5k/internet/dns/dns.c
index c0ad570c0..daf4db123 100644
--- a/drivers/wiznet5k/internet/dns/dns.c
+++ b/drivers/wiznet5k/internet/dns/dns.c
@@ -15,6 +15,7 @@
//! 3. Remove the unused define
//! 4. Integrated dns.h dns.c & dns_parse.h dns_parse.c into dns.h & dns.c
//! <2013/12/20> V1.1.0
+//! <2018/10/04> Modified HAL_GetTick for use with CircuitPython by Nick Moore
//!
//! \author Eric Jung & MidnightCow
//! \copyright
@@ -51,6 +52,7 @@
#include <string.h>
#include <stdlib.h>
+#include "tick.h"
//#include "Ethernet/socket.h"
//#include "Internet/DNS/dns.h"
@@ -121,7 +123,11 @@ uint8_t* pDNSMSG; // DNS message buffer
uint8_t DNS_SOCKET; // SOCKET number for DNS
uint16_t DNS_MSGID; // DNS message ID
-extern uint32_t HAL_GetTick(void);
+
+uint32_t HAL_GetTick(void) {
+ return ticks_ms;
+}
+
uint32_t hal_sys_tick;
/* converts uint16_t from network buffer to a host byte order integer. */