+static void prvInitialise_uIP( void )\r
+{\r
+xTimerHandle xARPTimer, xPeriodicTimer;\r
+uip_ipaddr_t xIPAddr;\r
+struct timer periodic_timer, arp_timer;\r
+const unsigned long ul_uIPEventQueueLength = 10UL;\r
+\r
+ /* Initialise the uIP stack. */\r
+ uip_init();\r
+ uip_ipaddr( &xIPAddr, configIP_ADDR0, configIP_ADDR1, configIP_ADDR2, configIP_ADDR3 );\r
+ uip_sethostaddr( &xIPAddr );\r
+ uip_ipaddr( &xIPAddr, configNET_MASK0, configNET_MASK1, configNET_MASK2, configNET_MASK3 );\r
+ uip_setnetmask( &xIPAddr );\r
+ prvSetMACAddress();\r
+ httpd_init();\r
+\r
+ /* Create the queue used to sent TCP/IP events to the uIP stack. */\r
+ xEMACEventQueue = xQueueCreate( ul_uIPEventQueueLength, sizeof( unsigned long ) );\r
+\r
+ /* Create and start the uIP timers. */\r
+ xARPTimer = xTimerCreate( ( const signed char * const ) "ARPTimer", /* Just a name that is helpful for debugging, not used by the kernel. */\r
+ ( 10000UL / portTICK_RATE_MS ), /* Timer period. */\r
+ pdTRUE, /* Autor-reload. */\r
+ ( void * ) uipARP_TIMER,\r
+ prvUIPTimerCallback\r
+ );\r
+\r
+ xPeriodicTimer = xTimerCreate( ( const signed char * const ) "PeriodicTimer",\r
+ ( 500 / portTICK_RATE_MS ),\r
+ pdTRUE, /* Autor-reload. */\r
+ ( void * ) uipPERIODIC_TIMER,\r
+ prvUIPTimerCallback\r
+ );\r
+\r
+ configASSERT( xARPTimer );\r
+ configASSERT( xPeriodicTimer );\r
+\r
+ xTimerStart( xARPTimer, portMAX_DELAY );\r
+ xTimerStart( xPeriodicTimer, portMAX_DELAY );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvUIPTimerCallback( xTimerHandle xTimer )\r
+{\r
+static const unsigned long ulARPTimerExpired = uipARP_TIMER_EVENT;\r
+static const unsigned long ulPeriodicTimerExpired = uipPERIODIC_TIMER_EVENT;\r
+\r
+ /* This is a time callback, so calls to xQueueSend() must not attempt to\r
+ block. */\r
+ switch( ( int ) pvTimerGetTimerID( xTimer ) )\r
+ {\r
+ case uipARP_TIMER : xQueueSend( xEMACEventQueue, &ulARPTimerExpired, uipDONT_BLOCK );\r
+ break;\r
+\r
+ case uipPERIODIC_TIMER : xQueueSend( xEMACEventQueue, &ulPeriodicTimerExpired, uipDONT_BLOCK );\r
+ break;\r
+\r
+ default : /* Should not get here. */\r
+ break;\r
+ }\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r