]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/Common/Minimal/TaskNotify.c
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / Common / Minimal / TaskNotify.c
index 8e3aee1d497e26c815550f21cdd0656dc940ce4d..1afdde76083640c07c173f486fc6a36792a8fbbf 100644 (file)
@@ -1,6 +1,6 @@
 /*\r
- * FreeRTOS Kernel V10.1.1\r
- * Copyright (C) 2018 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ * FreeRTOS Kernel V10.3.0\r
+ * Copyright (C) 2020 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
 #endif\r
 \r
 #define notifyTASK_PRIORITY            ( tskIDLE_PRIORITY )\r
-#define notifyUINT32_MAX       ( ( uint32_t ) 0xffffffff )\r
+\r
+/* Constants used in tests when setting/clearing bits. */\r
+#define notifyUINT32_MAX               ( ( uint32_t ) 0xffffffff )\r
+#define notifyUINT32_HIGH_BYTE ( ( uint32_t ) 0xff000000 )\r
+#define notifyUINT32_LOW_BYTE  ( ( uint32_t ) 0x000000ff )\r
+\r
 #define notifySUSPENDED_TEST_TIMER_PERIOD pdMS_TO_TICKS( 50 )\r
 \r
 /*-----------------------------------------------------------*/\r
@@ -403,6 +408,37 @@ TimerHandle_t xSingleTaskTimer;
 \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
@@ -609,6 +645,9 @@ const BaseType_t xCallInterval = pdMS_TO_TICKS( 50 );
 uint32_t ulPreviousValue;\r
 const uint32_t ulUnexpectedValue = 0xff;\r
 \r
+       /* Check the task notification demo tasks were actually created. */\r
+       configASSERT( xTaskToNotify );\r
+\r
        /* The task performs some tests before starting the timer that gives the\r
        notification from this interrupt.  If the timer has not been created yet\r
        then the initial tests have not yet completed and the notification should\r