*\r
*/\r
\r
-\r
/* Scheduler includes. */\r
#include "FreeRTOS.h"\r
#include "task.h"\r
discover an unexpected value. */\r
static unsigned portBASE_TYPE xRegTestStatus = pdPASS;\r
\r
+/* Counters used to ensure the regtest tasks are still running. */\r
+static unsigned portLONG ulRegTest1Counter = 0UL, ulRegTest2Counter = 0UL;\r
+\r
/*-----------------------------------------------------------*/\r
\r
int main( void )\r
static portSHORT prvCheckOtherTasksAreStillRunning( void )\r
{\r
portBASE_TYPE lReturn = pdPASS;\r
+static unsigned portLONG ulLastRegTest1Counter= 0UL, ulLastRegTest2Counter = 0UL;\r
\r
/* The demo tasks maintain a count that increments every cycle of the task\r
provided that the task has never encountered an error. This function \r
lReturn = pdFAIL;\r
}\r
\r
+ /* Are the register test tasks still looping? */\r
+ if( ulLastRegTest1Counter == ulRegTest1Counter )\r
+ {\r
+ lReturn = pdFAIL;\r
+ }\r
+ else\r
+ {\r
+ ulLastRegTest1Counter = ulRegTest1Counter;\r
+ }\r
+\r
+ if( ulLastRegTest2Counter == ulRegTest2Counter )\r
+ {\r
+ lReturn = pdFAIL;\r
+ }\r
+ else\r
+ {\r
+ ulLastRegTest2Counter = ulRegTest2Counter;\r
+ }\r
+\r
return lReturn;\r
}\r
/*-----------------------------------------------------------*/\r
}\r
/*-----------------------------------------------------------*/\r
\r
+static void prvRegTest1Pass( void )\r
+{\r
+ ulRegTest1Counter++;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTest2Pass( void )\r
+{\r
+ ulRegTest2Counter++;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+static void prvRegTestFail( void )\r
+{\r
+ xRegTestStatus = pdFAIL;\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
static void prvRegTestTask1( void *pvParameters )\r
{\r
/* The first register test task as described at the top of this file. The\r
(\r
"RegTest1Start: \n\t" \\r
" \n\t" \\r
- " li 0, 101 \n\t" \\r
- " mtspr 27, 0 #SSR1 \n\t" \\r
- " li 0, 201 \n\t" \\r
- " mtspr 990, 0 #SSR2 \n\t" \\r
" li 0, 301 \n\t" \\r
" mtspr 256, 0 #USPRG0 \n\t" \\r
- " li 0, 401 \n\t" \\r
- " mtspr 9, 0 #CTR \n\t" \\r
" li 0, 501 \n\t" \\r
" mtspr 8, 0 #LR \n\t" \\r
- " li 0, 601 \n\t" \\r
+ " li 0, 4 \n\t" \\r
" mtspr 1, 0 #XER \n\t" \\r
- " li 0, 701 \n\t" \\r
- " mtcr 0 \n\t" \\r
" \n\t" \\r
" li 0, 1 \n\t" \\r
" li 2, 2 \n\t" \\r
" nop \n\t" \\r
" \n\t" \\r
" cmpwi 0, 1 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 2, 2 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 3, 3 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 4, 4 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 5, 5 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 6, 6 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 7, 7 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 8, 8 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 9, 9 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 10, 10 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 11, 11 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 12, 12 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 13, 13 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 14, 14 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 15, 15 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 16, 16 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 17, 17 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 18, 18 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 19, 19 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 20, 20 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 21, 21 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 22, 22 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 23, 23 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 24, 24 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 25, 25 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 26, 26 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 27, 27 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 28, 28 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 29, 29 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 30, 30 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" cmpwi 31, 31 \n\t" \\r
- " bne RegTest1Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" \n\t" \\r
- " mfspr 0, 27 #SSR1 \n\t" \\r
- " cmpwi 0, 101 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
- " mfspr 0, 990 #SSR2 \n\t" \\r
- " cmpwi 0, 201 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
" mfspr 0, 256 #USPRG0 \n\t" \\r
" cmpwi 0, 301 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
- " mfspr 0, 9 #CTR \n\t" \\r
- " cmpwi 0, 401 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" mfspr 0, 8 #LR \n\t" \\r
" cmpwi 0, 501 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" mfspr 0, 1 #XER \n\t" \\r
- " cmpwi 0, 601 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
- " mfcr 0 \n\t" \\r
- " cmpwi 0, 701 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " cmpwi 0, 4 \n\t" \\r
+ " bne RegTest1Fail \n\t" \\r
" \n\t" \\r
+ " bl prvRegTest1Pass \n\t" \\r
" b RegTest1Start \n\t" \\r
" \n\t" \\r
"RegTest1Fail: \n\t" \\r
" \n\t" \\r
- " xor 0, 0, 0 \n\t" \\r
- " stw 0, xRegTestStatus( 0 ) \n\t" \\r
" \n\t" \\r
+ " bl prvRegTestFail \n\t" \\r
" b RegTest1Start \n\t" \\r
);\r
}\r
(\r
"RegTest2Start: \n\t" \\r
" \n\t" \\r
- " li 0, 100 \n\t" \\r
- " mtspr 27, 0 #SSR1 \n\t" \\r
- " li 0, 200 \n\t" \\r
- " mtspr 990, 0 #SSR2 \n\t" \\r
" li 0, 300 \n\t" \\r
" mtspr 256, 0 #USPRG0 \n\t" \\r
- " li 0, 400 \n\t" \\r
- " mtspr 9, 0 #CTR \n\t" \\r
" li 0, 500 \n\t" \\r
" mtspr 8, 0 #LR \n\t" \\r
- " li 0, 600 \n\t" \\r
+ " li 0, 4 \n\t" \\r
" mtspr 1, 0 #XER \n\t" \\r
- " li 0, 700 \n\t" \\r
- " mtcr 0 \n\t" \\r
" \n\t" \\r
" li 0, 11 \n\t" \\r
" li 2, 12 \n\t" \\r
" li 31, 131 \n\t" \\r
" \n\t" \\r
" cmpwi 0, 11 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 2, 12 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 3, 13 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 4, 14 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 5, 15 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 6, 16 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 7, 17 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 8, 18 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 9, 19 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 10, 110 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 11, 111 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 12, 112 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 13, 113 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 14, 114 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 15, 115 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 16, 116 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 17, 117 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 18, 118 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 19, 119 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 20, 120 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 21, 121 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 22, 122 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 23, 123 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 24, 124 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 25, 125 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 26, 126 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 27, 127 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 28, 128 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 29, 129 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 30, 130 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" cmpwi 31, 131 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" \n\t" \\r
- " mfspr 0, 27 #SSR1 \n\t" \\r
- " cmpwi 0, 100 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
- " mfspr 0, 990 #SSR2 \n\t" \\r
- " cmpwi 0, 200 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
" mfspr 0, 256 #USPRG0 \n\t" \\r
" cmpwi 0, 300 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
- " mfspr 0, 9 #CTR \n\t" \\r
- " cmpwi 0, 400 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" mfspr 0, 8 #LR \n\t" \\r
" cmpwi 0, 500 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" mfspr 0, 1 #XER \n\t" \\r
- " cmpwi 0, 600 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
- " mfcr 0 \n\t" \\r
- " cmpwi 0, 700 \n\t" \\r
- " bne RegTest2Fail \n\t" \\r
+ " cmpwi 0, 4 \n\t" \\r
+ " bne RegTest2Fail \n\t" \\r
" \n\t" \\r
+ " bl prvRegTest2Pass \n\t" \\r
" b RegTest2Start \n\t" \\r
" \n\t" \\r
"RegTest2Fail: \n\t" \\r
" \n\t" \\r
- " xor 0, 0, 0 \n\t" \\r
- " stw 0, xRegTestStatus( 0 ) \n\t" \\r
" \n\t" \\r
+ " bl prvRegTestFail \n\t" \\r
" b RegTest2Start \n\t" \\r
);\r
}\r
void vApplicationStackOverflowHook( xTaskHandle xTask, signed portCHAR *pcTaskName );\r
void vApplicationStackOverflowHook( xTaskHandle xTask, signed portCHAR *pcTaskName )\r
{\r
+ /* The following three calls are simply to stop compiler warnings about the\r
+ functions not being used - they are called from the inline assembly. */\r
+ prvRegTest1Pass();\r
+ prvRegTest2Pass();\r
+ prvRegTestFail();\r
+\r
for( ;; );\r
}\r
\r
+\r
+\r