]> git.sur5r.net Git - freertos/commitdiff
xTaskGenericNotify() now sets xYieldPending to pdTRUE even when the 'higher priority...
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 29 Apr 2018 18:15:38 +0000 (18:15 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 29 Apr 2018 18:15:38 +0000 (18:15 +0000)
Ensure tasks that are blocked indefinitely on a direct to task notification return their state as eBlocked, previously was returned as eSuspended - making its behaviour consistent with event objects.
Fix typo in stream_buffer.c where "size_t xBytesAvailable ); PRIVILEGED_FUNCTION" had the semicolon in the wrong place.
Add testing of Stream Buffers to the AbortDelay.c tests.
Guard inclusion of C code when FreeRTOSConfig.h is included from an assembly file in the ARM7_LPC2129_IAR demo.
Fix minor typos in the Windows demo comment blocks.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2537 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Demo/ARM7_LPC2129_IAR/FreeRTOSConfig.h
FreeRTOS/Demo/Common/Minimal/AbortDelay.c
FreeRTOS/Demo/Common/Minimal/TimerDemo.c
FreeRTOS/Demo/WIN32-MSVC/main.c
FreeRTOS/Demo/WIN32-MSVC/main_blinky.c
FreeRTOS/Demo/WIN32-MSVC/main_full.c
FreeRTOS/Demo/WIN32-MingW/main_full.c
FreeRTOS/Source/stream_buffer.c
FreeRTOS/Source/tasks.c

index 48fdcf06615632a866aa1540d565cc2f2adf3553..90109363af5f78ac2306dc5caf7782abee0ecdbc 100644 (file)
@@ -29,7 +29,9 @@
 #define FREERTOS_CONFIG_H\r
 \r
 /* Hardware specifics. */\r
-#include <NXP/iolpc2129.h>\r
+#ifdef __ICCARM__\r
+       #include <NXP/iolpc2129.h>\r
+#endif\r
 \r
 /*-----------------------------------------------------------\r
  * Application specific definitions.\r
@@ -38,7 +40,7 @@
  * application requirements.\r
  *\r
  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
- * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. \r
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
  *\r
  * See http://www.freertos.org/a00110.html.\r
  *----------------------------------------------------------*/\r
index e18259a08a640229b60abfa9cdc7277e1779cde7..6ee9d894eefb2bd6c98531cb7ca28d3bf65fc63c 100644 (file)
@@ -27,7 +27,9 @@
 \r
 /*\r
  * This file contains some test scenarios that ensure tasks respond correctly\r
- * to xTaskAbortDelay() calls.\r
+ * to xTaskAbortDelay() calls.  It also ensures tasks return the correct state\r
+ * of eBlocked when blocked indefinitely in both the case where a task is\r
+ * blocked on an object and when a task is blocked on a notification.\r
  */\r
 \r
 /* Standard includes. */\r
@@ -39,6 +41,7 @@
 #include "queue.h"\r
 #include "semphr.h"\r
 #include "event_groups.h"\r
+#include "stream_buffer.h"\r
 \r
 /* Demo includes. */\r
 #include "AbortDelay.h"\r
@@ -68,7 +71,8 @@ build.  Remove the whole file if this is not the case. */
 #define abtSEMAPHORE_TAKE_ABORTS       4\r
 #define abtEVENT_GROUP_ABORTS          5\r
 #define abtQUEUE_SEND_ABORTS           6\r
-#define abtMAX_TESTS                           7\r
+#define abtSTREAM_BUFFER_RECEIVE       7\r
+#define abtMAX_TESTS                           8\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -95,6 +99,7 @@ static void prvTestAbortingTaskDelayUntil( void );
 static void prvTestAbortingSemaphoreTake( void );\r
 static void prvTestAbortingEventGroupWait( void );\r
 static void prvTestAbortingQueueSend( void );\r
+static void prvTestAbortingStreamBufferReceive( void );\r
 \r
 /*\r
  * Checks the amount of time a task spent in the Blocked state is within the\r
@@ -241,6 +246,10 @@ const uint32_t ulMax = 0xffffffffUL;
                                prvTestAbortingQueueSend();\r
                                break;\r
 \r
+                       case abtSTREAM_BUFFER_RECEIVE:\r
+                               prvTestAbortingStreamBufferReceive();\r
+                               break;\r
+\r
                        default:\r
                                /* Should not get here. */\r
                                break;\r
@@ -417,6 +426,75 @@ EventBits_t xBitsToWaitFor = ( EventBits_t ) 0x01, xReturn;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
+static void prvTestAbortingStreamBufferReceive( void )\r
+{\r
+TickType_t xTimeAtStart;\r
+StreamBufferHandle_t xStreamBuffer;\r
+EventBits_t xReturn;\r
+const size_t xTriggerLevelBytes = ( size_t ) 1;\r
+uint8_t uxRxData;\r
+\r
+       #if( configSUPPORT_STATIC_ALLOCATION == 1 )\r
+       {\r
+               /* Defines the memory that will actually hold the streams within the\r
+               stream buffer. */\r
+               static uint8_t ucStorageBuffer[ sizeof( configMESSAGE_BUFFER_LENGTH_TYPE ) + 1 ];\r
+\r
+               /* The variable used to hold the stream buffer structure. */\r
+               StaticStreamBuffer_t xStreamBufferStruct;\r
+\r
+\r
+           xStreamBuffer = xStreamBufferCreateStatic( sizeof( ucStorageBuffer ),\r
+                                                                                          xTriggerLevelBytes,\r
+                                                                                                  ucStorageBuffer,\r
+                                                      &xStreamBufferStruct );\r
+       }\r
+       #else\r
+       {\r
+               xStreamBuffer = xStreamBufferCreate( sizeof( uint8_t ), xTriggerLevelBytes );\r
+               configASSERT( xStreamBuffer );\r
+       }\r
+       #endif\r
+\r
+       /* Note the time before the delay so the length of the delay is known. */\r
+       xTimeAtStart = xTaskGetTickCount();\r
+\r
+       /* This first delay should just time out. */\r
+       xReturn = xStreamBufferReceive( xStreamBuffer, &uxRxData, sizeof( uxRxData ), xMaxBlockTime );\r
+       if( xReturn != 0x00 )\r
+       {\r
+               xErrorOccurred = pdTRUE;\r
+       }\r
+       prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );\r
+\r
+       /* Note the time before the delay so the length of the delay is known. */\r
+       xTimeAtStart = xTaskGetTickCount();\r
+\r
+       /* This second delay should be aborted by the primary task half way\r
+       through xMaxBlockTime. */\r
+       xReturn = xStreamBufferReceive( xStreamBuffer, &uxRxData, sizeof( uxRxData ), xMaxBlockTime );\r
+       if( xReturn != 0x00 )\r
+       {\r
+               xErrorOccurred = pdTRUE;\r
+       }\r
+       prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xHalfMaxBlockTime );\r
+\r
+       /* Note the time before the delay so the length of the delay is known. */\r
+       xTimeAtStart = xTaskGetTickCount();\r
+\r
+       /* This third delay should just time out again. */\r
+       xReturn = xStreamBufferReceive( xStreamBuffer, &uxRxData, sizeof( uxRxData ), xMaxBlockTime );\r
+       if( xReturn != 0x00 )\r
+       {\r
+               xErrorOccurred = pdTRUE;\r
+       }\r
+       prvCheckExpectedTimeIsWithinAnAcceptableMargin( xTimeAtStart, xMaxBlockTime );\r
+\r
+       /* Not really necessary in this case, but for completeness. */\r
+       vStreamBufferDelete( xStreamBuffer );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
 static void prvTestAbortingQueueSend( void )\r
 {\r
 TickType_t xTimeAtStart;\r
@@ -523,8 +601,8 @@ SemaphoreHandle_t xSemaphore;
        xTimeAtStart = xTaskGetTickCount();\r
 \r
        /* This second delay should be aborted by the primary task half way\r
-       through. */\r
-       xReturn = xSemaphoreTake( xSemaphore, xMaxBlockTime );\r
+       through xMaxBlockTime. */\r
+       xReturn = xSemaphoreTake( xSemaphore, portMAX_DELAY );\r
        if( xReturn != pdFALSE )\r
        {\r
                xErrorOccurred = pdTRUE;\r
@@ -567,8 +645,8 @@ BaseType_t xReturn;
        xTimeAtStart = xTaskGetTickCount();\r
 \r
        /* This second delay should be aborted by the primary task half way\r
-       through. */\r
-       xReturn = xTaskNotifyWait( 0, 0, NULL, xMaxBlockTime );\r
+       through xMaxBlockTime. */\r
+       xReturn = xTaskNotifyWait( 0, 0, NULL, portMAX_DELAY );\r
        if( xReturn != pdFALSE )\r
        {\r
                xErrorOccurred = pdTRUE;\r
index 7e8121ef00f4ab17fb024240e45ad12d0c73093a..721e80bd7c4a0c2f1b33e63cf240bc4ef84015e1 100644 (file)
@@ -218,7 +218,6 @@ static TickType_t xIterationsWithoutCounterIncrement = ( TickType_t ) 0, xLastCy
                {\r
                        /* The tests appear to be no longer running (stalled). */\r
                        xTestStatus = pdFAIL;\r
-                       configASSERT( xTestStatus );\r
                }\r
        }\r
        else\r
index a5efad53f53a92ac63eaa2b795290375a82a929c..7692515a27d13a659b78e2fae8fba9305d802f97 100644 (file)
@@ -68,7 +68,7 @@ The blinky demo is implemented and described in main_blinky.c.
 If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is not 1 then the comprehensive test and\r
 demo application will be built.  The comprehensive test and demo application is\r
 implemented and described in main_full.c. */\r
-#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     0\r
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY     1\r
 \r
 /* This demo uses heap_5.c, and these constants define the sizes of the regions\r
 that make up the total heap.  heap_5 is only used for test and example purposes\r
index a90731f0e9ecde2bb1fa1ec3be7e45b3c6e6fa0b..cdfdbed3ff900be967b47ed4e922941465195df6 100644 (file)
@@ -240,7 +240,7 @@ uint32_t ulReceivedValue;
                is it an expected value?  Normally calling printf() from a task is not\r
                a good idea.  Here there is lots of stack space and only one task is\r
                using console IO so it is ok.  However, note the comments at the top of\r
-               this file about the risks of making Windows system calls (such as \r
+               this file about the risks of making Windows system calls (such as\r
                console output) from a FreeRTOS task. */\r
                if( ulReceivedValue == mainVALUE_SENT_FROM_TASK )\r
                {\r
index 68488eb371169e8ee0661f801b22460474522f76..1d7f5c32c8e2118bfd590a9d8dfd419c7153a9ab 100644 (file)
@@ -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
index b8e06d184646cf1d7a8840e9b402f93356e9570d..f051af45ce7c5523ee8362c7bf6cd08f6e45ae67 100644 (file)
@@ -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
index 1f053b7dde64fe83867b07d2cf0bfe15719ba038..f26624ed8df9f7cc46aee8bddc5052abb151f1bc 100644 (file)
@@ -200,7 +200,7 @@ static size_t prvWriteMessageToBuffer(  StreamBuffer_t * const pxStreamBuffer,
 static size_t prvReadBytesFromBuffer( StreamBuffer_t *pxStreamBuffer,\r
                                                                          uint8_t *pucData,\r
                                                                          size_t xMaxCount,\r
-                                                                         size_t xBytesAvailable ); PRIVILEGED_FUNCTION\r
+                                                                         size_t xBytesAvailable ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Called by both pxStreamBufferCreate() and pxStreamBufferCreateStatic() to\r
index 129439caba03862cd212ea02ff900289038277b5..b6f4cccd6985fb48625693b1c4f7173adb4333c1 100644 (file)
@@ -1364,11 +1364,30 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
                                else if( pxStateList == &xSuspendedTaskList )\r
                                {\r
                                        /* The task being queried is referenced from the suspended\r
-                                       list.  Is it genuinely suspended or is it block\r
+                                       list.  Is it genuinely suspended or is it blocked\r
                                        indefinitely? */\r
                                        if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) == NULL )\r
                                        {\r
-                                               eReturn = eSuspended;\r
+                                               #if( configUSE_TASK_NOTIFICATIONS == 1 )\r
+                                               {\r
+                                                       /* The task does not appear on the vent list item of\r
+                                                       and of the RTOS objects, but could still be in the\r
+                                                       blocked state if it is waiting on its notification\r
+                                                       rather than waiting on an object. */\r
+                                                       if( pxTCB->ucNotifyState == taskWAITING_NOTIFICATION )\r
+                                                       {\r
+                                                               eReturn = eBlocked;\r
+                                                       }\r
+                                                       else\r
+                                                       {\r
+                                                               eReturn = eSuspended;\r
+                                                       }\r
+                                               }\r
+                                               #else\r
+                                               {\r
+                                                       eReturn = eSuspended;\r
+                                               }\r
+                                               #endif\r
                                        }\r
                                        else\r
                                        {\r
@@ -4772,13 +4791,11 @@ TickType_t uxReturn;
                                        {\r
                                                *pxHigherPriorityTaskWoken = pdTRUE;\r
                                        }\r
-                                       else\r
-                                       {\r
-                                               /* Mark that a yield is pending in case the user is not\r
-                                               using the "xHigherPriorityTaskWoken" parameter to an ISR\r
-                                               safe FreeRTOS function. */\r
-                                               xYieldPending = pdTRUE;\r
-                                       }\r
+\r
+                                       /* Mark that a yield is pending in case the user is not\r
+                                       using the "xHigherPriorityTaskWoken" parameter to an ISR\r
+                                       safe FreeRTOS function. */\r
+                                       xYieldPending = pdTRUE;\r
                                }\r
                                else\r
                                {\r
@@ -4862,13 +4879,11 @@ TickType_t uxReturn;
                                        {\r
                                                *pxHigherPriorityTaskWoken = pdTRUE;\r
                                        }\r
-                                       else\r
-                                       {\r
-                                               /* Mark that a yield is pending in case the user is not\r
-                                               using the "xHigherPriorityTaskWoken" parameter in an ISR\r
-                                               safe FreeRTOS function. */\r
-                                               xYieldPending = pdTRUE;\r
-                                       }\r
+\r
+                                       /* Mark that a yield is pending in case the user is not\r
+                                       using the "xHigherPriorityTaskWoken" parameter in an ISR\r
+                                       safe FreeRTOS function. */\r
+                                       xYieldPending = pdTRUE;\r
                                }\r
                                else\r
                                {\r