+\r
+\r
+ /* ------------------------------------------------------------------------\r
+ Clear the previous notifications. */\r
+ xTaskNotifyWait( notifyUINT32_MAX, 0, &ulNotifiedValue, 0 );\r
+\r
+ /* The task should not have any notifications pending, so an attempt to clear\r
+ the notification state should fail. */\r
+ configASSERT( xTaskNotifyStateClear( NULL ) == pdFALSE );\r
+\r
+ /* Get the task to notify itself. This is not a normal thing to do, and is\r
+ only done here for test purposes. */\r
+ xTaskNotifyAndQuery( xTaskToNotify, ulFirstNotifiedConst, eSetValueWithoutOverwrite, &ulPreviousValue );\r
+\r
+ /* Now the notification state should be eNotified, so it should now be\r
+ possible to clear the notification state. */\r
+ configASSERT( xTaskNotifyStateClear( NULL ) == pdTRUE );\r
+ configASSERT( xTaskNotifyStateClear( NULL ) == pdFALSE );\r
+\r
+\r
+\r
+ /* ------------------------------------------------------------------------\r
+ Clear bits in the notification value. */\r
+\r
+ /* Get the task to set all bits its own notification value. This is not a\r
+ normal thing to do, and is only done here for test purposes. */\r
+ xTaskNotify( xTaskToNotify, notifyUINT32_MAX, eSetBits );\r
+\r
+ /* Now clear the top bytes - the returned value from the first call should\r
+ indicate that previously all bits were set. */\r
+ configASSERT( ulTaskNotifyValueClear( xTaskToNotify, notifyUINT32_HIGH_BYTE ) == notifyUINT32_MAX );\r
+\r
+ /* Next clear the bottom bytes - the returned value this time should indicate\r
+ that the top byte was clear (before the bottom byte was cleared. */\r
+ configASSERT( ulTaskNotifyValueClear( xTaskToNotify, notifyUINT32_LOW_BYTE ) == ( notifyUINT32_MAX & ~notifyUINT32_HIGH_BYTE ) );\r
+\r
+ /* Next clear all bytes - the returned value should indicate that previously the\r
+ high and low bytes were clear. */\r
+ configASSERT( ulTaskNotifyValueClear( xTaskToNotify, notifyUINT32_MAX ) == ( notifyUINT32_MAX & ~notifyUINT32_HIGH_BYTE & ~notifyUINT32_LOW_BYTE ) );\r
+\r
+ /* Now all bits should be clear. */\r
+ configASSERT( ulTaskNotifyValueClear( xTaskToNotify, notifyUINT32_MAX ) == 0 );\r
+ configASSERT( ulTaskNotifyValueClear( xTaskToNotify, 0UL ) == 0 );\r
+ configASSERT( ulTaskNotifyValueClear( xTaskToNotify, notifyUINT32_MAX ) == 0 );\r
+\r
+ /* Now the notification state should be eNotified, so it should now be\r
+ possible to clear the notification state. */\r
+ configASSERT( xTaskNotifyStateClear( NULL ) == pdTRUE );\r
+ configASSERT( xTaskNotifyStateClear( NULL ) == pdFALSE );\r
+\r
+\r
+\r
+ /* ------------------------------------------------------------------------\r
+ Create a timer that will try notifying this task while it is suspended. */\r
+ xSingleTaskTimer = xTimerCreate( "SingleNotify", notifySUSPENDED_TEST_TIMER_PERIOD, pdFALSE, NULL, prvSuspendedTaskTimerTestCallback );\r
+ configASSERT( xSingleTaskTimer );\r
+\r
+ /* Incremented to show the task is still running. */\r
+ ulNotifyCycleCount++;\r
+\r
+ /* Ensure no notifications are pending. */\r
+ xTaskNotifyWait( notifyUINT32_MAX, 0, NULL, 0 );\r
+\r
+ /* Raise the task's priority so it can suspend itself before the timer\r
+ expires. */\r
+ vTaskPrioritySet( NULL, configMAX_PRIORITIES - 1 );\r
+\r
+ /* Start the timer that will try notifying this task while it is\r
+ suspended, then wait for a notification. The first time the callback\r
+ executes the timer will suspend the task, then resume the task, without\r
+ ever sending a notification to the task. */\r
+ ulNotifiedValue = 0;\r
+ xTimerStart( xSingleTaskTimer, portMAX_DELAY );\r
+\r
+ /* Check a notification is not received. */\r
+ xReturned = xTaskNotifyWait( 0, 0, &ulNotifiedValue, portMAX_DELAY );\r
+ configASSERT( xReturned == pdFALSE );\r
+ configASSERT( ulNotifiedValue == 0 );\r
+ ( void ) xReturned; /* In case configASSERT() is not defined. */\r
+\r
+ /* Incremented to show the task is still running. */\r
+ ulNotifyCycleCount++;\r
+\r
+ /* Start the timer that will try notifying this task while it is\r
+ suspended, then wait for a notification. The second time the callback\r
+ executes the timer will suspend the task, notify the task, then resume the\r
+ task (previously it was suspended and resumed without being notified). */\r
+ xTimerStart( xSingleTaskTimer, portMAX_DELAY );\r
+\r
+ /* Check a notification is received. */\r
+ xReturned = xTaskNotifyWait( 0, 0, &ulNotifiedValue, portMAX_DELAY );\r
+ configASSERT( xReturned == pdPASS );\r
+ ( void ) xReturned; /* In case configASSERT() is not defined. */\r
+ configASSERT( ulNotifiedValue != 0 );\r
+\r
+ /* Return the task to its proper priority and delete the timer as it is\r
+ not used again. */\r
+ vTaskPrioritySet( NULL, notifyTASK_PRIORITY );\r
+ xTimerDelete( xSingleTaskTimer, portMAX_DELAY );\r
+\r