]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/Common/Minimal/PollQ.c
Update version number to 9.0.0rc2.
[freertos] / FreeRTOS / Demo / Common / Minimal / PollQ.c
index 699b37fd45183fa13c30eb32bdacb6bd32eaaa85..9e575e0e6647eda1719fabc6ce85038cb81cacb0 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
@@ -109,7 +109,7 @@ Changes from V2.0.0
 \r
 #define pollqSTACK_SIZE                        configMINIMAL_STACK_SIZE\r
 #define pollqQUEUE_SIZE                        ( 10 )\r
-#define pollqPRODUCER_DELAY            ( ( TickType_t ) 200 / portTICK_PERIOD_MS )\r
+#define pollqPRODUCER_DELAY            ( pdMS_TO_TICKS( ( TickType_t ) 200 ) )\r
 #define pollqCONSUMER_DELAY            ( pollqPRODUCER_DELAY - ( TickType_t ) ( 20 / portTICK_PERIOD_MS ) )\r
 #define pollqNO_DELAY                  ( ( TickType_t ) 0 )\r
 #define pollqVALUES_TO_PRODUCE ( ( BaseType_t ) 3 )\r
@@ -134,17 +134,20 @@ static QueueHandle_t xPolledQueue;
        /* Create the queue used by the producer and consumer. */\r
        xPolledQueue = xQueueCreate( pollqQUEUE_SIZE, ( UBaseType_t ) sizeof( uint16_t ) );\r
 \r
-       /* vQueueAddToRegistry() adds the queue to the queue registry, if one is\r
-       in use.  The queue registry is provided as a means for kernel aware \r
-       debuggers to locate queues and has no purpose if a kernel aware debugger\r
-       is not being used.  The call to vQueueAddToRegistry() will be removed\r
-       by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is \r
-       defined to be less than 1. */\r
-       vQueueAddToRegistry( xPolledQueue, "Poll_Test_Queue" );\r
-\r
-       /* Spawn the producer and consumer. */\r
-       xTaskCreate( vPolledQueueConsumer, "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );\r
-       xTaskCreate( vPolledQueueProducer, "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );\r
+       if( xPolledQueue != NULL )\r
+       {\r
+               /* vQueueAddToRegistry() adds the queue to the queue registry, if one is\r
+               in use.  The queue registry is provided as a means for kernel aware\r
+               debuggers to locate queues and has no purpose if a kernel aware debugger\r
+               is not being used.  The call to vQueueAddToRegistry() will be removed\r
+               by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is\r
+               defined to be less than 1. */\r
+               vQueueAddToRegistry( xPolledQueue, "Poll_Test_Queue" );\r
+\r
+               /* Spawn the producer and consumer. */\r
+               xTaskCreate( vPolledQueueConsumer, "QConsNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );\r
+               xTaskCreate( vPolledQueueProducer, "QProdNB", pollqSTACK_SIZE, ( void * ) &xPolledQueue, uxPriority, ( TaskHandle_t * ) NULL );\r
+       }\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -154,7 +157,7 @@ uint16_t usValue = ( uint16_t ) 0;
 BaseType_t xError = pdFALSE, xLoop;\r
 \r
        for( ;; )\r
-       {               \r
+       {\r
                for( xLoop = 0; xLoop < pollqVALUES_TO_PRODUCE; xLoop++ )\r
                {\r
                        /* Send an incrementing number on the queue without blocking. */\r
@@ -193,7 +196,7 @@ uint16_t usData, usExpectedValue = ( uint16_t ) 0;
 BaseType_t xError = pdFALSE;\r
 \r
        for( ;; )\r
-       {               \r
+       {\r
                /* Loop until the queue is empty. */\r
                while( uxQueueMessagesWaiting( *( ( QueueHandle_t * ) pvParameters ) ) )\r
                {\r