@ -370,6 +370,97 @@ void test_macro_xQueueSendFromISR_in_set_high_priority_pending( void )
vQueueDelete ( xQueueSet ) ;
}
/**
* @ brief Test xQueueSendFromISR with a higher priority task waiting on a locked queue in Queue Set .
* @ details Test xQueueSendFromISR with a higher priority task waiting on a locked queue and
* verifies that xTaskResumeAll resumes the high priority task .
* @ coverage xQueueGenericSendFromISR
*/
void test_macro_xQueueSendFromISR_in_set_locked_and_high_priority_pending ( void )
{
QueueHandle_t xQueue = xQueueCreate ( 1 , sizeof ( uint32_t ) ) ;
QueueSetHandle_t xQueueSet = xQueueCreateSet ( 1 ) ;
xQueueAddToSet ( xQueue , xQueueSet ) ;
vFakePortAssertIfInterruptPriorityInvalid_Expect ( ) ;
/* Insert an item into the event list. */
td_task_setFakeTaskPriority ( DEFAULT_PRIORITY + 1 ) ;
td_task_addFakeTaskWaitingToReceiveFromQueue ( xQueueSet ) ;
/* Lock the queue. */
vSetQueueTxLock ( xQueue , queueLOCKED_UNMODIFIED ) ;
uxTaskGetNumberOfTasks_IgnoreAndReturn ( 1 ) ;
uint32_t testVal = getNextMonotonicTestValue ( ) ;
/* Add item to queue. */
TEST_ASSERT_EQUAL ( pdTRUE , xQueueSendFromISR ( xQueue , & testVal , NULL ) ) ;
/* This call will trigger unlocking of the queue which eventually calls xTaskResumeAll. */
TEST_ASSERT_EQUAL ( errQUEUE_FULL , xQueueSend ( xQueue , & testVal , 1 ) ) ;
/* Ensure that the xTaskResumeAll resumes high priority task. */
TEST_ASSERT_EQUAL ( 1 , td_task_getYieldCount ( ) ) ;
TEST_ASSERT_EQUAL ( 1 , td_task_getCount_YieldFromTaskResumeAll ( ) ) ;
TEST_ASSERT_EQUAL ( 1 , td_task_getCount_vTaskMissedYield ( ) ) ;
QueueHandle_t xQueueTemp = xQueueSelectFromSet ( xQueueSet , 0 ) ;
uint32_t checkVal = INVALID_UINT32 ;
xQueueReceive ( xQueueTemp , & checkVal , 0 ) ;
TEST_ASSERT_EQUAL ( testVal , checkVal ) ;
vQueueDelete ( xQueue ) ;
vQueueDelete ( xQueueSet ) ;
}
/**
* @ brief Test xQueueSendFromISR with a low priority task waiting on a locked queue in Queue Set .
* @ details Test xQueueSendFromISR with a low priority task waiting on a locked queue and
* verifies that xTaskResumeAll does not resume the low priority task .
* @ coverage xQueueGenericSendFromISR
*/
void test_macro_xQueueSendFromISR_in_set_locked_and_low_priority_pending ( void )
{
QueueHandle_t xQueue = xQueueCreate ( 1 , sizeof ( uint32_t ) ) ;
QueueSetHandle_t xQueueSet = xQueueCreateSet ( 1 ) ;
xQueueAddToSet ( xQueue , xQueueSet ) ;
vFakePortAssertIfInterruptPriorityInvalid_Expect ( ) ;
/* Insert an item into the event list. */
td_task_setFakeTaskPriority ( DEFAULT_PRIORITY - 1 ) ;
td_task_addFakeTaskWaitingToReceiveFromQueue ( xQueueSet ) ;
/* Lock the queue. */
vSetQueueTxLock ( xQueue , queueLOCKED_UNMODIFIED ) ;
uxTaskGetNumberOfTasks_IgnoreAndReturn ( 1 ) ;
uint32_t testVal = getNextMonotonicTestValue ( ) ;
/* Add item to queue. */
TEST_ASSERT_EQUAL ( pdTRUE , xQueueSendFromISR ( xQueue , & testVal , NULL ) ) ;
/* This call will trigger unlocking of the queue which eventually calls xTaskResumeAll. */
TEST_ASSERT_EQUAL ( errQUEUE_FULL , xQueueSend ( xQueue , & testVal , 1 ) ) ;
/* Ensure that the xTaskResumeAll does not resume low priority task. */
TEST_ASSERT_EQUAL ( 0 , td_task_getCount_YieldFromTaskResumeAll ( ) ) ;
TEST_ASSERT_EQUAL ( 0 , td_task_getCount_vTaskMissedYield ( ) ) ;
TEST_ASSERT_EQUAL ( 1 , td_task_getYieldCount ( ) ) ;
TEST_ASSERT_EQUAL ( 1 , td_task_getCount_vPortYieldWithinAPI ( ) ) ;
QueueHandle_t xQueueTemp = xQueueSelectFromSet ( xQueueSet , 0 ) ;
uint32_t checkVal = INVALID_UINT32 ;
xQueueReceive ( xQueueTemp , & checkVal , 0 ) ;
TEST_ASSERT_EQUAL ( testVal , checkVal ) ;
vQueueDelete ( xQueue ) ;
vQueueDelete ( xQueueSet ) ;
}
/**
* @ brief Test xQueueSendFromISR with a lower priority task waiting on a queue in a Queue Set
* @ details Test xQueueSendFromISR on a Queeu in a Queue Set with a lower priority task waiting and