summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/Common/Minimal/TaskNotify.c
diff options
context:
space:
mode:
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2015-10-16 11:29:36 +0000
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>2015-10-16 11:29:36 +0000
commit5e3816d98a76c9f98d89de44f3ffb67fa8941607 (patch)
treed233e3b1ece71bc52cc68b3afeabdcdbc6c482a1 /FreeRTOS/Demo/Common/Minimal/TaskNotify.c
parent9f2d9e2c350f567beee2ddd9cf81a6aeafde7e89 (diff)
downloadfreertos-5e3816d98a76c9f98d89de44f3ffb67fa8941607.tar.gz
Preparing for maintenance release:
Kernel source changes: - Added xTaskNotifyStateClear() API function. - Added the GCC Cortex-R port (existed for a while) into the main download. - Improved the IAR RL78 port's handling of different memory model combinations. - Removed some compiler warnings in heap_5.c. Demo app changes: - Added example use of xTaskNotifyStateClear() to the TaskNotify standard demo tasks. git-svn-id: http://svn.code.sf.net/p/freertos/code/trunk@2389 1d2547de-c912-0410-9cb9-b8ca96c0e9e2
Diffstat (limited to 'FreeRTOS/Demo/Common/Minimal/TaskNotify.c')
-rw-r--r--FreeRTOS/Demo/Common/Minimal/TaskNotify.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/FreeRTOS/Demo/Common/Minimal/TaskNotify.c b/FreeRTOS/Demo/Common/Minimal/TaskNotify.c
index 2f4878330..326531200 100644
--- a/FreeRTOS/Demo/Common/Minimal/TaskNotify.c
+++ b/FreeRTOS/Demo/Common/Minimal/TaskNotify.c
@@ -356,7 +356,7 @@ const uint32_t ulBit0 = 0x01UL, ulBit1 = 0x02UL;
/*--------------------------------------------------------------------------
- Now try querying the previus value while notifying a task. */
+ Now try querying the previous value while notifying a task. */
xTaskNotifyAndQuery( xTaskToNotify, 0x00, eSetBits, &ulPreviousValue );
configASSERT( ulNotifiedValue == ( ULONG_MAX & ~( ulBit0 | ulBit1 ) ) );
@@ -376,6 +376,28 @@ const uint32_t ulBit0 = 0x01UL, ulBit1 = 0x02UL;
ulExpectedValue |= ulLoop;
}
+
+
+ /* -------------------------------------------------------------------------
+ /* Clear the previous notifications. */
+ xTaskNotifyWait( ULONG_MAX, 0, &ulNotifiedValue, 0 );
+
+ /* The task should not have any notifications pending, so an attempt to clear
+ the notification state should fail. */
+ configASSERT( xTaskNotifyStateClear( NULL ) == pdFALSE );
+
+ /* Get the task to notify itself. This is not a normal thing to do, and is
+ only done here for test purposes. */
+ xTaskNotifyAndQuery( xTaskToNotify, ulFirstNotifiedConst, eSetValueWithoutOverwrite, &ulPreviousValue );
+
+ /* Now the notification state should be eNotified, so it should now be
+ possible to clear the notification state. */
+ configASSERT( xTaskNotifyStateClear( NULL ) == pdTRUE );
+ configASSERT( xTaskNotifyStateClear( NULL ) == pdFALSE );
+
+
+
+
/* Incremented to show the task is still running. */
ulNotifyCycleCount++;
@@ -509,9 +531,9 @@ const uint32_t ulUnexpectedValue = 0xff;
break;
default:/* Should never get here!. */
- break;
+ break;
}
-
+
ulTimerNotificationsSent++;
}
}