mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-19 17:48:33 -04:00
Preparing for new release...
Kernel changes: - Remove an assert that was preventing xQueueSendFromISR() being used to give a mutex from an ISR (mutexes cannot be given using xSemaphoreGiveFromISR()). - Introduce xTaskNotifyAndQueryFromISR() as the interrupt safe version of xTaskNotifyAndQuery(). Common demo task changes: - Update IntSemTest.c to prove the theory that it is safe to give a mutex type semaphore from an interrupt using xQueueSendFromISR() instead of xSemaphoreGiveFromISR(). - Update TaskNotify.c to test the new xTaskNotifyAndQuery() from ISR fuction.
This commit is contained in:
parent
25b911e0bd
commit
4c3722bd76
6 changed files with 129 additions and 62 deletions
|
@ -1437,30 +1437,30 @@ void vTaskGetRunTimeStats( char *pcWriteBuffer ) PRIVILEGED_FUNCTION; /*lint !e9
|
|||
* @param eAction Specifies how the notification updates the task's notification
|
||||
* value, if at all. Valid values for eAction are as follows:
|
||||
*
|
||||
* eSetBits -
|
||||
* The task's notification value is bitwise ORed with ulValue. xTaskNofify()
|
||||
* always returns pdPASS in this case.
|
||||
* eSetBits -
|
||||
* The task's notification value is bitwise ORed with ulValue. xTaskNofify()
|
||||
* always returns pdPASS in this case.
|
||||
*
|
||||
* eIncrement -
|
||||
* The task's notification value is incremented. ulValue is not used and
|
||||
* xTaskNotify() always returns pdPASS in this case.
|
||||
* eIncrement -
|
||||
* The task's notification value is incremented. ulValue is not used and
|
||||
* xTaskNotify() always returns pdPASS in this case.
|
||||
*
|
||||
* eSetValueWithOverwrite -
|
||||
* The task's notification value is set to the value of ulValue, even if the
|
||||
* task being notified had not yet processed the previous notification (the
|
||||
* task already had a notification pending). xTaskNotify() always returns
|
||||
* pdPASS in this case.
|
||||
* eSetValueWithOverwrite -
|
||||
* The task's notification value is set to the value of ulValue, even if the
|
||||
* task being notified had not yet processed the previous notification (the
|
||||
* task already had a notification pending). xTaskNotify() always returns
|
||||
* pdPASS in this case.
|
||||
*
|
||||
* eSetValueWithoutOverwrite -
|
||||
* If the task being notified did not already have a notification pending then
|
||||
* the task's notification value is set to ulValue and xTaskNotify() will
|
||||
* return pdPASS. If the task being notified already had a notification
|
||||
* pending then no action is performed and pdFAIL is returned.
|
||||
* eSetValueWithoutOverwrite -
|
||||
* If the task being notified did not already have a notification pending then
|
||||
* the task's notification value is set to ulValue and xTaskNotify() will
|
||||
* return pdPASS. If the task being notified already had a notification
|
||||
* pending then no action is performed and pdFAIL is returned.
|
||||
*
|
||||
* eNoAction -
|
||||
* The task receives a notification without its notification value being
|
||||
* updated. ulValue is not used and xTaskNotify() always returns pdPASS in
|
||||
* this case.
|
||||
* eNoAction -
|
||||
* The task receives a notification without its notification value being
|
||||
* updated. ulValue is not used and xTaskNotify() always returns pdPASS in
|
||||
* this case.
|
||||
*
|
||||
* pulPreviousNotificationValue -
|
||||
* Can be used to pass out the subject task's notification value before any
|
||||
|
@ -1523,30 +1523,30 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNo
|
|||
* @param eAction Specifies how the notification updates the task's notification
|
||||
* value, if at all. Valid values for eAction are as follows:
|
||||
*
|
||||
* eSetBits -
|
||||
* The task's notification value is bitwise ORed with ulValue. xTaskNofify()
|
||||
* always returns pdPASS in this case.
|
||||
* eSetBits -
|
||||
* The task's notification value is bitwise ORed with ulValue. xTaskNofify()
|
||||
* always returns pdPASS in this case.
|
||||
*
|
||||
* eIncrement -
|
||||
* The task's notification value is incremented. ulValue is not used and
|
||||
* xTaskNotify() always returns pdPASS in this case.
|
||||
* eIncrement -
|
||||
* The task's notification value is incremented. ulValue is not used and
|
||||
* xTaskNotify() always returns pdPASS in this case.
|
||||
*
|
||||
* eSetValueWithOverwrite -
|
||||
* The task's notification value is set to the value of ulValue, even if the
|
||||
* task being notified had not yet processed the previous notification (the
|
||||
* task already had a notification pending). xTaskNotify() always returns
|
||||
* pdPASS in this case.
|
||||
* eSetValueWithOverwrite -
|
||||
* The task's notification value is set to the value of ulValue, even if the
|
||||
* task being notified had not yet processed the previous notification (the
|
||||
* task already had a notification pending). xTaskNotify() always returns
|
||||
* pdPASS in this case.
|
||||
*
|
||||
* eSetValueWithoutOverwrite -
|
||||
* If the task being notified did not already have a notification pending then
|
||||
* the task's notification value is set to ulValue and xTaskNotify() will
|
||||
* return pdPASS. If the task being notified already had a notification
|
||||
* pending then no action is performed and pdFAIL is returned.
|
||||
* eSetValueWithoutOverwrite -
|
||||
* If the task being notified did not already have a notification pending then
|
||||
* the task's notification value is set to ulValue and xTaskNotify() will
|
||||
* return pdPASS. If the task being notified already had a notification
|
||||
* pending then no action is performed and pdFAIL is returned.
|
||||
*
|
||||
* eNoAction -
|
||||
* The task receives a notification without its notification value being
|
||||
* updated. ulValue is not used and xTaskNotify() always returns pdPASS in
|
||||
* this case.
|
||||
* eNoAction -
|
||||
* The task receives a notification without its notification value being
|
||||
* updated. ulValue is not used and xTaskNotify() always returns pdPASS in
|
||||
* this case.
|
||||
*
|
||||
* @param pxHigherPriorityTaskWoken xTaskNotifyFromISR() will set
|
||||
* *pxHigherPriorityTaskWoken to pdTRUE if sending the notification caused the
|
||||
|
@ -1563,7 +1563,9 @@ BaseType_t xTaskGenericNotify( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNo
|
|||
* \defgroup xTaskNotify xTaskNotify
|
||||
* \ingroup TaskNotifications
|
||||
*/
|
||||
BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;
|
||||
#define xTaskNotifyFromISR( xTaskToNotify, ulValue, eAction, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), NULL, ( pxHigherPriorityTaskWoken ) )
|
||||
#define xTaskNotifyAndQueryFromISR( xTaskToNotify, ulValue, eAction, pulPreviousNotificationValue, pxHigherPriorityTaskWoken ) xTaskGenericNotifyFromISR( ( xTaskToNotify ), ( ulValue ), ( eAction ), ( pulPreviousNotificationValue ), ( pxHigherPriorityTaskWoken ) )
|
||||
|
||||
/**
|
||||
* task. h
|
||||
|
|
|
@ -1219,9 +1219,11 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
|
|||
if the item size is not 0. */
|
||||
configASSERT( pxQueue->uxItemSize == 0 );
|
||||
|
||||
/* Normally a mutex would not be given from an interrupt, and doing so is
|
||||
definitely wrong if there is a mutex holder as priority inheritance makes no
|
||||
sense for an interrupts, only tasks. */
|
||||
/* Normally a mutex would not be given from an interrupt, especially if
|
||||
there is a mutex holder, as priority inheritance makes no sense for an
|
||||
interrupts, only tasks. However, on occasions when it is wanted to give
|
||||
a mutex from an interrupt, use xQueueSendFromISR() in place of
|
||||
xSemaphoreGiveFromISR(). */
|
||||
configASSERT( !( ( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) && ( pxQueue->pxMutexHolder != NULL ) ) );
|
||||
|
||||
/* RTOS ports that support interrupt nesting have the concept of a maximum
|
||||
|
|
|
@ -3489,12 +3489,6 @@ TCB_t *pxTCB;
|
|||
|
||||
if( pxMutexHolder != NULL )
|
||||
{
|
||||
/* A task can only have an inherited priority if it holds the mutex.
|
||||
If the mutex is held by a task then it cannot be given from an
|
||||
interrupt, and if a mutex is given by the holding task then it must
|
||||
be the running state task. */
|
||||
configASSERT( pxTCB == pxCurrentTCB );
|
||||
|
||||
configASSERT( pxTCB->uxMutexesHeld );
|
||||
( pxTCB->uxMutexesHeld )--;
|
||||
|
||||
|
@ -4236,7 +4230,7 @@ TickType_t uxReturn;
|
|||
|
||||
#if( configUSE_TASK_NOTIFICATIONS == 1 )
|
||||
|
||||
BaseType_t xTaskNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, BaseType_t *pxHigherPriorityTaskWoken )
|
||||
BaseType_t xTaskGenericNotifyFromISR( TaskHandle_t xTaskToNotify, uint32_t ulValue, eNotifyAction eAction, uint32_t *pulPreviousNotificationValue, BaseType_t *pxHigherPriorityTaskWoken )
|
||||
{
|
||||
TCB_t * pxTCB;
|
||||
eNotifyValue eOriginalNotifyState;
|
||||
|
@ -4267,8 +4261,12 @@ TickType_t uxReturn;
|
|||
|
||||
uxSavedInterruptStatus = portSET_INTERRUPT_MASK_FROM_ISR();
|
||||
{
|
||||
eOriginalNotifyState = pxTCB->eNotifyState;
|
||||
if( pulPreviousNotificationValue != NULL )
|
||||
{
|
||||
*pulPreviousNotificationValue = pxTCB->ulNotifiedValue;
|
||||
}
|
||||
|
||||
eOriginalNotifyState = pxTCB->eNotifyState;
|
||||
pxTCB->eNotifyState = eNotified;
|
||||
|
||||
switch( eAction )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue