IINCHIP_WRITE(SUBR1, subnet_val[1]);
IINCHIP_WRITE(SUBR2, subnet_val[2]);
IINCHIP_WRITE(SUBR3, subnet_val[3]);
/* Execute TCP connect command */
IINCHIP_WRITE(Sn_CR(socket), Sn_CR_CONNECT);
/* Wait for command done */
while(Sn_CR(socket));
/* Clear the subnet mask register again and keep it */
IINCHIP_WRITE(SUBR0, 0);
IINCHIP_WRITE(SUBR1, 0);
IINCHIP_WRITE(SUBR2, 0);
IINCHIP_WRITE(SUBR3, 0);
…
}
/* UDP sendto function */
Function UDP_Sendto( )
{
…
/* Set the subnet mask register to the right value using the variable */
IINCHIP_WRITE(SUBR0, subnet_val[0]);
IINCHIP_WRITE(SUBR1, subnet_val[1]);
IINCHIP_WRITE(SUBR2, subnet_val[2]);
IINCHIP_WRITE(SUBR3, subnet_val[3]);
/* Execute UDP send command */
IINCHIP_WRITE(Sn_CR(socket), Sn_CR_SEND);
/* Wait for command done */
while(Sn_CR(socket));
/* Clear the subnet mask register again and keep it */
IINCHIP_WRITE(SUBR0, 0);
IINCHIP_WRITE(SUBR1, 0);
IINCHIP_WRITE(SUBR2, 0);
IINCHIP_WRITE(SUBR3, 0);
…
}
}