summaryrefslogtreecommitdiff
path: root/FreeRTOS/Source/include/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'FreeRTOS/Source/include/list.h')
-rw-r--r--FreeRTOS/Source/include/list.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/FreeRTOS/Source/include/list.h b/FreeRTOS/Source/include/list.h
index 99be287fc..70d53da0a 100644
--- a/FreeRTOS/Source/include/list.h
+++ b/FreeRTOS/Source/include/list.h
@@ -91,6 +91,9 @@
* \ingroup FreeRTOSIntro
*/
+#ifndef INC_FREERTOS_H
+ #error FreeRTOS.h must be included before list.h
+#endif
#ifndef LIST_H
#define LIST_H
@@ -130,21 +133,62 @@
#ifdef __cplusplus
extern "C" {
#endif
+
+/* Macros that can be used to place known values within the list structures,
+then check that the known values do not get corrupted during the execution of
+the application. These may catch the list data structures being overwritten in
+memory. They will not catch data errors caused by incorrect configuration or
+use of FreeRTOS.*/
+#if( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 0 )
+ /* Define the macros to do nothing. */
+ #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_1
+ #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_2
+ #define listLIST_INTEGRITY_CHECK_VALUE_1
+ #define listLIST_INTEGRITY_CHECK_VALUE_2
+ #define listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem )
+ #define listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem )
+ #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList )
+ #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList )
+ #define listTEST_LIST_ITEM_INTEGRITY( pxItem )
+ #define listTEST_LIST_INTEGRITY( pxList )
+#else
+ /* Define macros that add new members into the list structures. */
+ #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 TickType_t xListItemIntegrityValue1;
+ #define listLIST_ITEM_INTEGRITY_CHECK_VALUE_2 TickType_t xListItemIntegrityValue2;
+ #define listLIST_INTEGRITY_CHECK_VALUE_1 TickType_t xListIntegrityValue1;
+ #define listLIST_INTEGRITY_CHECK_VALUE_2 TickType_t xListIntegrityValue2;
+
+ /* Define macros that set the new structure members to known values. */
+ #define listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
+ #define listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem ) ( pxItem )->xListItemIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
+ #define listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList ) ( pxList )->xListIntegrityValue1 = pdINTEGRITY_CHECK_VALUE
+ #define listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList ) ( pxList )->xListIntegrityValue2 = pdINTEGRITY_CHECK_VALUE
+
+ /* Define macros that will assert if one of the structure members does not
+ contain its expected value. */
+ #define listTEST_LIST_ITEM_INTEGRITY( pxItem ) configASSERT( ( ( pxItem )->xListItemIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxItem )->xListItemIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
+ #define listTEST_LIST_INTEGRITY( pxList ) configASSERT( ( ( pxList )->xListIntegrityValue1 == pdINTEGRITY_CHECK_VALUE ) && ( ( pxList )->xListIntegrityValue2 == pdINTEGRITY_CHECK_VALUE ) )
+#endif /* configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES */
+
+
/*
* Definition of the only type of object that a list can contain.
*/
struct xLIST_ITEM
{
+ listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
configLIST_VOLATILE TickType_t xItemValue; /*< The value being listed. In most cases this is used to sort the list in descending order. */
struct xLIST_ITEM * configLIST_VOLATILE pxNext; /*< Pointer to the next ListItem_t in the list. */
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious; /*< Pointer to the previous ListItem_t in the list. */
void * pvOwner; /*< Pointer to the object (normally a TCB) that contains the list item. There is therefore a two way link between the object containing the list item and the list item itself. */
void * configLIST_VOLATILE pvContainer; /*< Pointer to the list in which this list item is placed (if any). */
+ listLIST_ITEM_INTEGRITY_CHECK_VALUE_2 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
};
typedef struct xLIST_ITEM ListItem_t; /* For some reason lint wants this as two separate definitions. */
struct xMINI_LIST_ITEM
{
+ listLIST_ITEM_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
configLIST_VOLATILE TickType_t xItemValue;
struct xLIST_ITEM * configLIST_VOLATILE pxNext;
struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
@@ -156,9 +200,11 @@ typedef struct xMINI_LIST_ITEM MiniListItem_t;
*/
typedef struct xLIST
{
+ listLIST_INTEGRITY_CHECK_VALUE_1 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
configLIST_VOLATILE UBaseType_t uxNumberOfItems;
ListItem_t * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */
MiniListItem_t xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */
+ listLIST_INTEGRITY_CHECK_VALUE_2 /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
} List_t;
/*