Add runtime parameter checks (#761)

* Add runtime parameter checks

This commit adds runtime checks for function parameters to mpu_wrappers_v2 file. The same checks are performed
in the API implementation using asserts.

Signed-off-by: kar-rahul-aws <karahulx@amazon.com>
This commit is contained in:
kar-rahul-aws 2023-08-18 14:24:44 +05:30 committed by GitHub
parent cd87a39736
commit cdd3678c29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 290 additions and 193 deletions

1
.github/lexicon.txt vendored
View file

@ -2462,6 +2462,7 @@ uxpriority
uxprioritytouse uxprioritytouse
uxqueue uxqueue
uxqueuegetqueueitemsize uxqueuegetqueueitemsize
uxqueuegetqueuelength
uxqueuelength uxqueuelength
uxqueuemessageswaiting uxqueuemessageswaiting
uxqueuespacesavailable uxqueuespacesavailable

View file

@ -46,26 +46,6 @@
* correct privileged Vs unprivileged linkage and placement. */ * correct privileged Vs unprivileged linkage and placement. */
#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021 See comment above. */ #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021 See comment above. */
/* The following bit fields convey control information in a task's event list
* item value. It is important they don't clash with the
* taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x0100U
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x0200U
#define eventWAIT_FOR_ALL_BITS 0x0400U
#define eventEVENT_BITS_CONTROL_BYTES 0xff00U
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x01000000UL
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x02000000UL
#define eventWAIT_FOR_ALL_BITS 0x04000000UL
#define eventEVENT_BITS_CONTROL_BYTES 0xff000000UL
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x0100000000000000ULL
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x0200000000000000ULL
#define eventWAIT_FOR_ALL_BITS 0x0400000000000000ULL
#define eventEVENT_BITS_CONTROL_BYTES 0xff00000000000000ULL
#endif /* if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS ) */
typedef struct EventGroupDef_t typedef struct EventGroupDef_t
{ {
EventBits_t uxEventBits; EventBits_t uxEventBits;

View file

@ -36,6 +36,26 @@
/* FreeRTOS includes. */ /* FreeRTOS includes. */
#include "timers.h" #include "timers.h"
/* The following bit fields convey control information in a task's event list
* item value. It is important they don't clash with the
* taskEVENT_LIST_ITEM_VALUE_IN_USE definition. */
#if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x0100U
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x0200U
#define eventWAIT_FOR_ALL_BITS 0x0400U
#define eventEVENT_BITS_CONTROL_BYTES 0xff00U
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_32_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x01000000UL
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x02000000UL
#define eventWAIT_FOR_ALL_BITS 0x04000000UL
#define eventEVENT_BITS_CONTROL_BYTES 0xff000000UL
#elif ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_64_BITS )
#define eventCLEAR_EVENTS_ON_EXIT_BIT 0x0100000000000000ULL
#define eventUNBLOCKED_DUE_TO_BIT_SET 0x0200000000000000ULL
#define eventWAIT_FOR_ALL_BITS 0x0400000000000000ULL
#define eventEVENT_BITS_CONTROL_BYTES 0xff00000000000000ULL
#endif /* if ( configTICK_TYPE_WIDTH_IN_BITS == TICK_TYPE_WIDTH_16_BITS ) */
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View file

@ -1753,6 +1753,7 @@ void vQueueSetQueueNumber( QueueHandle_t xQueue,
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION; UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
UBaseType_t uxQueueGetQueueLength( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
/* *INDENT-OFF* */ /* *INDENT-OFF* */
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -366,6 +366,8 @@
BaseType_t xReturn = pdFAIL; BaseType_t xReturn = pdFAIL;
BaseType_t xIsPreviousWakeTimeAccessible = pdFALSE; BaseType_t xIsPreviousWakeTimeAccessible = pdFALSE;
if( ( pxPreviousWakeTime != NULL ) && ( xTimeIncrement > 0U ) )
{
xIsPreviousWakeTimeAccessible = xPortIsAuthorizedToAccessBuffer( pxPreviousWakeTime, xIsPreviousWakeTimeAccessible = xPortIsAuthorizedToAccessBuffer( pxPreviousWakeTime,
sizeof( TickType_t ), sizeof( TickType_t ),
( tskMPU_WRITE_PERMISSION | tskMPU_READ_PERMISSION ) ); ( tskMPU_WRITE_PERMISSION | tskMPU_READ_PERMISSION ) );
@ -374,6 +376,7 @@
{ {
xReturn = xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ); xReturn = xTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement );
} }
}
return xReturn; return xReturn;
} }
@ -391,12 +394,6 @@
TaskHandle_t xInternalTaskHandle = NULL; TaskHandle_t xInternalTaskHandle = NULL;
int32_t lIndex; int32_t lIndex;
if( xTask == NULL )
{
xReturn = xTaskAbortDelay( xTask );
}
else
{
lIndex = ( int32_t ) xTask; lIndex = ( int32_t ) xTask;
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
@ -408,7 +405,6 @@
xReturn = xTaskAbortDelay( xInternalTaskHandle ); xReturn = xTaskAbortDelay( xInternalTaskHandle );
} }
} }
}
return xReturn; return xReturn;
} }
@ -473,12 +469,6 @@
TaskHandle_t xInternalTaskHandle = NULL; TaskHandle_t xInternalTaskHandle = NULL;
int32_t lIndex; int32_t lIndex;
if( pxTask == NULL )
{
eReturn = eTaskGetState( pxTask );
}
else
{
lIndex = ( int32_t ) pxTask; lIndex = ( int32_t ) pxTask;
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
@ -490,7 +480,6 @@
eReturn = eTaskGetState( xInternalTaskHandle ); eReturn = eTaskGetState( xInternalTaskHandle );
} }
} }
}
return eReturn; return eReturn;
} }
@ -577,7 +566,11 @@
{ {
/* After the scheduler starts, only privileged tasks are allowed /* After the scheduler starts, only privileged tasks are allowed
* to suspend other tasks. */ * to suspend other tasks. */
#if ( INCLUDE_xTaskGetSchedulerState == 1 )
if( ( xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED ) || ( portIS_TASK_PRIVILEGED() == pdTRUE ) ) if( ( xTaskGetSchedulerState() == taskSCHEDULER_NOT_STARTED ) || ( portIS_TASK_PRIVILEGED() == pdTRUE ) )
#else
if( portIS_TASK_PRIVILEGED() == pdTRUE )
#endif
{ {
lIndex = ( int32_t ) pxTaskToSuspend; lIndex = ( int32_t ) pxTaskToSuspend;
@ -1047,6 +1040,8 @@
{ {
BaseType_t xIsTimeOutWriteable = pdFALSE; BaseType_t xIsTimeOutWriteable = pdFALSE;
if( pxTimeOut != NULL )
{
xIsTimeOutWriteable = xPortIsAuthorizedToAccessBuffer( pxTimeOut, xIsTimeOutWriteable = xPortIsAuthorizedToAccessBuffer( pxTimeOut,
sizeof( TimeOut_t ), sizeof( TimeOut_t ),
tskMPU_WRITE_PERMISSION ); tskMPU_WRITE_PERMISSION );
@ -1056,6 +1051,7 @@
vTaskSetTimeOutState( pxTimeOut ); vTaskSetTimeOutState( pxTimeOut );
} }
} }
}
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
BaseType_t MPU_xTaskCheckForTimeOutImpl( TimeOut_t * const pxTimeOut, BaseType_t MPU_xTaskCheckForTimeOutImpl( TimeOut_t * const pxTimeOut,
@ -1068,6 +1064,8 @@
BaseType_t xIsTimeOutWriteable = pdFALSE; BaseType_t xIsTimeOutWriteable = pdFALSE;
BaseType_t xIsTicksToWaitWriteable = pdFALSE; BaseType_t xIsTicksToWaitWriteable = pdFALSE;
if( ( pxTimeOut != NULL ) && ( pxTicksToWait != NULL ) )
{
xIsTimeOutWriteable = xPortIsAuthorizedToAccessBuffer( pxTimeOut, xIsTimeOutWriteable = xPortIsAuthorizedToAccessBuffer( pxTimeOut,
sizeof( TimeOut_t ), sizeof( TimeOut_t ),
tskMPU_WRITE_PERMISSION ); tskMPU_WRITE_PERMISSION );
@ -1079,6 +1077,7 @@
{ {
xReturn = xTaskCheckForTimeOut( pxTimeOut, pxTicksToWait ); xReturn = xTaskCheckForTimeOut( pxTimeOut, pxTicksToWait );
} }
}
return xReturn; return xReturn;
} }
@ -1103,6 +1102,8 @@
TaskHandle_t xInternalTaskHandle = NULL; TaskHandle_t xInternalTaskHandle = NULL;
BaseType_t xIsPreviousNotificationValueWriteable = pdFALSE; BaseType_t xIsPreviousNotificationValueWriteable = pdFALSE;
if( uxIndexToNotify < configTASK_NOTIFICATION_ARRAY_ENTRIES )
{
if( pulPreviousNotificationValue != NULL ) if( pulPreviousNotificationValue != NULL )
{ {
xIsPreviousNotificationValueWriteable = xPortIsAuthorizedToAccessBuffer( pulPreviousNotificationValue, xIsPreviousNotificationValueWriteable = xPortIsAuthorizedToAccessBuffer( pulPreviousNotificationValue,
@ -1124,6 +1125,7 @@
} }
} }
} }
}
return xReturn; return xReturn;
} }
@ -1148,6 +1150,8 @@
BaseType_t xReturn = pdFAIL; BaseType_t xReturn = pdFAIL;
BaseType_t xIsNotificationValueWritable = pdFALSE; BaseType_t xIsNotificationValueWritable = pdFALSE;
if( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES )
{
if( pulNotificationValue != NULL ) if( pulNotificationValue != NULL )
{ {
xIsNotificationValueWritable = xPortIsAuthorizedToAccessBuffer( pulNotificationValue, xIsNotificationValueWritable = xPortIsAuthorizedToAccessBuffer( pulNotificationValue,
@ -1159,6 +1163,7 @@
{ {
xReturn = xTaskGenericNotifyWait( uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait ); xReturn = xTaskGenericNotifyWait( uxIndexToWaitOn, ulBitsToClearOnEntry, ulBitsToClearOnExit, pulNotificationValue, xTicksToWait );
} }
}
return xReturn; return xReturn;
} }
@ -1176,9 +1181,12 @@
BaseType_t xClearCountOnExit, BaseType_t xClearCountOnExit,
TickType_t xTicksToWait ) /* PRIVILEGED_FUNCTION */ TickType_t xTicksToWait ) /* PRIVILEGED_FUNCTION */
{ {
uint32_t ulReturn; uint32_t ulReturn = 0;
if( uxIndexToWaitOn < configTASK_NOTIFICATION_ARRAY_ENTRIES )
{
ulReturn = ulTaskGenericNotifyTake( uxIndexToWaitOn, xClearCountOnExit, xTicksToWait ); ulReturn = ulTaskGenericNotifyTake( uxIndexToWaitOn, xClearCountOnExit, xTicksToWait );
}
return ulReturn; return ulReturn;
} }
@ -1198,6 +1206,8 @@
int32_t lIndex; int32_t lIndex;
TaskHandle_t xInternalTaskHandle = NULL; TaskHandle_t xInternalTaskHandle = NULL;
if( uxIndexToClear < configTASK_NOTIFICATION_ARRAY_ENTRIES )
{
if( xTask == NULL ) if( xTask == NULL )
{ {
xReturn = xTaskGenericNotifyStateClear( xTask, uxIndexToClear ); xReturn = xTaskGenericNotifyStateClear( xTask, uxIndexToClear );
@ -1216,6 +1226,7 @@
} }
} }
} }
}
return xReturn; return xReturn;
} }
@ -1237,6 +1248,8 @@
int32_t lIndex; int32_t lIndex;
TaskHandle_t xInternalTaskHandle = NULL; TaskHandle_t xInternalTaskHandle = NULL;
if( uxIndexToClear < configTASK_NOTIFICATION_ARRAY_ENTRIES )
{
if( xTask == NULL ) if( xTask == NULL )
{ {
ulReturn = ulTaskGenericNotifyValueClear( xTask, uxIndexToClear, ulBitsToClear ); ulReturn = ulTaskGenericNotifyValueClear( xTask, uxIndexToClear, ulBitsToClear );
@ -1255,6 +1268,7 @@
} }
} }
} }
}
return ulReturn; return ulReturn;
} }
@ -1809,6 +1823,7 @@
QueueHandle_t xInternalQueueHandle = NULL; QueueHandle_t xInternalQueueHandle = NULL;
BaseType_t xReturn = pdFAIL; BaseType_t xReturn = pdFAIL;
BaseType_t xIsItemToQueueReadable = pdFALSE; BaseType_t xIsItemToQueueReadable = pdFALSE;
UBaseType_t uxQueueItemSize, uxQueueLength;
lIndex = ( int32_t ) xQueue; lIndex = ( int32_t ) xQueue;
@ -1817,6 +1832,16 @@
xInternalQueueHandle = MPU_GetQueueHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); xInternalQueueHandle = MPU_GetQueueHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
if( xInternalQueueHandle != NULL ) if( xInternalQueueHandle != NULL )
{
uxQueueItemSize = uxQueueGetQueueItemSize( xInternalQueueHandle );
uxQueueLength = uxQueueGetQueueLength( xInternalQueueHandle );
if( ( !( ( pvItemToQueue == NULL ) && ( uxQueueItemSize != ( UBaseType_t ) 0U ) ) ) &&
( !( ( xCopyPosition == queueOVERWRITE ) && ( uxQueueLength != ( UBaseType_t ) 1U ) ) )
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
&& ( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) )
#endif
)
{ {
if( pvItemToQueue != NULL ) if( pvItemToQueue != NULL )
{ {
@ -1831,6 +1856,7 @@
} }
} }
} }
}
return xReturn; return xReturn;
} }
@ -1896,6 +1922,7 @@
QueueHandle_t xInternalQueueHandle = NULL; QueueHandle_t xInternalQueueHandle = NULL;
BaseType_t xReturn = pdFAIL; BaseType_t xReturn = pdFAIL;
BaseType_t xIsReceiveBufferWritable = pdFALSE; BaseType_t xIsReceiveBufferWritable = pdFALSE;
UBaseType_t uxQueueItemSize;
lIndex = ( int32_t ) pxQueue; lIndex = ( int32_t ) pxQueue;
@ -1904,6 +1931,14 @@
xInternalQueueHandle = MPU_GetQueueHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); xInternalQueueHandle = MPU_GetQueueHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
if( xInternalQueueHandle != NULL ) if( xInternalQueueHandle != NULL )
{
uxQueueItemSize = uxQueueGetQueueItemSize( xInternalQueueHandle );
if( ( !( ( ( pvBuffer ) == NULL ) && ( uxQueueItemSize != ( UBaseType_t ) 0U ) ) )
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
&& ( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) )
#endif
)
{ {
xIsReceiveBufferWritable = xPortIsAuthorizedToAccessBuffer( pvBuffer, xIsReceiveBufferWritable = xPortIsAuthorizedToAccessBuffer( pvBuffer,
uxQueueGetQueueItemSize( xInternalQueueHandle ), uxQueueGetQueueItemSize( xInternalQueueHandle ),
@ -1915,6 +1950,7 @@
} }
} }
} }
}
return xReturn; return xReturn;
} }
@ -1932,6 +1968,7 @@
QueueHandle_t xInternalQueueHandle = NULL; QueueHandle_t xInternalQueueHandle = NULL;
BaseType_t xReturn = pdFAIL; BaseType_t xReturn = pdFAIL;
BaseType_t xIsReceiveBufferWritable = pdFALSE; BaseType_t xIsReceiveBufferWritable = pdFALSE;
UBaseType_t uxQueueItemSize;
lIndex = ( int32_t ) xQueue; lIndex = ( int32_t ) xQueue;
@ -1940,6 +1977,14 @@
xInternalQueueHandle = MPU_GetQueueHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); xInternalQueueHandle = MPU_GetQueueHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
if( xInternalQueueHandle != NULL ) if( xInternalQueueHandle != NULL )
{
uxQueueItemSize = uxQueueGetQueueItemSize( xInternalQueueHandle );
if( ( !( ( ( pvBuffer ) == NULL ) && ( uxQueueItemSize != ( UBaseType_t ) 0U ) ) )
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
&& ( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) )
#endif
)
{ {
xIsReceiveBufferWritable = xPortIsAuthorizedToAccessBuffer( pvBuffer, xIsReceiveBufferWritable = xPortIsAuthorizedToAccessBuffer( pvBuffer,
uxQueueGetQueueItemSize( xInternalQueueHandle ), uxQueueGetQueueItemSize( xInternalQueueHandle ),
@ -1951,6 +1996,7 @@
} }
} }
} }
}
return xReturn; return xReturn;
} }
@ -1965,6 +2011,7 @@
int32_t lIndex; int32_t lIndex;
QueueHandle_t xInternalQueueHandle = NULL; QueueHandle_t xInternalQueueHandle = NULL;
BaseType_t xReturn = pdFAIL; BaseType_t xReturn = pdFAIL;
UBaseType_t uxQueueItemSize;
lIndex = ( int32_t ) xQueue; lIndex = ( int32_t ) xQueue;
@ -1973,10 +2020,19 @@
xInternalQueueHandle = MPU_GetQueueHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) ); xInternalQueueHandle = MPU_GetQueueHandleAtIndex( CONVERT_TO_INTERNAL_INDEX( lIndex ) );
if( xInternalQueueHandle != NULL ) if( xInternalQueueHandle != NULL )
{
uxQueueItemSize = uxQueueGetQueueItemSize( xInternalQueueHandle );
if( ( uxQueueItemSize == 0 )
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
&& ( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) )
#endif
)
{ {
xReturn = xQueueSemaphoreTake( xInternalQueueHandle, xTicksToWait ); xReturn = xQueueSemaphoreTake( xInternalQueueHandle, xTicksToWait );
} }
} }
}
return xReturn; return xReturn;
} }
@ -2932,6 +2988,8 @@
int32_t lIndex; int32_t lIndex;
BaseType_t xIsHigherPriorityTaskWokenWriteable = pdFALSE; BaseType_t xIsHigherPriorityTaskWokenWriteable = pdFALSE;
if( xCommandID < tmrFIRST_FROM_ISR_COMMAND )
{
if( pxHigherPriorityTaskWoken != NULL ) if( pxHigherPriorityTaskWoken != NULL )
{ {
xIsHigherPriorityTaskWokenWriteable = xPortIsAuthorizedToAccessBuffer( pxHigherPriorityTaskWoken, xIsHigherPriorityTaskWokenWriteable = xPortIsAuthorizedToAccessBuffer( pxHigherPriorityTaskWoken,
@ -2953,6 +3011,7 @@
} }
} }
} }
}
return xReturn; return xReturn;
} }
@ -3291,6 +3350,13 @@
EventGroupHandle_t xInternalEventGroupHandle = NULL; EventGroupHandle_t xInternalEventGroupHandle = NULL;
int32_t lIndex; int32_t lIndex;
if( ( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 ) &&
( uxBitsToWaitFor != 0 )
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
&& ( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) )
#endif
)
{
lIndex = ( int32_t ) xEventGroup; lIndex = ( int32_t ) xEventGroup;
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
@ -3302,6 +3368,7 @@
xReturn = xEventGroupWaitBits( xInternalEventGroupHandle, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait ); xReturn = xEventGroupWaitBits( xInternalEventGroupHandle, uxBitsToWaitFor, xClearOnExit, xWaitForAllBits, xTicksToWait );
} }
} }
}
return xReturn; return xReturn;
} }
@ -3317,6 +3384,8 @@
EventGroupHandle_t xInternalEventGroupHandle = NULL; EventGroupHandle_t xInternalEventGroupHandle = NULL;
int32_t lIndex; int32_t lIndex;
if( ( uxBitsToClear & eventEVENT_BITS_CONTROL_BYTES ) == 0 )
{
lIndex = ( int32_t ) xEventGroup; lIndex = ( int32_t ) xEventGroup;
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
@ -3328,6 +3397,7 @@
xReturn = xEventGroupClearBits( xInternalEventGroupHandle, uxBitsToClear ); xReturn = xEventGroupClearBits( xInternalEventGroupHandle, uxBitsToClear );
} }
} }
}
return xReturn; return xReturn;
} }
@ -3343,6 +3413,8 @@
EventGroupHandle_t xInternalEventGroupHandle = NULL; EventGroupHandle_t xInternalEventGroupHandle = NULL;
int32_t lIndex; int32_t lIndex;
if( ( uxBitsToSet & eventEVENT_BITS_CONTROL_BYTES ) == 0 )
{
lIndex = ( int32_t ) xEventGroup; lIndex = ( int32_t ) xEventGroup;
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
@ -3354,6 +3426,7 @@
xReturn = xEventGroupSetBits( xInternalEventGroupHandle, uxBitsToSet ); xReturn = xEventGroupSetBits( xInternalEventGroupHandle, uxBitsToSet );
} }
} }
}
return xReturn; return xReturn;
} }
@ -3373,6 +3446,13 @@
EventGroupHandle_t xInternalEventGroupHandle = NULL; EventGroupHandle_t xInternalEventGroupHandle = NULL;
int32_t lIndex; int32_t lIndex;
if( ( ( uxBitsToWaitFor & eventEVENT_BITS_CONTROL_BYTES ) == 0 ) &&
( uxBitsToWaitFor != 0 )
#if ( ( INCLUDE_xTaskGetSchedulerState == 1 ) || ( configUSE_TIMERS == 1 ) )
&& ( !( ( xTaskGetSchedulerState() == taskSCHEDULER_SUSPENDED ) && ( xTicksToWait != 0 ) ) )
#endif
)
{
lIndex = ( int32_t ) xEventGroup; lIndex = ( int32_t ) xEventGroup;
if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE ) if( IS_EXTERNAL_INDEX_VALID( lIndex ) != pdFALSE )
@ -3384,6 +3464,7 @@
xReturn = xEventGroupSync( xInternalEventGroupHandle, uxBitsToSet, uxBitsToWaitFor, xTicksToWait ); xReturn = xEventGroupSync( xInternalEventGroupHandle, uxBitsToSet, uxBitsToWaitFor, xTicksToWait );
} }
} }
}
return xReturn; return xReturn;
} }
@ -3654,6 +3735,8 @@
int32_t lIndex; int32_t lIndex;
BaseType_t xIsTxDataBufferReadable = pdFALSE; BaseType_t xIsTxDataBufferReadable = pdFALSE;
if( pvTxData != NULL )
{
xIsTxDataBufferReadable = xPortIsAuthorizedToAccessBuffer( pvTxData, xIsTxDataBufferReadable = xPortIsAuthorizedToAccessBuffer( pvTxData,
xDataLengthBytes, xDataLengthBytes,
tskMPU_READ_PERMISSION ); tskMPU_READ_PERMISSION );
@ -3672,6 +3755,7 @@
} }
} }
} }
}
return xReturn; return xReturn;
} }
@ -3692,6 +3776,8 @@
int32_t lIndex; int32_t lIndex;
BaseType_t xIsRxDataBufferWriteable = pdFALSE; BaseType_t xIsRxDataBufferWriteable = pdFALSE;
if( pvRxData != NULL )
{
xIsRxDataBufferWriteable = xPortIsAuthorizedToAccessBuffer( pvRxData, xIsRxDataBufferWriteable = xPortIsAuthorizedToAccessBuffer( pvRxData,
xBufferLengthBytes, xBufferLengthBytes,
tskMPU_WRITE_PERMISSION ); tskMPU_WRITE_PERMISSION );
@ -3710,6 +3796,7 @@
} }
} }
} }
}
return xReturn; return xReturn;
} }

View file

@ -2236,6 +2236,12 @@ UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) /* PRIVILEGED_FUNCTI
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
UBaseType_t uxQueueGetQueueLength( QueueHandle_t xQueue ) /* PRIVILEGED_FUNCTION */
{
return ( ( Queue_t * ) xQueue )->uxLength;
}
/*-----------------------------------------------------------*/
#if ( configUSE_MUTEXES == 1 ) #if ( configUSE_MUTEXES == 1 )
static UBaseType_t prvGetDisinheritPriorityAfterTimeout( const Queue_t * const pxQueue ) static UBaseType_t prvGetDisinheritPriorityAfterTimeout( const Queue_t * const pxQueue )

View file

@ -7408,6 +7408,8 @@ TickType_t uxTaskResetEventItemValue( void )
TCB_t * pxTCB; TCB_t * pxTCB;
uint32_t ulReturn; uint32_t ulReturn;
configASSERT( uxIndexToClear < configTASK_NOTIFICATION_ARRAY_ENTRIES );
/* If null is passed in here then it is the calling task that is having /* If null is passed in here then it is the calling task that is having
* its notification state cleared. */ * its notification state cleared. */
pxTCB = prvGetTCBFromHandle( xTask ); pxTCB = prvGetTCBFromHandle( xTask );