Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FreeRTOS/Source
Submodule Source updated 120 files
60 changes: 46 additions & 14 deletions FreeRTOS/Test/CMock/tasks/tasks_1_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include <string.h>
#include <stdlib.h>


/* =========================== EXTERN VARIABLES =========================== */
extern TCB_t * volatile pxCurrentTCB;
extern List_t pxReadyTasksLists[ configMAX_PRIORITIES ];
Expand Down Expand Up @@ -115,15 +114,16 @@ extern volatile UBaseType_t uxSchedulerSuspended;
( list_item2 ).pxContainer = &( list ); \
} while( 0 )

#define taskNOT_WAITING_NOTIFICATION ( ( uint8_t ) 0 )
#define taskWAITING_NOTIFICATION ( ( uint8_t ) 1 )
#define taskNOTIFICATION_RECEIVED ( ( uint8_t ) 2 )
#define TCB_ARRAY 10 /* simulate up to 10 tasks: add more if needed */
#define taskNOT_WAITING_NOTIFICATION ( ( uint8_t ) 0 )
#define taskWAITING_NOTIFICATION ( ( uint8_t ) 1 )
#define taskNOTIFICATION_RECEIVED ( ( uint8_t ) 2 )
#define TCB_ARRAY 10 /* simulate up to 10 tasks: add more if needed */
#define taskEVENT_LIST_ITEM_VALUE_IN_USE ( ( uint32_t ) 0x80000000U )

/**
* @brief CException code for when a configASSERT should be intercepted.
*/
#define configASSERT_E 0xAA101
#define configASSERT_E 0xAA101

/* =========================== GLOBAL VARIABLES =========================== */
static StaticTask_t xIdleTaskTCB;
Expand Down Expand Up @@ -1503,7 +1503,7 @@ void test_vTaskPrioritySet_success_gt_max_prio( void )
ptcb = ( TCB_t * ) taskHandle;

/* expectations */
listGET_LIST_ITEM_VALUE_ExpectAnyArgsAndReturn( 0x80000000UL );
listGET_LIST_ITEM_VALUE_ExpectAnyArgsAndReturn( taskEVENT_LIST_ITEM_VALUE_IN_USE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( &pxReadyTasksLists[ 3 ],
&( ptcb->xStateListItem ),
pdTRUE );
Expand All @@ -1528,7 +1528,7 @@ void test_vTaskPrioritySet_success_call_current_null( void )
ptcb = ( TCB_t * ) taskHandle;

/* expectations */
listGET_LIST_ITEM_VALUE_ExpectAnyArgsAndReturn( 0x80000000UL );
listGET_LIST_ITEM_VALUE_ExpectAnyArgsAndReturn( taskEVENT_LIST_ITEM_VALUE_IN_USE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( &pxReadyTasksLists[ 3 ],
&( ptcb->xStateListItem ),
pdTRUE );
Expand Down Expand Up @@ -1638,7 +1638,7 @@ void test_vTaskPrioritySet_success_gt_curr_prio_diff_base( void )
ptcb = ( TCB_t * ) taskHandle;
TEST_ASSERT_EQUAL_PTR( pxCurrentTCB, taskHandle2 );
/* task handle will inherit the priorit of taskHandle2 */
listGET_LIST_ITEM_VALUE_ExpectAnyArgsAndReturn( 0x80000000UL );
listGET_LIST_ITEM_VALUE_ExpectAnyArgsAndReturn( taskEVENT_LIST_ITEM_VALUE_IN_USE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( &pxReadyTasksLists[ 3 ],
&( taskHandle->xStateListItem ),
pdFALSE );
Expand Down Expand Up @@ -1677,7 +1677,7 @@ void test_vTaskPrioritySet_success_lt_curr_prio_diff_base( void )
ptcb = ( TCB_t * ) taskHandle;
TEST_ASSERT_EQUAL_PTR( pxCurrentTCB, taskHandle2 );
/* task handle will inherit the priorit of taskHandle2 */
listGET_LIST_ITEM_VALUE_ExpectAnyArgsAndReturn( 0x80000000UL );
listGET_LIST_ITEM_VALUE_ExpectAnyArgsAndReturn( taskEVENT_LIST_ITEM_VALUE_IN_USE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( &pxReadyTasksLists[ 3 ],
&( taskHandle->xStateListItem ),
pdFALSE );
Expand Down Expand Up @@ -3884,7 +3884,7 @@ void test_vTaskPlaceOnUnorderedEventList( void )
uxSchedulerSuspended = pdTRUE;

/* Expectations */
listSET_LIST_ITEM_VALUE_Expect( &ptcb->xEventListItem, 32 | 0x80000000UL );
listSET_LIST_ITEM_VALUE_Expect( &ptcb->xEventListItem, 32 | taskEVENT_LIST_ITEM_VALUE_IN_USE );
listINSERT_END_Expect( &eventList, &ptcb->xEventListItem );
/* prvAddCurrentTaskToDelayedList */
uxListRemove_ExpectAndReturn( &ptcb->xStateListItem, 1 );
Expand Down Expand Up @@ -4031,7 +4031,7 @@ void test_vTaskRemoveFromUnorderedEventList( void )
ptcb = task_handle;

/* Expectations */
listSET_LIST_ITEM_VALUE_Expect( &list_item, xItemValue | 0x80000000UL );
listSET_LIST_ITEM_VALUE_Expect( &list_item, xItemValue | taskEVENT_LIST_ITEM_VALUE_IN_USE );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item, tcb );
listREMOVE_ITEM_Expect( &list_item );
/* prvResetNextTaskUnblockTime */
Expand Down Expand Up @@ -4069,7 +4069,7 @@ void test_vTaskRemoveFromUnorderedEventList_yielding( void )
TEST_ASSERT_EQUAL( task_handle2, pxCurrentTCB );

/* Expectations */
listSET_LIST_ITEM_VALUE_Expect( &list_item, xItemValue | 0x80000000UL );
listSET_LIST_ITEM_VALUE_Expect( &list_item, xItemValue | taskEVENT_LIST_ITEM_VALUE_IN_USE );
listGET_LIST_ITEM_OWNER_ExpectAndReturn( &list_item, tcb );
/*uxListRemove_ExpectAndReturn( &list_item, pdTRUE ); */
listREMOVE_ITEM_Expect( &( list_item ) );
Expand Down Expand Up @@ -4813,35 +4813,67 @@ void test_vTaskPriorityDisinheritAfterTimeout_fail_null_handle()
void test_vTaskPriorityDisinheritAfterTimeout_success()
{
TaskHandle_t mutex_holder;
UBaseType_t inheritedPriority = 5U;
/* Tasks at priority 1-3 are ready */
UBaseType_t lowPriorityTasksReady = ( UBaseType_t ) ( ( 1 << 1 ) | ( 1 << 2 ) | ( 1 << 3 ) );

/* Setup */
create_task_priority = 4;
mutex_holder = create_task();
mutex_holder->uxMutexesHeld = 1;
mutex_holder->uxPriority = inheritedPriority;
/* Now mark task priority 5 as ready */
uxTopReadyPriority = ( UBaseType_t ) ( ( 1 << inheritedPriority ) | lowPriorityTasksReady );
/* Expectations */
listGET_LIST_ITEM_VALUE_ExpectAndReturn( &mutex_holder->xEventListItem, taskEVENT_LIST_ITEM_VALUE_IN_USE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( &pxReadyTasksLists[ inheritedPriority ],
&mutex_holder->xStateListItem,
pdTRUE );
uxListRemove_ExpectAndReturn( &mutex_holder->xStateListItem, 0 );
/* prvAddTaskToReadyList */
listINSERT_END_Expect( &pxReadyTasksLists[ mutex_holder->uxBasePriority ],
&mutex_holder->xStateListItem );
/* API Call */
vTaskPriorityDisinheritAfterTimeout( mutex_holder,
create_task_priority - 1 );
/* Validations */
TEST_ASSERT_EQUAL( create_task_priority, mutex_holder->uxPriority );
TEST_ASSERT_EQUAL( create_task_priority, mutex_holder->uxBasePriority );
/* Priority is reset back to 4, we should expect tasks 4-1 to be ready */
TEST_ASSERT_EQUAL( uxTopReadyPriority, ( UBaseType_t ) ( ( 1 << create_task_priority ) | lowPriorityTasksReady ) );
}

void test_vTaskPriorityDisinheritAfterTimeout_success2()
{
TaskHandle_t mutex_holder;
UBaseType_t inheritedPriority = 6U;
/* Task at priority 5 is ready */
UBaseType_t priorityFiveTaskReady = ( UBaseType_t ) ( 1 << 5 );

/* Setup */
create_task_priority = 4;
mutex_holder = create_task();
mutex_holder->uxMutexesHeld = 1;
mutex_holder->uxPriority = inheritedPriority;
/* Now mark task priority 6 as ready */
uxTopReadyPriority = ( UBaseType_t ) ( ( 1 << inheritedPriority ) | priorityFiveTaskReady );
/* Expectations */
listGET_LIST_ITEM_VALUE_ExpectAndReturn( &mutex_holder->xEventListItem, taskEVENT_LIST_ITEM_VALUE_IN_USE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( &pxReadyTasksLists[ inheritedPriority ],
&mutex_holder->xStateListItem,
pdTRUE );
uxListRemove_ExpectAndReturn( &mutex_holder->xStateListItem, 0 );
/* prvAddTaskToReadyList */
listINSERT_END_Expect( &pxReadyTasksLists[ mutex_holder->uxBasePriority ],
&mutex_holder->xStateListItem );
/* API Call */
vTaskPriorityDisinheritAfterTimeout( mutex_holder,
create_task_priority );
/* Validations */
TEST_ASSERT_EQUAL( create_task_priority, mutex_holder->uxPriority );
TEST_ASSERT_EQUAL( create_task_priority, mutex_holder->uxBasePriority );
/* Priority is reset back to 4, we should expect tasks 5-4 to be ready */
TEST_ASSERT_EQUAL( uxTopReadyPriority, ( UBaseType_t ) ( ( 1 << create_task_priority ) | priorityFiveTaskReady ) );
}

void test_vTaskPriorityDisinheritAfterTimeout_success3()
Expand Down Expand Up @@ -4870,7 +4902,7 @@ void test_vTaskPriorityDisinheritAfterTimeout_success4()
mutex_holder = create_task();
mutex_holder->uxMutexesHeld = 1;
/* Expectations */
listGET_LIST_ITEM_VALUE_ExpectAndReturn( &mutex_holder->xEventListItem, 0x80000000UL );
listGET_LIST_ITEM_VALUE_ExpectAndReturn( &mutex_holder->xEventListItem, taskEVENT_LIST_ITEM_VALUE_IN_USE );
listIS_CONTAINED_WITHIN_ExpectAndReturn( &pxReadyTasksLists[ mutex_holder->uxPriority ],
&mutex_holder->xStateListItem,
pdFALSE );
Expand Down
2 changes: 1 addition & 1 deletion manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license: "MIT"

dependencies:
- name: "FreeRTOS-Kernel"
version: "0030d609a"
version: "1dbc776"
repository:
type: "git"
url: "https://github.com/FreeRTOS/FreeRTOS-Kernel.git"
Expand Down
Loading