]> git.sur5r.net Git - freertos/blobdiff - Demo/RX600_RX62N-RDK_Renesas/RTOSDemo/uIP_Task.c
Prepare RX RDK project for release.
[freertos] / Demo / RX600_RX62N-RDK_Renesas / RTOSDemo / uIP_Task.c
index 9f89c3218bbcc20075e5c6a4dbd8dc805db05a42..e222db7839765d22abd5c987fffb200b7b40556d 100644 (file)
@@ -115,7 +115,7 @@ clock_time_t clock_time( void )
 \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
@@ -145,6 +145,8 @@ struct timer periodic_timer, arp_timer;
 \r
        for( ;; )\r
        {\r
+               xDoneSomething = pdFALSE;\r
+               \r
                /* Is there received data ready to be processed? */\r
                uip_len = ( unsigned short ) ulEMACRead();\r
                \r
@@ -164,6 +166,8 @@ struct timer periodic_timer, arp_timer;
                                        uip_arp_out();\r
                                        vEMACWrite();\r
                                }\r
+                               \r
+                               xDoneSomething = pdTRUE;\r
                        }\r
                        else if( xHeader->type == htons( UIP_ETHTYPE_ARP ) )\r
                        {\r
@@ -176,42 +180,45 @@ struct timer periodic_timer, arp_timer;
                                {\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