Data Sheet
© Copyright 2013 WIZnet Co.,Ltd. All rights reserved.
57
iEthernet
W5200
/* In this case, if the interrupt of Socket n is activated, interrupt occurs. Refer to IR, IMR
Sn_IMR and Sn_IR. */
}
Second Method :
{
if (Sn_RX_RSR0 != 0x0000) goto Receiving Process stage;
}
Receiving process
Process the received UDP data in Internal RX memory.
The structure of received UDP data is as below.
Figure 13 The Received UDP data Format
The received UDP data consists of 8bytes PACKET-INFO, and DATA packet. The PACKET-
INFO contains transmitter’s information (IP address, Port number) and the length of
DATA packet. The UDP can receive UDP data from many others. User can classify the
transmitter by transmitter’s information of PACKET-INFO. It also receives broadcast
SOCKET by using “255.255.255.255” IP address. So the host should ignore unwanted
reception by analysis of transmitter’s information.
If the DATA size of Socket n is larger than Internal RX memory free size, user cannot
receive that DATA and also cannot receive fragmented DATA.
{
/* calculate offset address */
src_mask = Sn_RX_RD &g Sn_RX_MASK; // src_mask is offset address
/* calculate start address(physical address) */
src_ptr = gSn_RX_BASE + src_mask; // src_ptr is physical start address
/* read head information (8 bytes) */
header_size = 8;
/* if overflow SOCKET RX memory */
if ( (src_mask + header_size) > (gSn_RX_MASK + 1) )
{
/* copy upper_size bytes of src_ptr to header_addr*/
upper_size = (gSn_RX_MASK + 1) – src_mask;
memcpy(src_ptr, header, upper_size);