/* These variables are used to check that all the tasks are still running. If a \r
task gets a calculation wrong it will\r
stop incrementing its check variable. */\r
-static volatile unsigned short usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };\r
+static volatile unsigned long ulTaskCheck[ mathNUMBER_OF_TASKS ] = { 0 };\r
\r
/* Must be called before any hardware floating point operations are\r
performed to let the RTOS portable layer know that this task requires\r
\r
void vStartMathTasks( unsigned portBASE_TYPE uxPriority )\r
{\r
- xTaskCreate( vCompetingMathTask1, ( signed char * ) "Math1", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 0 ] ), uxPriority, NULL );\r
- xTaskCreate( vCompetingMathTask2, ( signed char * ) "Math2", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 1 ] ), uxPriority, NULL );\r
- xTaskCreate( vCompetingMathTask3, ( signed char * ) "Math3", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 2 ] ), uxPriority, NULL );\r
- xTaskCreate( vCompetingMathTask4, ( signed char * ) "Math4", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 3 ] ), uxPriority, NULL );\r
- xTaskCreate( vCompetingMathTask1, ( signed char * ) "Math5", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 4 ] ), uxPriority, NULL );\r
- xTaskCreate( vCompetingMathTask2, ( signed char * ) "Math6", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 5 ] ), uxPriority, NULL );\r
- xTaskCreate( vCompetingMathTask3, ( signed char * ) "Math7", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 6 ] ), uxPriority, NULL );\r
- xTaskCreate( vCompetingMathTask4, ( signed char * ) "Math8", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 7 ] ), uxPriority, NULL );\r
+ xTaskCreate( vCompetingMathTask1, ( signed char * ) "Math1", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 0 ] ), uxPriority, NULL );\r
+ xTaskCreate( vCompetingMathTask2, ( signed char * ) "Math2", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 1 ] ), uxPriority, NULL );\r
+ xTaskCreate( vCompetingMathTask3, ( signed char * ) "Math3", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 2 ] ), uxPriority, NULL );\r
+ xTaskCreate( vCompetingMathTask4, ( signed char * ) "Math4", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 3 ] ), uxPriority, NULL );\r
+ xTaskCreate( vCompetingMathTask1, ( signed char * ) "Math5", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 4 ] ), uxPriority, NULL );\r
+ xTaskCreate( vCompetingMathTask2, ( signed char * ) "Math6", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 5 ] ), uxPriority, NULL );\r
+ xTaskCreate( vCompetingMathTask3, ( signed char * ) "Math7", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 6 ] ), uxPriority, NULL );\r
+ xTaskCreate( vCompetingMathTask4, ( signed char * ) "Math8", mathSTACK_SIZE, ( void * ) &( ulTaskCheck[ 7 ] ), uxPriority, NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
static portTASK_FUNCTION( vCompetingMathTask1, pvParameters )\r
{\r
volatile portDOUBLE d1, d2, d3, d4;\r
-volatile unsigned short *pusTaskCheckVariable;\r
+volatile unsigned long *pulTaskCheckVariable;\r
volatile portDOUBLE dAnswer;\r
short sError = pdFALSE;\r
\r
\r
/* The variable this task increments to show it is still running is passed in \r
as the parameter. */\r
- pusTaskCheckVariable = ( unsigned short * ) pvParameters;\r
+ pulTaskCheckVariable = ( unsigned long * ) pvParameters;\r
\r
/* Keep performing a calculation and checking the result against a constant. */\r
for(;;)\r
{\r
/* If the calculation has always been correct, increment the check \r
variable so we know this task is still running okay. */\r
- ( *pusTaskCheckVariable )++;\r
+ ( *pulTaskCheckVariable )++;\r
}\r
\r
#if configUSE_PREEMPTION == 0\r
static portTASK_FUNCTION( vCompetingMathTask2, pvParameters )\r
{\r
volatile portDOUBLE d1, d2, d3, d4;\r
-volatile unsigned short *pusTaskCheckVariable;\r
+volatile unsigned long *pulTaskCheckVariable;\r
volatile portDOUBLE dAnswer;\r
short sError = pdFALSE;\r
\r
\r
/* The variable this task increments to show it is still running is passed in \r
as the parameter. */\r
- pusTaskCheckVariable = ( unsigned short * ) pvParameters;\r
+ pulTaskCheckVariable = ( unsigned long * ) pvParameters;\r
\r
/* Keep performing a calculation and checking the result against a constant. */\r
for( ;; )\r
/* If the calculation has always been correct, increment the check \r
variable so we know\r
this task is still running okay. */\r
- ( *pusTaskCheckVariable )++;\r
+ ( *pulTaskCheckVariable )++;\r
}\r
\r
#if configUSE_PREEMPTION == 0\r
static portTASK_FUNCTION( vCompetingMathTask3, pvParameters )\r
{\r
volatile portDOUBLE *pdArray, dTotal1, dTotal2, dDifference;\r
-volatile unsigned short *pusTaskCheckVariable;\r
+volatile unsigned long *pulTaskCheckVariable;\r
const size_t xArraySize = 10;\r
size_t xPosition;\r
short sError = pdFALSE;\r
\r
/* The variable this task increments to show it is still running is passed in \r
as the parameter. */\r
- pusTaskCheckVariable = ( unsigned short * ) pvParameters;\r
+ pulTaskCheckVariable = ( unsigned long * ) pvParameters;\r
\r
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );\r
\r
{\r
/* If the calculation has always been correct, increment the check \r
variable so we know this task is still running okay. */\r
- ( *pusTaskCheckVariable )++;\r
+ ( *pulTaskCheckVariable )++;\r
}\r
}\r
}\r
static portTASK_FUNCTION( vCompetingMathTask4, pvParameters )\r
{\r
volatile portDOUBLE *pdArray, dTotal1, dTotal2, dDifference;\r
-volatile unsigned short *pusTaskCheckVariable;\r
+volatile unsigned long *pulTaskCheckVariable;\r
const size_t xArraySize = 10;\r
size_t xPosition;\r
short sError = pdFALSE;\r
\r
/* The variable this task increments to show it is still running is passed in \r
as the parameter. */\r
- pusTaskCheckVariable = ( unsigned short * ) pvParameters;\r
+ pulTaskCheckVariable = ( unsigned long * ) pvParameters;\r
\r
pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );\r
\r
{\r
/* If the calculation has always been correct, increment the check \r
variable so we know this task is still running okay. */\r
- ( *pusTaskCheckVariable )++;\r
+ ( *pulTaskCheckVariable )++;\r
}\r
}\r
} \r
{\r
/* Keep a history of the check variables so we know if they have been incremented \r
since the last call. */\r
-static unsigned short usLastTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };\r
+static unsigned long ulLastTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };\r
portBASE_TYPE xReturn = pdTRUE, xTask;\r
\r
/* Check the maths tasks are still running by ensuring their check variables \r
are still incrementing. */\r
for( xTask = 0; xTask < mathNUMBER_OF_TASKS; xTask++ )\r
{\r
- if( usTaskCheck[ xTask ] == usLastTaskCheck[ xTask ] )\r
+ if( ulTaskCheck[ xTask ] == ulLastTaskCheck[ xTask ] )\r
{\r
/* The check has not incremented so an error exists. */\r
xReturn = pdFALSE;\r
}\r
\r
- usLastTaskCheck[ xTask ] = usTaskCheck[ xTask ];\r
+ ulLastTaskCheck[ xTask ] = ulTaskCheck[ xTask ];\r
}\r
\r
return xReturn;\r