\r
/* Buffers into which the flop registers will be saved. There is a buffer for \r
both tasks. */\r
-static unsigned portLONG ulFlopRegisters[ flopNUMBER_OF_TASKS ][ portNO_FLOP_REGISTERS_TO_SAVE ] = { 0 };\r
+static volatile unsigned portLONG ulFlopRegisters[ flopNUMBER_OF_TASKS ][ portNO_FLOP_REGISTERS_TO_SAVE ] = { 0 };\r
\r
/* Variables that are incremented by the tasks to indicate that they are still\r
running. */\r
back the next time the task runs. Being preempted during this memset\r
could cause the test to fail, hence the critical section. */\r
portENTER_CRITICAL();\r
- memset( ulFlopRegisters[ 0 ], 0x00, ( portNO_FLOP_REGISTERS_TO_SAVE * sizeof( unsigned portBASE_TYPE ) ) );\r
+ memset( ( void * ) ulFlopRegisters[ 0 ], 0x00, ( portNO_FLOP_REGISTERS_TO_SAVE * sizeof( unsigned portBASE_TYPE ) ) );\r
portEXIT_CRITICAL();\r
\r
/* We don't have to do anything other than indicate that we are \r
registers. Clear the buffer to ensure the same values then get written\r
back the next time the task runs. */\r
portENTER_CRITICAL();\r
- memset( ulFlopRegisters[ 1 ], 0x00, ( portNO_FLOP_REGISTERS_TO_SAVE * sizeof( unsigned portBASE_TYPE ) ) );\r
+ memset( ( void * ) ulFlopRegisters[ 1 ], 0x00, ( portNO_FLOP_REGISTERS_TO_SAVE * sizeof( unsigned portBASE_TYPE ) ) );\r
portEXIT_CRITICAL();\r
\r
/* We don't have to do anything other than indicate that we are \r
{\r
portBASE_TYPE xReturn = pdPASS;\r
unsigned portBASE_TYPE x, y, z = flopSTART_VALUE;\r
+static unsigned portLONG ulLastFlop1CycleCount = 0, ulLastFlop2CycleCount = 0;\r
\r
/* Called from the 'check' task.\r
\r
\r
/* Check both tasks have actually been swapped in and out since this function\r
last executed. */\r
- if( ulFlop1CycleCount == 0 )\r
+ if( ulFlop1CycleCount == ulLastFlop1CycleCount )\r
{\r
xReturn = pdFAIL;\r
}\r
\r
- if( ulFlop2CycleCount == 0 )\r
+ if( ulFlop2CycleCount == ulLastFlop2CycleCount )\r
{\r
xReturn = pdFAIL;\r
}\r
\r
- ulFlop1CycleCount = 0;\r
- ulFlop2CycleCount = 0;\r
+ ulLastFlop1CycleCount = ulFlop1CycleCount;\r
+ ulLastFlop2CycleCount = ulFlop2CycleCount;\r
}\r
\r
\r
static portTASK_FUNCTION( vCompetingMathTask1, pvParameters )\r
{\r
-volatile portFLOAT d1, d2, d3, d4;\r
+volatile portFLOAT ff1, ff2, ff3, ff4;\r
volatile unsigned portSHORT *pusTaskCheckVariable;\r
-volatile portFLOAT dAnswer;\r
+volatile portFLOAT fAnswer;\r
portSHORT sError = pdFALSE;\r
\r
- d1 = 123.4567;\r
- d2 = 2345.6789;\r
- d3 = -918.222;\r
+ ff1 = 123.4567F;\r
+ ff2 = 2345.6789F;\r
+ ff3 = -918.222F;\r
\r
- dAnswer = ( d1 + d2 ) * d3;\r
+ fAnswer = ( ff1 + ff2 ) * ff3;\r
\r
/* The variable this task increments to show it is still running is passed in \r
as the parameter. */\r
/* Keep performing a calculation and checking the result against a constant. */\r
for(;;)\r
{\r
- d1 = 123.4567;\r
- d2 = 2345.6789;\r
- d3 = -918.222;\r
+ ff1 = 123.4567F;\r
+ ff2 = 2345.6789F;\r
+ ff3 = -918.222F;\r
\r
- d4 = ( d1 + d2 ) * d3;\r
+ ff4 = ( ff1 + ff2 ) * ff3;\r
\r
#if configUSE_PREEMPTION == 0\r
taskYIELD();\r
\r
/* If the calculation does not match the expected constant, stop the \r
increment of the check variable. */\r
- if( fabs( d4 - dAnswer ) > 0.001 )\r
+ if( fabs( ff4 - fAnswer ) > 0.001F )\r
{\r
sError = pdTRUE;\r
}\r
\r
static portTASK_FUNCTION( vCompetingMathTask2, pvParameters )\r
{\r
-volatile portFLOAT d1, d2, d3, d4;\r
+volatile portFLOAT ff1, ff2, ff3, ff4;\r
volatile unsigned portSHORT *pusTaskCheckVariable;\r
-volatile portFLOAT dAnswer;\r
+volatile portFLOAT fAnswer;\r
portSHORT sError = pdFALSE;\r
\r
- d1 = -389.38;\r
- d2 = 32498.2;\r
- d3 = -2.0001;\r
+ ff1 = -389.38F;\r
+ ff2 = 32498.2F;\r
+ ff3 = -2.0001F;\r
\r
- dAnswer = ( d1 / d2 ) * d3;\r
+ fAnswer = ( ff1 / ff2 ) * ff3;\r
\r
\r
/* The variable this task increments to show it is still running is passed in \r
/* Keep performing a calculation and checking the result against a constant. */\r
for( ;; )\r
{\r
- d1 = -389.38;\r
- d2 = 32498.2;\r
- d3 = -2.0001;\r
+ ff1 = -389.38F;\r
+ ff2 = 32498.2F;\r
+ ff3 = -2.0001F;\r
\r
- d4 = ( d1 / d2 ) * d3;\r
+ ff4 = ( ff1 / ff2 ) * ff3;\r
\r
#if configUSE_PREEMPTION == 0\r
taskYIELD();\r
\r
/* If the calculation does not match the expected constant, stop the \r
increment of the check variable. */\r
- if( fabs( d4 - dAnswer ) > 0.001 )\r
+ if( fabs( ff4 - fAnswer ) > 0.001F )\r
{\r
sError = pdTRUE;\r
}\r
\r
static portTASK_FUNCTION( vCompetingMathTask3, pvParameters )\r
{\r
-volatile portFLOAT *pdArray, dTotal1, dTotal2, dDifference;\r
+volatile portFLOAT *pfArray, fTotal1, fTotal2, fDifference;\r
volatile unsigned portSHORT *pusTaskCheckVariable;\r
const size_t xArraySize = 10;\r
size_t xPosition;\r
as the parameter. */\r
pusTaskCheckVariable = ( unsigned portSHORT * ) pvParameters;\r
\r
- pdArray = ( portFLOAT * ) pvPortMalloc( xArraySize * sizeof( portFLOAT ) );\r
+ pfArray = ( portFLOAT * ) pvPortMalloc( xArraySize * sizeof( portFLOAT ) );\r
\r
/* Keep filling an array, keeping a running total of the values placed in the \r
array. Then run through the array adding up all the values. If the two totals \r
do not match, stop the check variable from incrementing. */\r
for( ;; )\r
{\r
- dTotal1 = 0.0;\r
- dTotal2 = 0.0;\r
+ fTotal1 = 0.0F;\r
+ fTotal2 = 0.0F;\r
\r
for( xPosition = 0; xPosition < xArraySize; xPosition++ )\r
{\r
- pdArray[ xPosition ] = ( portFLOAT ) xPosition + 5.5;\r
- dTotal1 += ( portFLOAT ) xPosition + 5.5; \r
+ pfArray[ xPosition ] = ( portFLOAT ) xPosition + 5.5F;\r
+ fTotal1 += ( portFLOAT ) xPosition + 5.5F; \r
}\r
\r
#if configUSE_PREEMPTION == 0\r
\r
for( xPosition = 0; xPosition < xArraySize; xPosition++ )\r
{\r
- dTotal2 += pdArray[ xPosition ];\r
+ fTotal2 += pfArray[ xPosition ];\r
}\r
\r
- dDifference = dTotal1 - dTotal2;\r
- if( fabs( dDifference ) > 0.001 )\r
+ fDifference = fTotal1 - fTotal2;\r
+ if( fabs( fDifference ) > 0.001F )\r
{\r
sError = pdTRUE;\r
}\r
\r
static portTASK_FUNCTION( vCompetingMathTask4, pvParameters )\r
{\r
-volatile portFLOAT *pdArray, dTotal1, dTotal2, dDifference;\r
+volatile portFLOAT *pfArray, fTotal1, fTotal2, fDifference;\r
volatile unsigned portSHORT *pusTaskCheckVariable;\r
const size_t xArraySize = 10;\r
size_t xPosition;\r
as the parameter. */\r
pusTaskCheckVariable = ( unsigned portSHORT * ) pvParameters;\r
\r
- pdArray = ( portFLOAT * ) pvPortMalloc( xArraySize * sizeof( portFLOAT ) );\r
+ pfArray = ( portFLOAT * ) pvPortMalloc( xArraySize * sizeof( portFLOAT ) );\r
\r
/* Keep filling an array, keeping a running total of the values placed in the \r
array. Then run through the array adding up all the values. If the two totals \r
do not match, stop the check variable from incrementing. */\r
for( ;; )\r
{\r
- dTotal1 = 0.0;\r
- dTotal2 = 0.0;\r
+ fTotal1 = 0.0F;\r
+ fTotal2 = 0.0F;\r
\r
for( xPosition = 0; xPosition < xArraySize; xPosition++ )\r
{\r
- pdArray[ xPosition ] = ( portFLOAT ) xPosition * 12.123;\r
- dTotal1 += ( portFLOAT ) xPosition * 12.123; \r
+ pfArray[ xPosition ] = ( portFLOAT ) xPosition * 12.123F;\r
+ fTotal1 += ( portFLOAT ) xPosition * 12.123F; \r
}\r
\r
#if configUSE_PREEMPTION == 0\r
\r
for( xPosition = 0; xPosition < xArraySize; xPosition++ )\r
{\r
- dTotal2 += pdArray[ xPosition ];\r
+ fTotal2 += pfArray[ xPosition ];\r
}\r
\r
- dDifference = dTotal1 - dTotal2;\r
- if( fabs( dDifference ) > 0.001 )\r
+ fDifference = fTotal1 - fTotal2;\r
+ if( fabs( fDifference ) > 0.001F )\r
{\r
sError = pdTRUE;\r
}\r