void NcStart (void) { if (!output_packet_len || memcmp (nc_ether, NetEtherNullAddr, 6)) { /* going to check for input packet */ NetSetHandler (nc_handler); NetSetTimeout (net_timeout, nc_timeout); } else { /* send arp request */ uchar *pkt; NetSetHandler (nc_wait_arp_handler); pkt = (uchar *) NetTxPacket + NetEthHdrSize () + IP_HDR_SIZE; memcpy (pkt, output_packet, output_packet_len); NetSendUDPPacket (nc_ether, nc_ip, nc_port, nc_port, output_packet_len); } }
void RarpRequest (void) { int i; volatile uchar *pkt; ARP_t * rarp; printf("RARP broadcast %d\n", ++RarpTry); pkt = NetTxPacket; pkt += NetSetEther(pkt, NetBcastAddr, PROT_RARP); rarp = (ARP_t *)pkt; rarp->ar_hrd = htons (ARP_ETHER); rarp->ar_pro = htons (PROT_IP); rarp->ar_hln = 6; rarp->ar_pln = 4; rarp->ar_op = htons (RARPOP_REQUEST); memcpy (&rarp->ar_data[0], NetOurEther, 6); /* source ET addr */ memcpy (&rarp->ar_data[6], &NetOurIP, 4); /* source IP addr */ memcpy (&rarp->ar_data[10], NetOurEther, 6); /* dest ET addr = source ET addr ??*/ /* dest. IP addr set to broadcast */ for (i = 0; i <= 3; i++) { rarp->ar_data[16 + i] = 0xff; } NetSendPacket(NetTxPacket, (pkt - NetTxPacket) + ARP_HDR_SIZE); NetSetTimeout(TIMEOUT, RarpTimeout); NetSetHandler(RarpHandler); }
void TftpStart (void) { struct timestamp now; time_get(&now); #ifdef ET_DEBUG printf ("\nServer ethernet address %02x:%02x:%02x:%02x:%02x:%02x\n", NetServerEther[0], NetServerEther[1], NetServerEther[2], NetServerEther[3], NetServerEther[4], NetServerEther[5] ); #endif /* DEBUG */ printf ("TFTP from server %s", inet_ntoa(NetServerIP)); printf ("; our IP address is %s", inet_ntoa(NetOurIP)); // Check if we need to send across this subnet if (NetOurGatewayIP && NetOurSubnetMask) { IPaddr_t OurNet = NetOurIP & NetOurSubnetMask; IPaddr_t ServerNet = NetServerIP & NetOurSubnetMask; if (OurNet != ServerNet) { printf ("; sending through gateway "); print_IPaddr (NetOurGatewayIP) ; } } printf("\n"); printf ("Filename '%s'.", tftp_filename); if (NetBootFileSize) { printf (" Size is %d%s kB => %x Bytes", NetBootFileSize/2, (NetBootFileSize%2) ? ".5" : "", NetBootFileSize<<9); } printf("\n"); printf ("Load address: 0x%lx\n\n", get_board_desc()->memctrl_membase); printf ("Press Ctrl-C to abort...\n"); printf ("Loading: *\b"); NetSetTimeout (TIMEOUT * 1000, TftpTimeout); NetSetHandler (TftpHandler); TftpServerPort = WELL_KNOWN_PORT; TftpTimeoutCount = 0; TftpState = STATE_RRQ; TftpOurPort = 1024 + (now.usec % 3072); //FIXED TftpSend (); }
void DnsStart(void) { debug("%s\n", __func__); NetSetTimeout(DNS_TIMEOUT, DnsTimeout); NetSetHandler(DnsHandler); DnsSend(); }
void SntpStart (void) { debug ("%s\n", __FUNCTION__); NetSetTimeout (SNTP_TIMEOUT, SntpTimeout); NetSetHandler(SntpHandler); memset (NetServerEther, 0, 6); SntpSend (); }
void SntpStart(void){ #ifdef DEBUG printf("%s\n", __FUNCTION__); #endif NetSetTimeout(SNTP_TIMEOUT * CFG_HZ, SntpTimeout); NetSetHandler(SntpHandler); memset(NetServerEther, 0, 6); SntpSend(); }
static void _tftpd_open() { NetSetTimeout(TIMEOUT * CFG_HZ * 2, TftpdTimeout); NetSetHandler(TftpHandler); TftpOurPort = PORT_TFTP; TftpTimeoutCount = 0; TftpState = STATE_RRQ; TftpBlock = 0; /* zero out server ether in case the server ip has changed */ memset(NetServerEther, 0, 6); }
int network_update( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[] ) { int i; setup_pkt_recvd=0; NetSetTimeout(TIMEOUT * CFG_HZ, NbootTimeout); NetSetHandler(NBootHandler); dm9k_phy_retry_times=1000; eth_init(gd->bd); eth_rx(); if (setup_pkt_recvd) { front_puts("TFTP"); if (NetLoop (TFTP) <= 0) return 1; front_puts("BURN"); burn_flash_img( 0, 0, 0, 0); do_reset (NULL, 0, 0, NULL); } return 0; }