Data Sheet
© Copyright 2013 WIZnet Co.,Ltd. All rights reserved. 
60
iEthernet 
W5200
Check send data / sending process 
The  size  of  DATA  that  the  user  wants  to  transmit  cannot  be  larger  than  Internal  TX 
memory.  If  it  is  larger  than  MTU,  it  is  automatically  divided  by  MTU  unit  and 
transmitted. The Sn_DIPR0 is set “255.255.255.255” when user wants to broadcast. 
{ 
/* first, get the free TX memory size */ 
FREESIZE: 
freesize = Sn_TX_FSR0; 
if (freesize<len) goto FREESIZE;        // len is send size 
/*  Write  the  value  of  remote_ip,  remote_port  to  the  Socket  n    Destination  IP  Address 
Register(Sn_DIPR), Socket n    Destination Port Register(Sn_DPORT). */ 
      Sn_DIPR0 = remote_ip; 
      Sn_DPORT0 = remote_port; 
/* calculate offset address */ 
dst_mask = Sn_TX_WR0 & gSn_TX_MASK;        // dst_mask is offset address 
/* calculate start address(physical address) */ 
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_address to dst_ptr */ 
upper_size = (gSn_TX_MASK + 1) – dst_mask; 
memcpy(src_ptr, destination_addr, upper_size);   
/* update source_address*/ 
source_address += upper_size; 
/* copy left_size bytes of source_address to gSn_TX_BASE */ 
left_size = send_size – upper_size; 
memcpy(src_ptr, destination_addr, left_size);   
else 
{ 
/* copy len bytes of source_address to dst_ptr */ 
memcpy(src_ptr, destination_addr, len);   
} 
/* increase Sn_TX_WR0 as length of len */ 
Sn_TX_WR0 += len; 










