]> git.sur5r.net Git - freertos/blobdiff - Demo/MicroBlaze_Spartan-6_EthernetLite/SDKProjects/RTOSDemoSource/RegisterTests.c
Comment the peripheral helper files for the new MicroBlaze demo application.
[freertos] / Demo / MicroBlaze_Spartan-6_EthernetLite / SDKProjects / RTOSDemoSource / RegisterTests.c
index 906e306db221db7289eadead0eed5922a38771d8..1aa696a939ad138e8c3c4548320caca5fc014faa 100644 (file)
 #include "task.h"\r
 \r
 /*\r
- * The register test task as described at the top of this file.\r
+ * The register test task as described in the comments at the top of main-full.c.\r
  */\r
 void vRegisterTest1( void *pvParameters );\r
 void vRegisterTest2( void *pvParameters );\r
 \r
 /* Variables that are incremented on each iteration of the reg test tasks -\r
-provided the tasks have not reported any errors.  The check task inspects these\r
+provided the tasks have not reported any errors.  The check timer inspects these\r
 variables to ensure they are still incrementing as expected.  If a variable\r
-stops incrementing then it is likely that its associate task has stalled. */\r
+stops incrementing then it is likely that its associate task has stalled or\r
+detected an error. */\r
 volatile unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
 void vRegisterTest1( void *pvParameters )\r
 {\r
-//_RB_ Why can R5 not be used in this test?\r
-\r
        /* This task uses an infinite loop that is implemented in the assembly \r
        code.\r
        \r
-       First fill the registers with known values. */\r
+       First fill the relevant registers with known values. */\r
        asm volatile (  "       addi r3, r0, 3          \n\t" \\r
                                        "       addi r4, r0, 4          \n\t" \\r
                                        "       addi r6, r0, 6          \n\t" \\r
@@ -105,7 +104,10 @@ void vRegisterTest1( void *pvParameters )
        /* Now test the register values to ensure they contain the same value that\r
        was written to them above.       This task will get preempted frequently so \r
        other tasks are likely to have executed since the register values were \r
-       written. */\r
+       written.  If any register contains an unexpected value then the task will\r
+       branch to Error_Loop_1, which in turn prevents it from incrementing its\r
+       loop counter, enabling the check timer to determine that all is not as it\r
+       should be. */\r
 \r
        asm volatile (  "Loop_Start_1:                          \n\t" \\r
                                        "       xori r18, r3, 3                 \n\t" \\r
@@ -157,9 +159,9 @@ void vRegisterTest1( void *pvParameters )
                                 );\r
 \r
        /* If this task has not branched to the error loop, then everything is ok,\r
-       and the check variable should be incremented to indicate that this task\r
-       is still running.  Then, brach back to the top to check the registers\r
-       again. */\r
+       and the check variable can be incremented to indicate that this task\r
+       is still running.  Then, brach back to the top to check the register\r
+       contents again. */\r
        asm volatile (  "       lwi r18, r0, ulRegTest1CycleCount       \n\t" \\r
                                        "       addik r18, r18, 1                                       \n\t" \\r
                                        "       swi r18, r0, ulRegTest1CycleCount       \n\t" \\r
@@ -202,8 +204,13 @@ void vRegisterTest2( void *pvParameters )
                                        "Loop_Start_2:                          "\r
                                );\r
 \r
+       /* Unlike vRegisterTest1, vRegisterTest2 performs a yield.  This increases\r
+       the test coverage, but does mean volatile registers need re-loading with \r
+       their exepcted values. */\r
        taskYIELD();\r
 \r
+       /* taskYIELD() could have changed temporaries - set them back to those\r
+       expected by the reg test task. */\r
        asm volatile (  "       addi r3, r0, 103        \n\t" \\r
                                        "       addi r4, r0, 104        \n\t" \\r
                                        "       addi r6, r0, 106        \n\t" \\r
@@ -215,8 +222,6 @@ void vRegisterTest2( void *pvParameters )
                                        "       addi r12, r0, 1012      \n\t" \\r
                                );\r
 \r
-       /* taskYIELD() could have changed temporaries - set them back to those\r
-       expected by the reg test task. */\r
 \r
        /* Now test the register values to ensure they contain the same value that\r
        was written to them above.       This task will get preempted frequently so \r