/*\r
- FreeRTOS V8.2.1 - 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
\r
FreeRTOS is free software; you can redistribute it and/or modify it under\r
the terms of the GNU General Public License (version 2) as published by the\r
- Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+ Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
\r
***************************************************************************\r
>>! NOTE: The modification to the GPL is included to allow you to !<<\r
\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
/* 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
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
BaseType_t xError = pdFALSE;\r
\r
for( ;; )\r
- { \r
+ {\r
/* Loop until the queue is empty. */\r
while( uxQueueMessagesWaiting( *( ( QueueHandle_t * ) pvParameters ) ) )\r
{\r