]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/PIC32MX_MPLAB/main_full.c
Update PIC32MX demo:
[freertos] / FreeRTOS / Demo / PIC32MX_MPLAB / main_full.c
index cfb1e8f907fb85e2fe55c73b78a7a899b5313a86..46f23cbbfeb1fc52b314d1436613392019870634 100644 (file)
@@ -166,9 +166,6 @@ in ticks using the portTICK_RATE_MS constant. */
 #define mainINTEGER_TASK_PRIORITY           ( tskIDLE_PRIORITY )\r
 #define mainGEN_QUEUE_TASK_PRIORITY                    ( tskIDLE_PRIORITY )\r
 \r
-/* The LED controlled by the 'check' software timer. */\r
-#define mainCHECK_LED                                          ( 7 )\r
-\r
 /* The LED used by the comtest tasks.  mainCOM_TEST_LED + 1 is also used.\r
 See the comtest.c file for more information. */\r
 #define mainCOM_TEST_LED                                       ( 4 )\r
@@ -194,8 +191,16 @@ test" interrupt. */
 #define mainNS_PER_CLOCK ( ( unsigned long ) ( ( 1.0 / ( double ) ( configCPU_CLOCK_HZ >> 1 ) ) * 1000000000.0 ) )\r
 \r
 /* The number of LEDs that should be controlled by the flash software timer\r
-standard demo. */\r
-#define mainNUM_FLASH_TIMER_LEDS                       ( 3 )\r
+standard demo and the LED to be toggle by the check task.  The starter kit only\r
+has three LEDs so when the demo is configured to run on the starter kit there\r
+is one less flash timer so the check task can use the third LED. */\r
+#ifdef PIC32_STARTER_KIT\r
+       #define mainNUM_FLASH_TIMER_LEDS                        ( 2 )\r
+       #define mainCHECK_LED                                           ( 2 )\r
+#else\r
+       #define mainNUM_FLASH_TIMER_LEDS                        ( 3 )\r
+       #define mainCHECK_LED                                           ( 7 )\r
+#endif\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -228,10 +233,6 @@ static void prvRegTestTask2( void *pvParameters );
 /* The queue used to send messages to the LCD task. */\r
 static xQueueHandle xLCDQueue;\r
 \r
-/* Flag used by prvRegTestTask1() and prvRegTestTask2() to indicate their status\r
-(pass/fail). */\r
-volatile unsigned long ulStatus1 = pdPASS;\r
-\r
 /* Variables incremented by prvRegTestTask1() and prvRegTestTask2() respectively on \r
 each iteration of their function.  This is used to detect either task stopping\r
 their execution.. */\r
@@ -308,15 +309,15 @@ static void prvRegTestTask1( void *pvParameters )
 {\r
 extern void vRegTest1( volatile unsigned long * );\r
 \r
-       for( ;; )\r
-       {\r
-               /* Perform the register test function. */\r
-               vRegTest1( &ulStatus1 );\r
+       /* Avoid compiler warnings. */\r
+       ( void ) pvParameters;\r
 \r
-               /* Increment the counter so the check task knows we are still \r
-               running. */\r
-               ulRegTest1Cycles++;\r
-       }\r
+       /* Pass the address of the RegTest1 loop counter into the test function,\r
+       which is necessarily implemented in assembler. */\r
+       vRegTest1( &ulRegTest1Cycles );\r
+\r
+       /* vRegTest1 should never exit! */\r
+       vTaskDelete( NULL );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -324,15 +325,15 @@ static void prvRegTestTask2( void *pvParameters )
 {\r
 extern void vRegTest2( volatile unsigned long * );\r
 \r
-       for( ;; )\r
-       {\r
-               /* Perform the register test function. */\r
-               vRegTest2( &ulStatus1 );\r
+       /* Avoid compiler warnings. */\r
+       ( void ) pvParameters;\r
 \r
-               /* Increment the counter so the check task knows we are still\r
-               running. */\r
-               ulRegTest2Cycles++;\r
-       }\r
+       /* Pass the address of the RegTest2 loop counter into the test function,\r
+       which is necessarily implemented in assembler. */\r
+       vRegTest2( &ulRegTest2Cycles );\r
+\r
+       /* vRegTest1 should never exit! */\r
+       vTaskDelete( NULL );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -348,12 +349,6 @@ static char cStringBuffer[ mainMAX_STRING_LENGTH ];
 extern unsigned long ulHighFrequencyTimerInterrupts;\r
 static xLCDMessage xMessage = { ( 200 / portTICK_RATE_MS ), cStringBuffer };\r
 \r
-       /* Has either register check 1 or 2 task discovered an error? */\r
-       if( ulStatus1 != pdPASS )\r
-       {\r
-               xMessage.pcMessage = "Error: Reg test1";\r
-       }\r
-\r
        /* Check that the register test 1 task is still running. */\r
        if( ulLastRegTest1Value == ulRegTest1Cycles )\r
        {\r
@@ -380,10 +375,6 @@ static xLCDMessage xMessage = { ( 200 / portTICK_RATE_MS ), cStringBuffer };
        {\r
                xMessage.pcMessage = "Error: Q Peek";\r
        }\r
-       else if( xAreComTestTasksStillRunning() != pdTRUE )\r
-       {\r
-               xMessage.pcMessage = "Error: COM test";\r
-       }\r
        else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
        {\r
                xMessage.pcMessage = "Error: Blck time";\r
@@ -396,6 +387,12 @@ static xLCDMessage xMessage = { ( 200 / portTICK_RATE_MS ), cStringBuffer };
        {\r
                xMessage.pcMessage = "Error: Int queue";\r
        }\r
+       #if !defined(__32MX795F512L__)\r
+               else if( xAreComTestTasksStillRunning() != pdTRUE )\r
+               {\r
+                       xMessage.pcMessage = "Error: COM test";\r
+               }\r
+       #endif\r
 \r
        if( xMessage.pcMessage != cStringBuffer )\r
        {\r