예제 #1
0
/**
  * @brief  task who manage ethernet communication
  * @param  None
  * @retval None
  */
void ethernet_task(void *pdata)
{
#if 1
	pdata=pdata;

	// initialize enc28j60
	ES_enc28j60Init(&mymac[0]);

	/* Magjack leds configuration, see enc28j60 datasheet, page 11 */
	// LEDB=yellow LEDA=green
	//
	// 0x476 is PHLCON LEDA=links status, LEDB=receive/transmit
	// enc28j60PhyWrite(PHLCON,0b0000 0100 0111 01 10);
	enc28j60PhyWrite(PHLCON,0x476);
	init_udp_or_www_server(&mymac[0],&myip[0]);

	//ES_init_ip_arp_udp_tcp(mymac,myip,80);

	if( ES_enc28j60Revision() <= 0 )
	{
	  // Failed to access ENC28J60
	  while(1);    // Just loop here
	}
	// Get IP Address details
	#if 0
	if( allocateIPAddress(buf, BUFFER_SIZE, mymac, 80, myip, mynetmask, gwip, dhcpsvrip, dnsip ) > 0 ) {
	  // Display the results:
	} else {
		// Failed to get IP address"
		while(1);
	}
	#endif
#endif
	for(;;)
	{
#if 1
		ethernet_process();
#endif
	}

}
예제 #2
0
파일: ethernet.c 프로젝트: Talustus/culfw
void
Ethernet_Task(void) {
     int i;

     ethernet_process();
     
     if(timer_expired(&periodic_timer)) {
	  timer_reset(&periodic_timer);
	  
	  for(i = 0; i < UIP_CONNS; i++) {
	       uip_periodic(i);
	       if(uip_len > 0) {
		    uip_arp_out();
		    network_send();
	       }
	  }
	  
	  for(i = 0; i < UIP_UDP_CONNS; i++) {
	       uip_udp_periodic(i);
	       if(uip_len > 0) {
		    uip_arp_out();
		    network_send();
	       }
	  }

	  interface_periodic();
	  
     }
     
     
     if(timer_expired(&arp_timer)) {
	  timer_reset(&arp_timer);
	  uip_arp_timer();
	  
     }
     
}