]> git.sur5r.net Git - freertos/blobdiff - Demo/MB91460_Softune/SRC/main.c
Get the trace utility and co-routines working.
[freertos] / Demo / MB91460_Softune / SRC / main.c
index 4f2e2cd4f47f9d717fcd69d057fd1b1184309faa..ddb26fdb54e737ad069d911c8d0ffbb1d29caa05 100644 (file)
@@ -83,7 +83,6 @@
 #include "flash.h"\r
 #include "integer.h"\r
 #include "comtest2.h"\r
-#include "PollQ.h"\r
 #include "semtest.h"\r
 #include "BlockQ.h"\r
 #include "dynamic.h"\r
 #include "death.h"\r
 #include "taskutility.h"\r
 #include "partest.h"\r
+#include "crflash.h"\r
        \r
 /* Demo task priorities. */\r
 #define mainWATCHDOG_TASK_PRIORITY             ( tskIDLE_PRIORITY + 5 )\r
 #define mainCHECK_TASK_PRIORITY                        ( tskIDLE_PRIORITY + 4 )\r
-#define mainUTILITY_TASK_PRIORITY              ( tskIDLE_PRIORITY + 3 )\r
+#define mainUTILITY_TASK_PRIORITY              ( tskIDLE_PRIORITY )\r
 #define mainSEM_TEST_PRIORITY                  ( tskIDLE_PRIORITY + 3 )\r
 #define mainCOM_TEST_PRIORITY                  ( tskIDLE_PRIORITY + 2 )\r
-#define mainQUEUE_POLL_PRIORITY                        ( tskIDLE_PRIORITY + 2 )\r
 #define mainQUEUE_BLOCK_PRIORITY               ( tskIDLE_PRIORITY + 2 )\r
 #define mainDEATH_PRIORITY                             ( tskIDLE_PRIORITY + 1 )\r
 #define mainLED_TASK_PRIORITY                  ( tskIDLE_PRIORITY + 1 )\r
@@ -130,6 +129,9 @@ LCD represent LEDs]*/
 /* The number of interrupt levels to use. */\r
 #define mainINTERRUPT_LEVELS   ( 31 )\r
 \r
+/* The number of 'flash' co-routines to create - each toggles a different LED. */\r
+#define mainNUM_FLASH_CO_ROUTINES      ( 8 )\r
+\r
 /*---------------------------------------------------------------------------*/\r
 \r
 /* \r
@@ -164,9 +166,6 @@ static void vSecondRegisterTestTask( void *pvParameters );
 register test tasks. */\r
 unsigned portLONG ulRegTestError = pdFALSE;\r
 \r
-/* Variables used to ensure the register check tasks are still executing. */\r
-static volatile unsigned portLONG ulRegTest1Counter = 0UL, ulRegTest2Counter = 0UL;\r
-\r
 /*---------------------------------------------------------------------------*/\r
 \r
 /* Start all the demo application tasks, then start the scheduler. */\r
@@ -179,7 +178,6 @@ void main(void)
        vStartLEDFlashTasks( mainLED_TASK_PRIORITY );   \r
        vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
        vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 );\r
-       vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
        vStartBlockingQueueTasks ( mainQUEUE_BLOCK_PRIORITY );  \r
        vStartDynamicPriorityTasks();   \r
@@ -187,6 +185,7 @@ void main(void)
        vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );\r
        vStartQueuePeekTasks();\r
        vCreateBlockTimeTasks();\r
+       vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES );\r
 \r
        /* Start the 'Check' task which is defined in this file. */\r
        xTaskCreate( prvErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );    \r
@@ -255,7 +254,6 @@ portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;
 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
@@ -268,11 +266,6 @@ static unsigned portLONG ulLastRegTest1Counter = 0UL, ulLastRegTest2Counter = 0U
                lReturn = pdFAIL;\r
        }\r
 \r
-       if( xArePollingQueuesStillRunning() != pdTRUE )\r
-       {\r
-               lReturn = pdFAIL;\r
-       }\r
-\r
        if( xAreComTestTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
@@ -324,22 +317,6 @@ static unsigned portLONG ulLastRegTest1Counter = 0UL, ulLastRegTest2Counter = 0U
                lReturn = pdFAIL;\r
        }\r
 \r
-       /* Are the register test tasks still running? */\r
-       if( ulLastRegTest1Counter == ulRegTest1Counter )\r
-       {\r
-               lReturn = pdFAIL;\r
-       }\r
-       \r
-       if( ulLastRegTest2Counter == ulRegTest2Counter )\r
-       {\r
-               lReturn = pdFAIL;\r
-       }\r
-\r
-       /* Record the current values of the register check cycle counters so we\r
-       can ensure they are still running the next time this function is called. */\r
-       ulLastRegTest1Counter = ulRegTest1Counter;\r
-       ulLastRegTest2Counter = ulRegTest2Counter;\r
-\r
        return lReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -373,6 +350,8 @@ static void prvSetupHardware( void )
                #if WATCHDOG == WTC_IN_IDLE\r
                        Kick_Watchdog();\r
                #endif\r
+\r
+               vCoRoutineSchedule();\r
        }\r
 #else\r
        #if WATCHDOG == WTC_IN_IDLE\r
@@ -408,11 +387,7 @@ extern volatile unsigned portLONG ulCriticalNesting;
        /* Fills the registers with known values (different to the values\r
        used in vSecondRegisterTestTask()), then checks that the registers still\r
        all contain the expected value.  This is done to test the context save\r
-       and restore mechanism as this task is swapped onto and off of the CPU.\r
-\r
-       The critical nesting depth is also saved as part of the context so also\r
-       check this maintains an expected value. */\r
-       ulCriticalNesting = 0x12345678;\r
+       and restore mechanism as this task is swapped onto and off of the CPU. */\r
 \r
        for( ;; )\r
        {\r
@@ -499,13 +474,6 @@ extern volatile unsigned portLONG ulCriticalNesting;
 \r
 \r
                #pragma endasm\r
-\r
-               ulRegTest1Counter++;\r
-\r
-               if( ulCriticalNesting != 0x12345678 )\r
-               {\r
-                       ulRegTestError = pdTRUE;\r
-               }\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -517,11 +485,7 @@ extern volatile unsigned portLONG ulCriticalNesting;
        /* Fills the registers with known values (different to the values\r
        used in vFirstRegisterTestTask()), then checks that the registers still\r
        all contain the expected value.  This is done to test the context save\r
-       and restore mechanism as this task is swapped onto and off of the CPU.\r
-\r
-       The critical nesting depth is also saved as part of the context so also\r
-       check this maintains an expected value. */\r
-       ulCriticalNesting = 0x87654321;\r
+       and restore mechanism as this task is swapped onto and off of the CPU. */\r
 \r
        for( ;; )\r
        {\r
@@ -614,13 +578,6 @@ extern volatile unsigned portLONG ulCriticalNesting;
 \r
 \r
                #pragma endasm\r
-\r
-               ulRegTest2Counter++;\r
-\r
-               if( ulCriticalNesting != 0x87654321 )\r
-               {\r
-                       ulRegTestError = pdTRUE;\r
-               }\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r