Data Sheet
© Copyright 2013 WIZnet Co.,Ltd. All rights reserved.
71
iEthernet
W5200
else
{ /* copy len bytes of src_ptr to destination_address */
memcpy(src_ptr, dst_addr, len);
}
/* increase Sn_RX_RD as length of len */
Sn_RX_RD += len;
/* extract 4 bytes CRC from internal RX memory and then ignore it */
memcpy(src_ptr, dst_addr, len);
/* calculate the size of remained data in internal RX memory*/
recved_size = recved_size – 2 – len – 4;
}
/* Reopen the SOCKET */
/* sets MAC raw mode with enabling MAC filter */
S0_MR = 0x44; /* or S0_MR = 0x04 */
/* sets OPEN command */
S0_CR = OPEN;
/* wait until Sn_SR is changed to SOCK_MACRAW */
while (Sn_SR != SOCK_MACRAW);
}
else /* process normally the DATA packet from internal RX memory */
{/* This block is same as the code of “Receiving process” stage*/
}
}
Check send data / sending process
The size of the data which the user wants to transmit cannot be larger than the
internal TX memory and default MTU. The host generates the MACRAW data in the
same format as the “Receiving process” data packet, and transmits it. At this time, if
the size of the generated data is smaller than 60bytes, the transmitted Ethernet
packet internally fills to 60bytes by “Zero padding” and then it is transmitted.
{
/* first, get the free TX memory size */
FREESIZE:
freesize = S0_TX_FSR;
if (freesize<send_size) goto FREESIZE;
/* calculate offset address */
dst_mask = Sn_TX_WR0 &gSn_TX_MASK; // dst_mask is offset address
/* calculate start address(physical address) */