Data Sheet
© Copyright 2013 WIZnet Co.,Ltd. All rights reserved.
72
iEthernet
W5200
dst_ptr = gSn_TX_BASE + dst_mask; // dst_ptr is physical start address
/* if overflow SOCKETTX memory */
if ( (dst_mask + len) > (gSn_TX_MASK + 1) )
{/* copy upper_size bytes of source_addr to destination_address */
upper_size = (gSn_TX_MASK + 1) – dst_mask;
memcpy(src_ptr, dst_addr, upper_size);
/* update source_addr*/
source_addr += upper_size;
/* copy left_size bytes of source_addr to gSn_TX_BASE */
left_size = len – upper_size;
memcpy(src_ptr, dst_addr, left_size);
}
else
{/* copy len bytes of source_addr to destination_address */
memcpy(src_ptr, dst_addr, len);
}
/* increase Sn_TX_WR as length of len */
Sn_TX_WR += send_size;
/* set SEND command */
S0_CR = SEND;
}
Check complete sending
Since the host manages all protocol processors to communicate, the timeout can
notoccur.
{
/* check SEND command completion */
while(S0_IR(SENDOK)==‘0’); /* wait interrupt of SEND completion */
S0_IR(SENDOK) = ‘1’; /* clear previous interrupt of SEND completion */
}
Check finished / SOCKET close
Refer to the “5.2.2.1 Unicast & Broadcast.”