void tftpd_init(void)
{
err_t err;
unsigned port = 69;
/* create a new UDP PCB structure */
UDPpcb = udp_new();
if (!UDPpcb)
{ /* Error creating PCB. Out of Memory */
return;
}
/* Bind this PCB to port 69 */
err = udp_bind(UDPpcb, IP_ADDR_ANY, port);
if (err != ERR_OK)
{ /* Unable to bind to port */
return;
}
/* TFTP server start */
udp_recv(UDPpcb, recv_callback_tftp, NULL);
} |