mirror of
				https://github.com/FreeRTOS/FreeRTOS-Kernel.git
				synced 2025-11-04 11:09:01 +01:00 
			
		
		
		
	Add configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type. (#433)
* Add configUSE_MINI_LIST_ITEM configuration option to enable the MiniListItem_t type. When configUSE_MINI_LIST_ITEM == 0: MiniListItem_t and ListItem_t are both typedefs of struct xLIST_ITEM. When configUSE_MINI_LIST_ITEM == 1 (the default in projdefs.h): MiniListItem_t is a typedef of struct xMINI_LIST_ITEM, which contains 3 fewer fields than a struct xLIST_ITEM. This configuration saves approximately sizeof(TickType_t) + 2 * sizeof( void * ) bytes of ram, however it also violates strict aliasing rules which some compilers depend on for optimization. configUSE_MINI_LIST_ITEM defaults to 1 when not defined. * Add pp_indent_brace option to uncrustify config Improves compliance with the FreeRTOS code style guide: https://www.freertos.org/FreeRTOS-Coding-Standard-and-Style-Guide.html
This commit is contained in:
		
							parent
							
								
									043c2c7ef6
								
							
						
					
					
						commit
						dca4f80a6b
					
				
							
								
								
									
										1
									
								
								.github/uncrustify.cfg
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.github/uncrustify.cfg
									
									
									
									
										vendored
									
									
								
							@ -157,4 +157,5 @@ pp_indent_at_level              = true     # false/true
 | 
			
		||||
pp_indent_count                 = 4        # unsigned number
 | 
			
		||||
pp_space                        = remove   # ignore/add/remove/force
 | 
			
		||||
pp_if_indent_code               = true     # false/true
 | 
			
		||||
pp_indent_brace                 = false    # true/false
 | 
			
		||||
# option(s) with 'not default' value: 158
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,12 @@ Documentation and download available at https://www.FreeRTOS.org/
 | 
			
		||||
	  The new function xTimerGetAutoReload() provides the auto-reload state as
 | 
			
		||||
	  a BaseType_t.  The legacy function uxTimerGetAutoReload is retained with the
 | 
			
		||||
	  original UBaseType_t return value.
 | 
			
		||||
	+ Introduce the configUSE_MINI_LIST_ITEM configuration option. When this
 | 
			
		||||
	  option is set to 1, ListItem_t and MiniLitItem_t remain separate types.
 | 
			
		||||
	  However, when configUSE_MINI_LIST_ITEM == 0, MiniLitItem_t and ListItem_t
 | 
			
		||||
	  are both typedefs of the same struct xLIST_ITEM. This addresses some issues
 | 
			
		||||
	  observed when strict-aliasing and link time optimization are enabled.
 | 
			
		||||
	  To maintain backwards compatibility, configUSE_MINI_LIST_ITEM defaults to 1.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Changes between FreeRTOS V10.4.4 and FreeRTOS V10.4.5 released September 10 2021
 | 
			
		||||
 | 
			
		||||
@ -334,6 +334,10 @@
 | 
			
		||||
    #define pcQueueGetName( xQueue )
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef configUSE_MINI_LIST_ITEM
 | 
			
		||||
    #define configUSE_MINI_LIST_ITEM    1
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef portPOINTER_SIZE_TYPE
 | 
			
		||||
    #define portPOINTER_SIZE_TYPE    uint32_t
 | 
			
		||||
#endif
 | 
			
		||||
@ -1134,6 +1138,7 @@ struct xSTATIC_LIST_ITEM
 | 
			
		||||
};
 | 
			
		||||
typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
 | 
			
		||||
 | 
			
		||||
#if ( configUSE_MINI_LIST_ITEM == 1 )
 | 
			
		||||
    /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
 | 
			
		||||
    struct xSTATIC_MINI_LIST_ITEM
 | 
			
		||||
    {
 | 
			
		||||
@ -1144,6 +1149,9 @@ struct xSTATIC_MINI_LIST_ITEM
 | 
			
		||||
        void * pvDummy3[ 2 ];
 | 
			
		||||
    };
 | 
			
		||||
    typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
 | 
			
		||||
#else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
 | 
			
		||||
    typedef struct xSTATIC_LIST_ITEM      StaticMiniListItem_t;
 | 
			
		||||
#endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
 | 
			
		||||
 | 
			
		||||
/* See the comments above the struct xSTATIC_LIST_ITEM definition. */
 | 
			
		||||
typedef struct xSTATIC_LIST
 | 
			
		||||
 | 
			
		||||
@ -153,6 +153,7 @@ struct xLIST_ITEM
 | 
			
		||||
};
 | 
			
		||||
typedef struct xLIST_ITEM ListItem_t;                   /* For some reason lint wants this as two separate definitions. */
 | 
			
		||||
 | 
			
		||||
#if ( configUSE_MINI_LIST_ITEM == 1 )
 | 
			
		||||
    struct xMINI_LIST_ITEM
 | 
			
		||||
    {
 | 
			
		||||
        listFIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE /*< Set to a known value if configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES is set to 1. */
 | 
			
		||||
@ -161,6 +162,9 @@ struct xMINI_LIST_ITEM
 | 
			
		||||
        struct xLIST_ITEM * configLIST_VOLATILE pxPrevious;
 | 
			
		||||
    };
 | 
			
		||||
    typedef struct xMINI_LIST_ITEM MiniListItem_t;
 | 
			
		||||
#else
 | 
			
		||||
    typedef struct xLIST_ITEM      MiniListItem_t;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Definition of the type of queue used by the scheduler.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								list.c
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								list.c
									
									
									
									
									
								
							@ -54,6 +54,8 @@ void vListInitialise( List_t * const pxList )
 | 
			
		||||
     * as the only list entry. */
 | 
			
		||||
    pxList->pxIndex = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM.  This is checked and valid. */
 | 
			
		||||
 | 
			
		||||
    listSET_FIRST_LIST_ITEM_INTEGRITY_CHECK_VALUE( &( pxList->xListEnd ) );
 | 
			
		||||
 | 
			
		||||
    /* The list end value is the highest possible value in the list to
 | 
			
		||||
     * ensure it remains at the end of the list. */
 | 
			
		||||
    pxList->xListEnd.xItemValue = portMAX_DELAY;
 | 
			
		||||
@ -63,6 +65,15 @@ void vListInitialise( List_t * const pxList )
 | 
			
		||||
    pxList->xListEnd.pxNext = ( ListItem_t * ) &( pxList->xListEnd );     /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM.  This is checked and valid. */
 | 
			
		||||
    pxList->xListEnd.pxPrevious = ( ListItem_t * ) &( pxList->xListEnd ); /*lint !e826 !e740 !e9087 The mini list structure is used as the list end to save RAM.  This is checked and valid. */
 | 
			
		||||
 | 
			
		||||
    /* Initialize the remaining fields of xListEnd when it is a proper ListItem_t */
 | 
			
		||||
    #if ( configUSE_MINI_LIST_ITEM == 0 )
 | 
			
		||||
    {
 | 
			
		||||
        pxList->xListEnd.pvOwner = NULL;
 | 
			
		||||
        pxList->xListEnd.pxContainer = NULL;
 | 
			
		||||
        listSET_SECOND_LIST_ITEM_INTEGRITY_CHECK_VALUE( &( pxList->xListEnd ) );
 | 
			
		||||
    }
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    pxList->uxNumberOfItems = ( UBaseType_t ) 0U;
 | 
			
		||||
 | 
			
		||||
    /* Write known values into the list if
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user