]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/list.c
Kernel changes:
[freertos] / FreeRTOS / Source / list.c
index a8d9d5b90670d5fedb59702b077960ce6e4bc566..d256fae4c68d56600d62b7da667664e0f18d05ae 100644 (file)
@@ -89,6 +89,11 @@ void vListInitialise( List_t * const pxList )
        pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
 \r
        pxList->uxNumberOfItems = ( UBaseType_t ) 0U;\r
+\r
+       /* Write known values into the list if\r
+       configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+       listSET_LIST_INTEGRITY_CHECK_1_VALUE( pxList );\r
+       listSET_LIST_INTEGRITY_CHECK_2_VALUE( pxList );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -96,6 +101,11 @@ void vListInitialiseItem( ListItem_t * const pxItem )
 {\r
        /* Make sure the list item is not recorded as being on a list. */\r
        pxItem->pvContainer = NULL;\r
+\r
+       /* Write known values into the list item if\r
+       configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */\r
+       listSET_LIST_ITEM_INTEGRITY_CHECK_1_VALUE( pxItem );\r
+       listSET_LIST_ITEM_INTEGRITY_CHECK_2_VALUE( pxItem );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -103,6 +113,12 @@ void vListInsertEnd( List_t * const pxList, ListItem_t * const pxNewListItem )
 {\r
 ListItem_t * const pxIndex = pxList->pxIndex;\r
 \r
+       /* Only effective when configASSERT() is also defined, these tests may catch\r
+       the list data structures being overwritten in memory.  They will not catch\r
+       data errors caused by incorrect configuration or use of FreeRTOS. */\r
+       listTEST_LIST_INTEGRITY( pxList );\r
+       listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );\r
+\r
        /* Insert a new list item into pxList, but rather than sort the list,\r
        makes the new list item the last item to be removed by a call to\r
        listGET_OWNER_OF_NEXT_ENTRY(). */\r
@@ -123,6 +139,12 @@ void vListInsert( List_t * const pxList, ListItem_t * const pxNewListItem )
 ListItem_t *pxIterator;\r
 const TickType_t xValueOfInsertion = pxNewListItem->xItemValue;\r
 \r
+       /* Only effective when configASSERT() is also defined, these tests may catch\r
+       the list data structures being overwritten in memory.  They will not catch\r
+       data errors caused by incorrect configuration or use of FreeRTOS. */\r
+       listTEST_LIST_INTEGRITY( pxList );\r
+       listTEST_LIST_ITEM_INTEGRITY( pxNewListItem );\r
+\r
        /* Insert the new list item into the list, sorted in xItemValue order.\r
 \r
        If the list already contains a list item with the same item value then the\r