/*\r
- FreeRTOS V8.2.0 - 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
+ ***************************************************************************\r
>>! NOTE: The modification to the GPL is included to allow you to !<<\r
>>! distribute a combined work that includes FreeRTOS without being !<<\r
>>! obliged to provide the source code for proprietary components !<<\r
>>! outside of the FreeRTOS kernel. !<<\r
- ***************************************************************************\r
+ ***************************************************************************\r
\r
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
***************************************************************************\r
\r
http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading\r
- the FAQ page "My application does not run, what could be wrong?". Have you\r
- defined configASSERT()?\r
+ the FAQ page "My application does not run, what could be wrong?". Have you\r
+ defined configASSERT()?\r
\r
- http://www.FreeRTOS.org/support - In return for receiving this top quality\r
- embedded software for free we request you assist our global community by\r
- participating in the support forum.\r
+ http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+ embedded software for free we request you assist our global community by\r
+ participating in the support forum.\r
\r
- http://www.FreeRTOS.org/training - Investing in training allows your team to\r
- be as productive as possible as early as possible. Now you can receive\r
- FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
- Ltd, and the world's leading authority on the world's leading RTOS.\r
+ http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+ be as productive as possible as early as possible. Now you can receive\r
+ FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+ Ltd, and the world's leading authority on the world's leading RTOS.\r
\r
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
/* A delay inserted when the Tx task changes its priority to be above the idle\r
task priority to ensure the idle priority tasks get some CPU time before the\r
next iteration of the queue set Tx task. */\r
-#define queuesetTX_LOOP_DELAY ( 200 / portTICK_PERIOD_MS )\r
+#define queuesetTX_LOOP_DELAY pdMS_TO_TICKS( ( TickType_t ) 200 )\r
\r
/* The allowable maximum deviation between a received value and the expected\r
received value. A deviation will occur when data is received from a queue\r
* Local pseudo random number seed and return functions. Used to avoid calls\r
* to the standard library.\r
*/\r
-static uint32_t prvRand( void );\r
-static void prvSRand( uint32_t ulSeed );\r
+static size_t prvRand( void );\r
+static void prvSRand( size_t uxSeed );\r
\r
/*-----------------------------------------------------------*/\r
\r
static volatile uint32_t ulISRTxValue = queuesetINITIAL_ISR_TX_VALUE;\r
\r
/* Used by the pseudo random number generator. */\r
-static uint32_t ulNextRand = 0;\r
+static size_t uxNextRand = 0;\r
\r
/* The task handles are stored so their priorities can be changed. */\r
TaskHandle_t xQueueSetSendingTask, xQueueSetReceivingTask;\r
{\r
/* Create the tasks. */\r
xTaskCreate( prvQueueSetSendingTask, "SetTx", configMINIMAL_STACK_SIZE, NULL, queuesetMEDIUM_PRIORITY, &xQueueSetSendingTask );\r
- xTaskCreate( prvQueueSetReceivingTask, "SetRx", configMINIMAL_STACK_SIZE, ( void * ) xQueueSetSendingTask, queuesetMEDIUM_PRIORITY, &xQueueSetReceivingTask );\r
-\r
- /* It is important that the sending task does not attempt to write to a\r
- queue before the queue has been created. It is therefore placed into the\r
- suspended state before the scheduler has started. It is resumed by the\r
- receiving task after the receiving task has created the queues and added the\r
- queues to the queue set. */\r
- vTaskSuspend( xQueueSetSendingTask );\r
+\r
+ if( xQueueSetSendingTask != NULL )\r
+ {\r
+ xTaskCreate( prvQueueSetReceivingTask, "SetRx", configMINIMAL_STACK_SIZE, ( void * ) xQueueSetSendingTask, queuesetMEDIUM_PRIORITY, &xQueueSetReceivingTask );\r
+\r
+ /* It is important that the sending task does not attempt to write to a\r
+ queue before the queue has been created. It is therefore placed into\r
+ the suspended state before the scheduler has started. It is resumed by\r
+ the receiving task after the receiving task has created the queues and\r
+ added the queues to the queue set. */\r
+ vTaskSuspend( xQueueSetSendingTask );\r
+ }\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
static void prvQueueSetSendingTask( void *pvParameters )\r
{\r
-uint32_t ulTaskTxValue = 0, ulQueueToWriteTo;\r
+uint32_t ulTaskTxValue = 0;\r
+size_t uxQueueToWriteTo;\r
QueueHandle_t xQueueInUse;\r
\r
/* Remove compiler warning about the unused parameter. */\r
( void ) pvParameters;\r
\r
/* Seed mini pseudo random number generator. */\r
- prvSRand( ( uint32_t ) &ulTaskTxValue );\r
+ prvSRand( ( size_t ) &ulTaskTxValue );\r
\r
for( ;; )\r
{\r
/* Generate the index for the queue to which a value is to be sent. */\r
- ulQueueToWriteTo = prvRand() % queuesetNUM_QUEUES_IN_SET;\r
- xQueueInUse = xQueues[ ulQueueToWriteTo ];\r
+ uxQueueToWriteTo = prvRand() % queuesetNUM_QUEUES_IN_SET;\r
+ xQueueInUse = xQueues[ uxQueueToWriteTo ];\r
\r
/* Note which index is being written to to ensure all the queues are\r
used. */\r
- ( ulQueueUsedCounter[ ulQueueToWriteTo ] )++;\r
+ ( ulQueueUsedCounter[ uxQueueToWriteTo ] )++;\r
\r
/* Send to the queue to unblock the task that is waiting for data to\r
arrive on a queue within the queue set to which this queue belongs. */\r
}\r
\r
/* Wait for a message to arrive on one of the queues in the set. */\r
- xActivatedQueue = xQueueSelectFromSet( xQueueSet, portMAX_DELAY ); \r
+ xActivatedQueue = xQueueSelectFromSet( xQueueSet, portMAX_DELAY );\r
\r
if( xActivatedQueue == NULL )\r
{\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static uint32_t prvRand( void )\r
+static size_t prvRand( void )\r
{\r
- ulNextRand = ( ulNextRand * 1103515245UL ) + 12345UL;\r
- return ( ulNextRand / 65536UL ) % 32768UL;\r
+ uxNextRand = ( uxNextRand * ( size_t ) 1103515245 ) + ( size_t ) 12345;\r
+ return ( uxNextRand / ( size_t ) 65536 ) % ( size_t ) 32768;\r
}\r
/*-----------------------------------------------------------*/\r
\r
-static void prvSRand( uint32_t ulSeed )\r
+static void prvSRand( size_t uxSeed )\r
{\r
- ulNextRand = ulSeed;\r
+ uxNextRand = uxSeed;\r
}\r
\r