Skip to content

Commit

Permalink
some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stevstrong committed Mar 15, 2024
1 parent fbebecf commit 4daa88f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/socket.cpp
Expand Up @@ -366,11 +366,14 @@ static void write_data(uint8_t s, uint16_t data_offset, const uint8_t *data, uin
*/
uint16_t EthernetClass::socketSend(uint8_t s, const uint8_t * buf, uint16_t len)
{
uint16_t freesize, num = len;

while (num) {
len = num;
if (len > W5500.SSIZE) {
len = W5500.SSIZE; // check size not to exceed MAX size.
}

uint16_t freesize;
// if freebuf is available, start.
do {
freesize = getSnTX_FSR(s);
Expand All @@ -385,6 +388,8 @@ uint16_t EthernetClass::socketSend(uint8_t s, const uint8_t * buf, uint16_t len)
// copy data
write_data(s, 0, (uint8_t *)buf, len);
W5500.execCmdSn(s, Sock_SEND);
buf += len;
num -= len;

/* +2008.01 bj */
while ( (W5500.readSnIR(s) & SnIR::SEND_OK) != SnIR::SEND_OK ) {
Expand All @@ -396,6 +401,7 @@ uint16_t EthernetClass::socketSend(uint8_t s, const uint8_t * buf, uint16_t len)
}
/* +2008.01 bj */
W5500.writeSnIR(s, SnIR::SEND_OK);
}
return len;
}
//-----------------------------------------------------------------------------
Expand Down
9 changes: 4 additions & 5 deletions src/utility/w5500.h
Expand Up @@ -175,18 +175,17 @@ class W5500Class {
__GP_REGISTER_N(SIPR, 0x000F, 4); // Source IP address
__GP_REGISTER8 (IR, 0x0015); // Interrupt
__GP_REGISTER8 (IMR, 0x0016); // Interrupt Mask
__GP_REGISTER16(RTR, 0x0019); // Timeout address
__GP_REGISTER8 (RMSR, 0x001A); // Receive memory size (W5500 only)
__GP_REGISTER16(RTR, 0x0019); // Retry Time
__GP_REGISTER8 (RCR, 0x001B); // Retry count
__GP_REGISTER8 (PTIMER, 0x001C); // PPP LCP Request Timer
__GP_REGISTER8 (PMAGIC, 0x001D); // PPP LCP Magic Number
__GP_REGISTER_N(PHAR, 0x001E, 6); // PPP Destination MAC address
__GP_REGISTER16(PSID, 0x0024); // PPP Session ID
__GP_REGISTER16(PMRU, 0x0026); // PPP Maximum Segment Size
__GP_REGISTER_N(UIPR, 0x0028, 4); // Unreachable IP address in UDP mode (W5500 only)
__GP_REGISTER16(UPORT, 0x002C); // Unreachable Port address in UDP mode (W5500 only)
__GP_REGISTER_N(UIPR, 0x0028, 4); // Unreachable IP address in UDP mode
__GP_REGISTER16(UPORT, 0x002C); // Unreachable Port address in UDP mode
__GP_REGISTER8 (PHYCFGR, 0x002E); // PHY Configuration register, default: 10111xxx
__GP_REGISTER8 (VERSIONR,0x0039); // Chip Version Register (W5500 only)
__GP_REGISTER8 (VERSIONR,0x0039); // Chip Version Register


#undef __GP_REGISTER8
Expand Down

0 comments on commit 4daa88f

Please sign in to comment.