\r
void vuIP_Task( void *pvParameters )\r
{\r
-portBASE_TYPE i;\r
+portBASE_TYPE i, xDoneSomething;\r
uip_ipaddr_t xIPAddr;\r
struct timer periodic_timer, arp_timer;\r
\r
\r
for( ;; )\r
{\r
+ xDoneSomething = pdFALSE;\r
+ \r
/* Is there received data ready to be processed? */\r
uip_len = ( unsigned short ) ulEMACRead();\r
\r
uip_arp_out();\r
vEMACWrite();\r
}\r
+ \r
+ xDoneSomething = pdTRUE;\r
}\r
else if( xHeader->type == htons( UIP_ETHTYPE_ARP ) )\r
{\r
{\r
vEMACWrite();\r
}\r
+ \r
+ xDoneSomething = pdTRUE;\r
}\r
}\r
- else\r
+\r
+ if( timer_expired( &periodic_timer ) && ( uip_buf != NULL ) )\r
{\r
- if( timer_expired( &periodic_timer ) && ( uip_buf != NULL ) )\r
+ timer_reset( &periodic_timer );\r
+ for( i = 0; i < UIP_CONNS; i++ )\r
{\r
- timer_reset( &periodic_timer );\r
- for( i = 0; i < UIP_CONNS; i++ )\r
- {\r
- uip_periodic( i );\r
-\r
- /* If the above function invocation resulted in data that\r
- should be sent out on the network, the global variable\r
- uip_len is set to a value > 0. */\r
- if( uip_len > 0 )\r
- {\r
- uip_arp_out();\r
- vEMACWrite();\r
- }\r
- }\r
+ uip_periodic( i );\r
\r
- /* Call the ARP timer function every 10 seconds. */\r
- if( timer_expired( &arp_timer ) )\r
+ /* If the above function invocation resulted in data that\r
+ should be sent out on the network, the global variable\r
+ uip_len is set to a value > 0. */\r
+ if( uip_len > 0 )\r
{\r
- timer_reset( &arp_timer );\r
- uip_arp_timer();\r
+ uip_arp_out();\r
+ vEMACWrite();\r
}\r
}\r
- else\r
+\r
+ /* Call the ARP timer function every 10 seconds. */\r
+ if( timer_expired( &arp_timer ) )\r
{\r
- /* We did not receive a packet, and there was no periodic\r
- processing to perform. Block for a fixed period. If a packet\r
- is received during this period we will be woken by the ISR\r
- giving us the Semaphore. */\r
- xSemaphoreTake( xEMACSemaphore, configTICK_RATE_HZ / 20 );\r
+ timer_reset( &arp_timer );\r
+ uip_arp_timer();\r
}\r
+ \r
+ xDoneSomething = pdTRUE;\r
+ }\r
+ \r
+ if( xDoneSomething == pdFALSE )\r
+ {\r
+ /* We did not receive a packet, and there was no periodic\r
+ processing to perform. Block for a fixed period. If a packet\r
+ is received during this period we will be woken by the ISR\r
+ giving us the Semaphore. */\r
+ xSemaphoreTake( xEMACSemaphore, configTICK_RATE_HZ / 20 );\r
}\r
}\r
}\r