feat(freertos/smp): Update SMP FreeRTOS files to V11.0.1

This commit updates the source files of Amazon SMP FreeRTOS to upstream
V11.0.1 (https://github.com/FreeRTOS/FreeRTOS-Kernel/tree/V11.0.1).

This version contains SMP support.
This commit is contained in:
Darian Leung
2024-01-05 17:14:26 +08:00
parent 0286a78ca4
commit 421dab29fa
32 changed files with 11463 additions and 5107 deletions

View File

@@ -1,6 +1,12 @@
/*
* FreeRTOS SMP Kernel V202110.00
* Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* FreeRTOS Kernel V11.0.1
* Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* SPDX-FileCopyrightText: 2021 Amazon.com, Inc. or its affiliates
*
* SPDX-License-Identifier: MIT
*
* SPDX-FileContributor: 2023-2024 Espressif Systems (Shanghai) CO LTD
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -42,9 +48,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* vSemaphoreCreateBinary( SemaphoreHandle_t xSemaphore );
* </pre>
* @endcode
*
* In many usage scenarios it is faster and more memory efficient to use a
* direct to task notification in place of a binary semaphore!
@@ -72,7 +78,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* @param xSemaphore Handle to the created semaphore. Should be of type SemaphoreHandle_t.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore = NULL;
*
* void vATask( void * pvParameters )
@@ -87,26 +93,26 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // The semaphore can now be used.
* }
* }
* </pre>
* @endcode
* \defgroup vSemaphoreCreateBinary vSemaphoreCreateBinary
* \ingroup Semaphores
*/
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
#define vSemaphoreCreateBinary( xSemaphore ) \
{ \
do { \
( xSemaphore ) = xQueueGenericCreate( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_BINARY_SEMAPHORE ); \
if( ( xSemaphore ) != NULL ) \
{ \
( void ) xSemaphoreGive( ( xSemaphore ) ); \
} \
}
} while( 0 )
#endif
/**
* semphr. h
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateBinary( void );
* </pre>
* @endcode
*
* Creates a new binary semaphore instance, and returns a handle by which the
* new semaphore can be referenced.
@@ -142,7 +148,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* hold the semaphore's data structures could not be allocated.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore = NULL;
*
* void vATask( void * pvParameters )
@@ -157,7 +163,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // The semaphore can now be used.
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreCreateBinary xSemaphoreCreateBinary
* \ingroup Semaphores
*/
@@ -167,9 +173,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateBinaryStatic( StaticSemaphore_t *pxSemaphoreBuffer );
* </pre>
* @endcode
*
* Creates a new binary semaphore instance, and returns a handle by which the
* new semaphore can be referenced.
@@ -202,7 +208,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* returned. If pxSemaphoreBuffer is NULL then NULL is returned.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore = NULL;
* StaticSemaphore_t xSemaphoreBuffer;
*
@@ -218,22 +224,22 @@ typedef QueueHandle_t SemaphoreHandle_t;
*
* // Rest of task code goes here.
* }
* </pre>
* @endcode
* \defgroup xSemaphoreCreateBinaryStatic xSemaphoreCreateBinaryStatic
* \ingroup Semaphores
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
#define xSemaphoreCreateBinaryStatic( pxStaticSemaphore ) xQueueGenericCreateStatic( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, pxStaticSemaphore, queueQUEUE_TYPE_BINARY_SEMAPHORE )
#define xSemaphoreCreateBinaryStatic( pxStaticSemaphore ) xQueueGenericCreateStatic( ( UBaseType_t ) 1, semSEMAPHORE_QUEUE_ITEM_LENGTH, NULL, ( pxStaticSemaphore ), queueQUEUE_TYPE_BINARY_SEMAPHORE )
#endif /* configSUPPORT_STATIC_ALLOCATION */
/**
* semphr. h
* <pre>
* @code{c}
* xSemaphoreTake(
* SemaphoreHandle_t xSemaphore,
* TickType_t xBlockTime
* );
* </pre>
* @endcode
*
* <i>Macro</i> to obtain a semaphore. The semaphore must have previously been
* created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
@@ -252,7 +258,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* if xBlockTime expired without the semaphore becoming available.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore = NULL;
*
* // A task that creates a semaphore.
@@ -289,7 +295,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* }
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreTake xSemaphoreTake
* \ingroup Semaphores
*/
@@ -297,12 +303,12 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* xSemaphoreTakeRecursive(
* SemaphoreHandle_t xMutex,
* TickType_t xBlockTime
* );
* </pre>
* @endcode
*
* <i>Macro</i> to recursively obtain, or 'take', a mutex type semaphore.
* The mutex must have previously been created using a call to
@@ -333,7 +339,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* expired without the semaphore becoming available.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xMutex = NULL;
*
* // A task that creates a mutex.
@@ -384,7 +390,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* }
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreTakeRecursive xSemaphoreTakeRecursive
* \ingroup Semaphores
*/
@@ -394,9 +400,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* xSemaphoreGive( SemaphoreHandle_t xSemaphore );
* </pre>
* @endcode
*
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
* created with a call to xSemaphoreCreateBinary(), xSemaphoreCreateMutex() or
@@ -417,7 +423,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* semaphore was not first obtained correctly.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore = NULL;
*
* void vATask( void * pvParameters )
@@ -451,7 +457,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* }
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreGive xSemaphoreGive
* \ingroup Semaphores
*/
@@ -459,9 +465,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* xSemaphoreGiveRecursive( SemaphoreHandle_t xMutex );
* </pre>
* @endcode
*
* <i>Macro</i> to recursively release, or 'give', a mutex type semaphore.
* The mutex must have previously been created using a call to
@@ -485,7 +491,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* @return pdTRUE if the semaphore was given.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xMutex = NULL;
*
* // A task that creates a mutex.
@@ -537,7 +543,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* }
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreGiveRecursive xSemaphoreGiveRecursive
* \ingroup Semaphores
*/
@@ -547,12 +553,12 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* xSemaphoreGiveFromISR(
* SemaphoreHandle_t xSemaphore,
* BaseType_t *pxHigherPriorityTaskWoken
* );
* </pre>
* @endcode
*
* <i>Macro</i> to release a semaphore. The semaphore must have previously been
* created with a call to xSemaphoreCreateBinary() or xSemaphoreCreateCounting().
@@ -574,7 +580,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* @return pdTRUE if the semaphore was successfully given, otherwise errQUEUE_FULL.
*
* Example usage:
* <pre>
* @code{c}
\#define LONG_TIME 0xffff
\#define TICKS_TO_WAIT 10
* SemaphoreHandle_t xSemaphore = NULL;
@@ -631,7 +637,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // to find the syntax required.
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreGiveFromISR xSemaphoreGiveFromISR
* \ingroup Semaphores
*/
@@ -639,12 +645,12 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* xSemaphoreTakeFromISR(
* SemaphoreHandle_t xSemaphore,
* BaseType_t *pxHigherPriorityTaskWoken
* );
* </pre>
* @endcode
*
* <i>Macro</i> to take a semaphore from an ISR. The semaphore must have
* previously been created with a call to xSemaphoreCreateBinary() or
@@ -674,9 +680,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateMutex( void );
* </pre>
* @endcode
*
* Creates a new mutex type semaphore instance, and returns a handle by which
* the new mutex can be referenced.
@@ -710,7 +716,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* data structures then NULL is returned.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore;
*
* void vATask( void * pvParameters )
@@ -725,19 +731,19 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // The semaphore can now be used.
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreCreateMutex xSemaphoreCreateMutex
* \ingroup Semaphores
*/
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configUSE_MUTEXES == 1 ) )
#define xSemaphoreCreateMutex() xQueueCreateMutex( queueQUEUE_TYPE_MUTEX )
#endif
/**
* semphr. h
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateMutexStatic( StaticSemaphore_t *pxMutexBuffer );
* </pre>
* @endcode
*
* Creates a new mutex type semaphore instance, and returns a handle by which
* the new mutex can be referenced.
@@ -774,7 +780,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* mutex is returned. If pxMutexBuffer was NULL then NULL is returned.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore;
* StaticSemaphore_t xMutexBuffer;
*
@@ -788,25 +794,25 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // As no dynamic memory allocation was performed, xSemaphore cannot be NULL,
* // so there is no need to check it.
* }
* </pre>
* @endcode
* \defgroup xSemaphoreCreateMutexStatic xSemaphoreCreateMutexStatic
* \ingroup Semaphores
*/
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_MUTEXES == 1 ) )
#define xSemaphoreCreateMutexStatic( pxMutexBuffer ) xQueueCreateMutexStatic( queueQUEUE_TYPE_MUTEX, ( pxMutexBuffer ) )
#endif /* configSUPPORT_STATIC_ALLOCATION */
#endif
/**
* semphr. h
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateRecursiveMutex( void );
* </pre>
* @endcode
*
* Creates a new recursive mutex type semaphore instance, and returns a handle
* by which the new recursive mutex can be referenced.
*
* Internally, within the FreeRTOS implementation, recursive mutexs use a block
* Internally, within the FreeRTOS implementation, recursive mutexes use a block
* of memory, in which the mutex structure is stored. If a recursive mutex is
* created using xSemaphoreCreateRecursiveMutex() then the required memory is
* automatically dynamically allocated inside the
@@ -843,7 +849,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* SemaphoreHandle_t.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore;
*
* void vATask( void * pvParameters )
@@ -858,7 +864,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // The semaphore can now be used.
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreCreateRecursiveMutex xSemaphoreCreateRecursiveMutex
* \ingroup Semaphores
*/
@@ -868,14 +874,14 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateRecursiveMutexStatic( StaticSemaphore_t *pxMutexBuffer );
* </pre>
* @endcode
*
* Creates a new recursive mutex type semaphore instance, and returns a handle
* by which the new recursive mutex can be referenced.
*
* Internally, within the FreeRTOS implementation, recursive mutexs use a block
* Internally, within the FreeRTOS implementation, recursive mutexes use a block
* of memory, in which the mutex structure is stored. If a recursive mutex is
* created using xSemaphoreCreateRecursiveMutex() then the required memory is
* automatically dynamically allocated inside the
@@ -917,7 +923,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* returned.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore;
* StaticSemaphore_t xMutexBuffer;
*
@@ -933,19 +939,19 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // As no dynamic memory allocation was performed, xSemaphore cannot be NULL,
* // so there is no need to check it.
* }
* </pre>
* @endcode
* \defgroup xSemaphoreCreateRecursiveMutexStatic xSemaphoreCreateRecursiveMutexStatic
* \ingroup Semaphores
*/
#if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configUSE_RECURSIVE_MUTEXES == 1 ) )
#define xSemaphoreCreateRecursiveMutexStatic( pxStaticSemaphore ) xQueueCreateMutexStatic( queueQUEUE_TYPE_RECURSIVE_MUTEX, pxStaticSemaphore )
#define xSemaphoreCreateRecursiveMutexStatic( pxStaticSemaphore ) xQueueCreateMutexStatic( queueQUEUE_TYPE_RECURSIVE_MUTEX, ( pxStaticSemaphore ) )
#endif /* configSUPPORT_STATIC_ALLOCATION */
/**
* semphr. h
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateCounting( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount );
* </pre>
* @endcode
*
* Creates a new counting semaphore instance, and returns a handle by which the
* new counting semaphore can be referenced.
@@ -997,7 +1003,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* created.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore;
*
* void vATask( void * pvParameters )
@@ -1015,7 +1021,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // The semaphore can now be used.
* }
* }
* </pre>
* @endcode
* \defgroup xSemaphoreCreateCounting xSemaphoreCreateCounting
* \ingroup Semaphores
*/
@@ -1025,9 +1031,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphoreCreateCountingStatic( UBaseType_t uxMaxCount, UBaseType_t uxInitialCount, StaticSemaphore_t *pxSemaphoreBuffer );
* </pre>
* @endcode
*
* Creates a new counting semaphore instance, and returns a handle by which the
* new counting semaphore can be referenced.
@@ -1083,7 +1089,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* then NULL is returned.
*
* Example usage:
* <pre>
* @code{c}
* SemaphoreHandle_t xSemaphore;
* StaticSemaphore_t xSemaphoreBuffer;
*
@@ -1102,7 +1108,7 @@ typedef QueueHandle_t SemaphoreHandle_t;
* // No memory allocation was attempted so xSemaphore cannot be NULL, so there
* // is no need to check its value.
* }
* </pre>
* @endcode
* \defgroup xSemaphoreCreateCountingStatic xSemaphoreCreateCountingStatic
* \ingroup Semaphores
*/
@@ -1112,9 +1118,9 @@ typedef QueueHandle_t SemaphoreHandle_t;
/**
* semphr. h
* <pre>
* @code{c}
* void vSemaphoreDelete( SemaphoreHandle_t xSemaphore );
* </pre>
* @endcode
*
* Delete a semaphore. This function must be used with care. For example,
* do not delete a mutex type semaphore if the mutex is held by a task.
@@ -1124,13 +1130,13 @@ typedef QueueHandle_t SemaphoreHandle_t;
* \defgroup vSemaphoreDelete vSemaphoreDelete
* \ingroup Semaphores
*/
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
#define vSemaphoreDelete( xSemaphore ) vQueueDelete( ( QueueHandle_t ) ( xSemaphore ) )
/**
* semphr.h
* <pre>
* @code{c}
* TaskHandle_t xSemaphoreGetMutexHolder( SemaphoreHandle_t xMutex );
* </pre>
* @endcode
*
* If xMutex is indeed a mutex type semaphore, return the current mutex holder.
* If xMutex is not a mutex type semaphore, or the mutex is available (not held
@@ -1141,26 +1147,30 @@ typedef QueueHandle_t SemaphoreHandle_t;
* the holder may change between the function exiting and the returned value
* being tested.
*/
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
#define xSemaphoreGetMutexHolder( xSemaphore ) xQueueGetMutexHolder( ( xSemaphore ) )
#endif
/**
* semphr.h
* <pre>
* @code{c}
* TaskHandle_t xSemaphoreGetMutexHolderFromISR( SemaphoreHandle_t xMutex );
* </pre>
* @endcode
*
* If xMutex is indeed a mutex type semaphore, return the current mutex holder.
* If xMutex is not a mutex type semaphore, or the mutex is available (not held
* by a task), return NULL.
*
*/
#define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) )
#if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
#define xSemaphoreGetMutexHolderFromISR( xSemaphore ) xQueueGetMutexHolderFromISR( ( xSemaphore ) )
#endif
/**
* semphr.h
* <pre>
* @code{c}
* UBaseType_t uxSemaphoreGetCount( SemaphoreHandle_t xSemaphore );
* </pre>
* @endcode
*
* If the semaphore is a counting semaphore then uxSemaphoreGetCount() returns
* its current count value. If the semaphore is a binary semaphore then
@@ -1168,12 +1178,27 @@ typedef QueueHandle_t SemaphoreHandle_t;
* semaphore is not available.
*
*/
#define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) )
#define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) )
/**
* semphr.h
* @code{c}
* BaseType_t xSemaphoreGetStaticBuffer( SemaphoreHandle_t xSemaphore );
* UBaseType_t uxSemaphoreGetCountFromISR( SemaphoreHandle_t xSemaphore );
* @endcode
*
* If the semaphore is a counting semaphore then uxSemaphoreGetCountFromISR() returns
* its current count value. If the semaphore is a binary semaphore then
* uxSemaphoreGetCountFromISR() returns 1 if the semaphore is available, and 0 if the
* semaphore is not available.
*
*/
#define uxSemaphoreGetCountFromISR( xSemaphore ) uxQueueMessagesWaitingFromISR( ( QueueHandle_t ) ( xSemaphore ) )
/**
* semphr.h
* @code{c}
* BaseType_t xSemaphoreGetStaticBuffer( SemaphoreHandle_t xSemaphore,
* StaticSemaphore_t ** ppxSemaphoreBuffer );
* @endcode
*
* Retrieve pointer to a statically created binary semaphore, counting semaphore,