*/\r
extern void vUARTCommandConsoleStart( uint16_t usStackSize, UBaseType_t uxPriority );\r
\r
+/*\r
+ * A high priority task that does nothing other than execute at a pseudo random\r
+ * time to ensure the other test tasks don't just execute in a repeating\r
+ * pattern.\r
+ */\r
+static void prvPseudoRandomiser( void *pvParameters );\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* The following two variables are used to communicate the status of the\r
xTaskCreate( prvRegTestTaskEntry1, "Reg1", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_1_PARAMETER, tskIDLE_PRIORITY, NULL );\r
xTaskCreate( prvRegTestTaskEntry2, "Reg2", configMINIMAL_STACK_SIZE, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
\r
+ /* Create the task that just adds a little random behaviour. */\r
+ xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );\r
+\r
/* Create the task that performs the 'check' functionality, as described at\r
the top of this file. */\r
xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
}\r
/*-----------------------------------------------------------*/\r
\r
+static void prvPseudoRandomiser( void *pvParameters )\r
+{\r
+const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = ( 35 / portTICK_PERIOD_MS );\r
+volatile uint32_t ulNextRand = ( uint32_t ) &pvParameters, ulValue;\r
+\r
+ /* This task does nothing other than ensure there is a little bit of\r
+ disruption in the scheduling pattern of the other tasks. Normally this is\r
+ done by generating interrupts at pseudo random times. */\r
+ for( ;; )\r
+ {\r
+ ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;\r
+ ulValue = ( ulNextRand >> 16UL ) & 0xffUL;\r
+\r
+ if( ulValue < ulMinDelay )\r
+ {\r
+ ulValue = ulMinDelay;\r
+ }\r
+\r
+ vTaskDelay( ulValue );\r
+\r
+ while( ulValue > 0 )\r
+ {\r
+ __asm volatile( "NOP" );\r
+ __asm volatile( "NOP" );\r
+ __asm volatile( "NOP" );\r
+ __asm volatile( "NOP" );\r
+\r
+ ulValue--;\r
+ }\r
+ }\r
+}\r
+\r
+\r
+\r
\r
\r
\r
for( x = 0; x < ulBytes; x++ )
{
- *pcDest = ( unsigned char ) c;
+ *pcDest = ( unsigned char ) iValue;
pcDest++;
}
}
/*-----------------------------------------------------------*/
-int memcmp( const void *pvMem1, const void *pvMem2 ,size_t ulBytes )
+int memcmp( const void *pvMem1, const void *pvMem2, size_t ulBytes )
{
const unsigned char *pucMem1 = pvMem1, *pucMem2 = pvMem2;
size_t x;
}
}
- return n - x;
+ return ulBytes - x;
}