]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/WIN32-MingW/main_full.c
Update copyright date ready for tagging V10.1.0.
[freertos] / FreeRTOS / Demo / WIN32-MingW / main_full.c
index 4f3c1676f7f66a76f14fa66dd4e22a0e791186db..f39abf8009aabd27368e8182042a1c317c55c47a 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * FreeRTOS Kernel V10.0.1\r
- * Copyright (C) 2017 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ * FreeRTOS Kernel V10.1.0\r
+ * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
  *\r
  * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
  * this software and associated documentation files (the "Software"), to deal in\r
@@ -46,7 +46,7 @@
  * in main.c.  This file implements the comprehensive test and demo version.\r
  *\r
  * NOTE 3:  This file only contains the source code that is specific to the\r
- * basic demo.  Generic functions, such FreeRTOS hook functions, are defined in\r
+ * full demo.  Generic functions, such FreeRTOS hook functions, are defined in\r
  * main.c.\r
  *******************************************************************************\r
  *\r
 \r
 /* Kernel includes. */\r
 #include <FreeRTOS.h>\r
-#include "task.h"\r
-#include "queue.h"\r
-#include "timers.h"\r
-#include "semphr.h"\r
+#include <task.h>\r
+#include <queue.h>\r
+#include <timers.h>\r
+#include <semphr.h>\r
 \r
 /* Standard demo includes. */\r
 #include "BlockQ.h"\r
 #include "IntSemTest.h"\r
 #include "TaskNotify.h"\r
 #include "QueueSetPolling.h"\r
+#include "StaticAllocation.h"\r
 #include "blocktim.h"\r
 #include "AbortDelay.h"\r
 #include "MessageBufferDemo.h"\r
 #include "StreamBufferDemo.h"\r
+#include "StreamBufferInterrupt.h"\r
+#include "MessageBufferAMP.h"\r
 \r
 /* Priorities at which the tasks are created. */\r
 #define mainCHECK_TASK_PRIORITY                        ( configMAX_PRIORITIES - 2 )\r
 \r
 #define mainTIMER_TEST_PERIOD                  ( 50 )\r
 \r
+/*\r
+ * Exercises code that is not otherwise covered by the standard demo/test\r
+ * tasks.\r
+ */\r
+extern BaseType_t xRunCodeCoverageTestAdditions( void );\r
+\r
 /* Task function prototypes. */\r
 static void prvCheckTask( void *pvParameters );\r
 \r
@@ -202,8 +211,16 @@ int main_full( void )
        xTaskCreate( prvPermanentlyBlockingSemaphoreTask, "BlockSem", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
        xTaskCreate( prvPermanentlyBlockingNotificationTask, "BlockNoti", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
 \r
-       vStartMessageBufferTasks();\r
+       vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );\r
        vStartStreamBufferTasks();\r
+       vStartStreamBufferInterruptDemo();\r
+       vStartMessageBufferAMPTasks( configMINIMAL_STACK_SIZE );\r
+\r
+       #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+       {\r
+               vStartStaticallyAllocatedTasks();\r
+       }\r
+       #endif\r
 \r
        #if( configUSE_PREEMPTION != 0  )\r
        {\r
@@ -342,10 +359,28 @@ const TickType_t xCycleFrequency = pdMS_TO_TICKS( 2500UL );
                {\r
                        pcStatusMessage = "Error: Abort delay";\r
                }\r
+               else if( xIsInterruptStreamBufferDemoStillRunning() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Error: Stream buffer interrupt";\r
+               }\r
+               else if( xAreMessageBufferAMPTasksStillRunning() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Error: Message buffer AMP";\r
+               }\r
+\r
+               #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+                       else if( xAreStaticAllocationTasksStillRunning() != pdPASS )\r
+                       {\r
+                               pcStatusMessage = "Error: Static allocation";\r
+                       }\r
+               #endif /* configSUPPORT_STATIC_ALLOCATION */\r
 \r
                /* This is the only task that uses stdout so its ok to call printf()\r
                directly. */\r
-               printf( ( char * ) "%s - %u\r\n", pcStatusMessage, ( unsigned int ) xTaskGetTickCount() );\r
+               printf( "%s - tick count %u - free heap %u - min free heap %u\r\n", pcStatusMessage,\r
+                                                                                                                                                          xTaskGetTickCount(),\r
+                                                                                                                                                          xPortGetFreeHeapSize(),\r
+                                                                                                                                                          xPortGetMinimumEverFreeHeapSize() );\r
                fflush( stdout );\r
        }\r
 }\r
@@ -391,7 +426,6 @@ void *pvAllocated;
        timer. */\r
        prvDemonstrateTimerQueryFunctions();\r
 \r
-\r
        /* If xMutexToDelete has not already been deleted, then delete it now.\r
        This is done purely to demonstrate the use of, and test, the\r
        vSemaphoreDelete() macro.  Care must be taken not to delete a semaphore\r
@@ -416,6 +450,25 @@ void *pvAllocated;
        allocations so there is no need to test here. */\r
        pvAllocated = pvPortMalloc( ( rand() % 500 ) + 1 );\r
        vPortFree( pvAllocated );\r
+\r
+       /* Exit after a fixed time so code coverage results are written to the\r
+       disk. */\r
+       #if( projCOVERAGE_TEST == 1 )\r
+       {\r
+               const TickType_t xMaxRunTime = pdMS_TO_TICKS( 30000UL );\r
+\r
+               /* Exercise code not otherwise executed by standard demo/test tasks. */\r
+               if( xRunCodeCoverageTestAdditions() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Code coverage additions failed.\r\n";\r
+               }\r
+\r
+               if( ( xTaskGetTickCount() - configINITIAL_TICK_COUNT ) >= xMaxRunTime )\r
+               {\r
+                       vTaskEndScheduler();\r
+               }\r
+       }\r
+       #endif\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -454,6 +507,10 @@ TaskHandle_t xTimerTask;
        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
        /* For code coverage purposes. */\r
        xTimerTask = xTimerGetTimerDaemonTaskHandle();\r
        configASSERT( uxTaskPriorityGetFromISR( xTimerTask ) == configTIMER_TASK_PRIORITY );\r
@@ -551,6 +608,7 @@ char *pcTaskName;
 static portBASE_TYPE xPerformedOneShotTests = pdFALSE;\r
 TaskHandle_t xTestTask;\r
 TaskStatus_t xTaskInfo;\r
+extern StackType_t uxTimerTaskStack[];\r
 \r
        /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and\r
        xTaskGetIdleTaskHandle() functions.  Also try using the function that sets\r
@@ -611,6 +669,7 @@ TaskStatus_t xTaskInfo;
        if( ( xTaskInfo.eCurrentState != eBlocked )                                              ||\r
                ( strcmp( xTaskInfo.pcTaskName, "Tmr Svc" ) != 0 )                       ||\r
                ( xTaskInfo.uxCurrentPriority != configTIMER_TASK_PRIORITY ) ||\r
+               ( xTaskInfo.pxStackBase != uxTimerTaskStack )                            ||\r
                ( xTaskInfo.xHandle != xTimerTaskHandle ) )\r
        {\r
                pcStatusMessage = "Error:  vTaskGetInfo() returned incorrect information about the timer task";\r