]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RISC-V_IGLOO2_Creative_SoftConsole/full_demo/main_full.c
Microsemi RISC-V project:
[freertos] / FreeRTOS / Demo / RISC-V_IGLOO2_Creative_SoftConsole / full_demo / main_full.c
index 655d6ff153c0d44b83523dde7ae312bf2bf81801..a0efe8dd45033ccae218da731c6008c836d995cd 100644 (file)
 #include "TimerDemo.h"\r
 #include "EventGroupsDemo.h"\r
 #include "TaskNotify.h"\r
+#include "AbortDelay.h"\r
+#include "countsem.h"\r
+#include "death.h"\r
+#include "MessageBufferDemo.h"\r
+#include "StreamBufferDemo.h"\r
+#include "StreamBufferInterrupt.h"\r
 \r
 /* Priorities for the demo application tasks. */\r
 #define mainCHECK_TASK_PRIORITY                                ( configMAX_PRIORITIES - 1 )\r
+#define mainCREATOR_TASK_PRIORITY                      ( tskIDLE_PRIORITY + 3UL )\r
 \r
 /* The period of the check task, in ms, converted to ticks using the\r
 pdMS_TO_TICKS() macro.  mainNO_ERROR_CHECK_TASK_PERIOD is used if no errors have\r
@@ -155,6 +162,11 @@ void main_full( void )
        vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
        vStartEventGroupTasks();\r
        vStartTaskNotifyTask();\r
+       vCreateAbortDelayTasks();\r
+       vStartCountingSemaphoreTasks();\r
+       vStartMessageBufferTasks( configMINIMAL_STACK_SIZE  );\r
+       vStartStreamBufferTasks();\r
+       vStartStreamBufferInterruptDemo();\r
 \r
        /* Create the register check tasks, as described at the top of this     file.\r
        Use xTaskCreateStatic() to create a task using only statically allocated\r
@@ -171,6 +183,11 @@ void main_full( void )
        the top of this file. */\r
        xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE_WORDS, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
+       /* The set of tasks created by the following function call have to be\r
+       created last as they keep account of the number of tasks they expect to see\r
+       running. */\r
+       vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
+\r
        /* Start the scheduler. */\r
        vTaskStartScheduler();\r
 \r
@@ -183,7 +200,7 @@ void main_full( void )
        for( ;; );\r
 }\r
 /*-----------------------------------------------------------*/\r
-//int count = 0;\r
+\r
 static void prvCheckTask( void *pvParameters )\r
 {\r
 TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;\r
@@ -209,57 +226,76 @@ extern void vToggleLED( void );
        doing gives visual feedback of the system status. */\r
        for( ;; )\r
        {\r
-//             if( ++count == 5 ) {taskENTER_CRITICAL();for(;;);}\r
                /* Delay until it is time to execute again. */\r
                vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );\r
 \r
-//             taskENTER_CRITICAL();\r
-//             for( int i = 0; i < 100; i++ )\r
-//             {\r
-//                     for( int j = 0; j < 1000; j++ ) taskYIELD();\r
-//                     taskEXIT_CRITICAL();\r
-//                     vTaskDelay( 1 );\r
-//                     taskENTER_CRITICAL();\r
-//             }\r
-//             taskEXIT_CRITICAL();\r
-\r
                /* Check all the demo tasks (other than the flash tasks) to ensure\r
                that they are all still running, and that none have detected an error. */\r
-               if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
+               if( xAreDynamicPriorityTasksStillRunning() == pdFALSE )\r
                {\r
                        pcStatusMessage = "ERROR: Dynamic priority demo/tests.\r\n";\r
                }\r
 \r
-               if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
+               if ( xAreBlockTimeTestTasksStillRunning() == pdFALSE )\r
                {\r
                        pcStatusMessage = "ERROR: Block time demo/tests.\r\n";\r
                }\r
 \r
-               if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
+               if ( xAreGenericQueueTasksStillRunning() == pdFALSE )\r
                {\r
                        pcStatusMessage = "ERROR: Generic queue demo/tests.\r\n";\r
                }\r
 \r
-               if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+               if ( xAreRecursiveMutexTasksStillRunning() == pdFALSE )\r
                {\r
                        pcStatusMessage = "ERROR: Recursive mutex demo/tests.\r\n";\r
                }\r
 \r
-               if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS )\r
+               if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) == pdFALSE )\r
                {\r
                        pcStatusMessage = "ERROR: Timer demo/tests.\r\n";\r
                }\r
 \r
-               if( xAreEventGroupTasksStillRunning() != pdPASS )\r
+               if( xAreEventGroupTasksStillRunning() == pdFALSE )\r
                {\r
                        pcStatusMessage = "ERROR: Event group demo/tests.\r\n";\r
                }\r
 \r
-               if( xAreTaskNotificationTasksStillRunning() != pdPASS )\r
+               if( xAreTaskNotificationTasksStillRunning() == pdFALSE )\r
                {\r
                        pcStatusMessage = "ERROR: Task notification demo/tests.\r\n";\r
                }\r
 \r
+               if( xAreAbortDelayTestTasksStillRunning() == pdFALSE )\r
+               {\r
+                       pcStatusMessage = "ERROR: Abort delay.\r\n";\r
+               }\r
+\r
+               if( xAreCountingSemaphoreTasksStillRunning() == pdFALSE )\r
+               {\r
+                       pcStatusMessage = "ERROR: Counting semaphores.\r\n";\r
+               }\r
+\r
+               if( xIsCreateTaskStillRunning() == pdFALSE )\r
+               {\r
+                       pcStatusMessage = "ERROR: Suicide tasks.\r\n";\r
+               }\r
+\r
+               if( xAreMessageBufferTasksStillRunning() == pdFALSE )\r
+               {\r
+                       pcStatusMessage = "ERROR: Message buffer.\r\n";\r
+               }\r
+\r
+               if( xAreStreamBufferTasksStillRunning() == pdFALSE )\r
+               {\r
+                       pcStatusMessage = "ERROR: Stream buffer.\r\n";\r
+               }\r
+\r
+               if( xIsInterruptStreamBufferDemoStillRunning() == pdFALSE )\r
+               {\r
+                       pcStatusMessage = "ERROR: Stream buffer interrupt.\r\n";\r
+               }\r
+\r
                /* Check that the register test 1 task is still running. */\r
                if( ulLastRegTest1Value == ulRegTest1LoopCounter )\r
                {\r
@@ -275,7 +311,7 @@ extern void vToggleLED( void );
                ulLastRegTest2Value = ulRegTest2LoopCounter;\r
 \r
                /* Write the status message to the UART. */\r
-//             vSendString( pcStatusMessage );\r
+               vSendString( pcStatusMessage );\r
                vToggleLED();\r
 \r
                /* If an error has been found then increase the LED toggle rate by\r
@@ -326,9 +362,24 @@ static void prvRegTestTaskEntry2( void *pvParameters )
 \r
 void vFullDemoTickHook( void )\r
 {\r
-       /* Called from vApplicationTickHook() when the project is configured to\r
-       build the full demo. */\r
+       /* The full demo includes a software timer demo/test that requires\r
+       prodding periodically from the tick interrupt. */\r
        vTimerPeriodicISRTests();\r
+\r
+       /* Call the periodic event group from ISR demo. */\r
        vPeriodicEventGroupsProcessing();\r
+\r
+       /* Use task notifications from an interrupt. */\r
        xNotifyTaskFromISR();\r
+\r
+       /* Writes to stream buffer byte by byte to test the stream buffer trigger\r
+       level functionality. */\r
+       vPeriodicStreamBufferProcessing();\r
+\r
+       /* Writes a string to a string buffer four bytes at a time to demonstrate\r
+       a stream being sent from an interrupt to a task. */\r
+       vBasicStreamBufferSendFromISR();\r
+\r
+       /* Called from vApplicationTickHook() when the project is configured to\r
+       build the full test/demo applications. */\r
 }\r