Skip to content

Commit

Permalink
Add runtime parameter checks (#758)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
kar-rahul-aws authored Aug 17, 2023
1 parent 0d87194 commit ace6b39
Show file tree
Hide file tree
Showing 7 changed files with 269 additions and 175 deletions.
1 change: 1 addition & 0 deletions .github/lexicon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2469,6 +2469,7 @@ uxpriority
uxprioritytouse
uxqueue
uxqueuegetqueueitemsize
uxqueuegetqueuelength
uxqueuelength
uxqueuemessageswaiting
uxqueuespacesavailable
Expand Down
20 changes: 0 additions & 20 deletions event_groups.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,6 @@
* correct privileged Vs unprivileged linkage and placement. */
#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
{
EventBits_t uxEventBits;
Expand Down
20 changes: 20 additions & 0 deletions include/event_groups.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@
/* FreeRTOS includes. */
#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* */
#ifdef __cplusplus
extern "C" {
Expand Down
1 change: 1 addition & 0 deletions include/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,7 @@ void vQueueSetQueueNumber( QueueHandle_t xQueue,
UBaseType_t uxQueueGetQueueNumber( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
uint8_t ucQueueGetQueueType( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;
UBaseType_t uxQueueGetQueueLength( QueueHandle_t xQueue ) PRIVILEGED_FUNCTION;

/* *INDENT-OFF* */
#ifdef __cplusplus
Expand Down
Loading

0 comments on commit ace6b39

Please sign in to comment.