diff --git a/components/freertos/FreeRTOS-Kernel-SMP/event_groups.c b/components/freertos/FreeRTOS-Kernel-SMP/event_groups.c index ae8e20be7d..3e72547c49 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/event_groups.c +++ b/components/freertos/FreeRTOS-Kernel-SMP/event_groups.c @@ -665,6 +665,42 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) } /*-----------------------------------------------------------*/ +#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) + BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup, + StaticEventGroup_t ** ppxEventGroupBuffer ) + { + BaseType_t xReturn; + EventGroup_t * pxEventBits = xEventGroup; + + configASSERT( pxEventBits ); + configASSERT( ppxEventGroupBuffer ); + + #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) + { + /* Check if the event group was statically allocated. */ + if( pxEventBits->ucStaticallyAllocated == ( uint8_t ) pdTRUE ) + { + *ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits; + xReturn = pdTRUE; + } + else + { + xReturn = pdFALSE; + } + } + #else /* configSUPPORT_DYNAMIC_ALLOCATION */ + { + /* Event group must have been statically allocated. */ + *ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits; + xReturn = pdTRUE; + } + #endif /* configSUPPORT_DYNAMIC_ALLOCATION */ + + return xReturn; + } +#endif /* configSUPPORT_STATIC_ALLOCATION */ +/*-----------------------------------------------------------*/ + /* For internal use only - execute a 'set bits' command that was pended from * an interrupt. */ portTIMER_CALLBACK_ATTRIBUTE diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/event_groups.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/event_groups.h index 3a80d78564..48108a3da3 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/event_groups.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/event_groups.h @@ -753,6 +753,28 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEG */ void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION; +/** + * event_groups.h + * @code{c} + * BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup, + * StaticEventGroup_t ** ppxEventGroupBuffer ); + * @endcode + * + * Retrieve a pointer to a statically created event groups's data structure + * buffer. It is the same buffer that is supplied at the time of creation. + * + * @param xEventGroup The event group for which to retrieve the buffer. + * + * @param ppxEventGroupBuffer Used to return a pointer to the event groups's + * data structure buffer. + * + * @return pdTRUE if the buffer was retrieved, pdFALSE otherwise. + */ +#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) + BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup, + StaticEventGroup_t ** ppxEventGroupBuffer ) PRIVILEGED_FUNCTION; +#endif /* configSUPPORT_STATIC_ALLOCATION */ + /* For internal use only. */ void vEventGroupSetBitsCallback( void * pvEventGroup, const uint32_t ulBitsToSet ) PRIVILEGED_FUNCTION; diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/message_buffer.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/message_buffer.h index be16eb1f30..aa05f233cb 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/message_buffer.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/message_buffer.h @@ -210,6 +210,37 @@ typedef void * MessageBufferHandle_t; #define xMessageBufferCreateStatic( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer ) \ ( MessageBufferHandle_t ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer ) +/** + * message_buffer.h + * + * @code{c} + * BaseType_t xMessageBufferGetStaticBuffers( MessageBufferHandle_t xMessageBuffer, + * uint8_t ** ppucMessageBufferStorageArea, + * StaticMessageBuffer_t ** ppxStaticMessageBuffer ); + * @endcode + * + * Retrieve pointers to a statically created message buffer's data structure + * buffer and storage area buffer. These are the same buffers that are supplied + * at the time of creation. + * + * @param xMessageBuffer The message buffer for which to retrieve the buffers. + * + * @param ppucMessageBufferStorageArea Used to return a pointer to the + * message buffer's storage area buffer. + * + * @param ppxStaticMessageBuffer Used to return a pointer to the message + * buffer's data structure buffer. + * + * @return pdTRUE if buffers were retrieved, pdFALSE otherwise.. + * + * \defgroup xMessageBufferGetStaticBuffers xMessageBufferGetStaticBuffers + * \ingroup MessageBufferManagement + */ +#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) + #define xMessageBufferGetStaticBuffers( xMessageBuffer, ppucMessageBufferStorageArea, ppxStaticMessageBuffer ) \ + xStreamBufferGetStaticBuffers( ( xMessageBuffer ), ( ppucMessageBufferStorageArea ), ( ppxStaticMessageBuffer ) ) +#endif /* configSUPPORT_STATIC_ALLOCATION */ + /** * message_buffer.h * diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/queue.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/queue.h index 1f8b3a75e8..446f73493f 100644 --- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/queue.h +++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/queue.h @@ -233,6 +233,35 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t; #define xQueueCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxQueueBuffer ) xQueueGenericCreateStatic( ( uxQueueLength ), ( uxItemSize ), ( pucQueueStorage ), ( pxQueueBuffer ), ( queueQUEUE_TYPE_BASE ) ) #endif /* configSUPPORT_STATIC_ALLOCATION */ +/** + * queue. h + * @code{c} + * BaseType_t xQueueGetStaticBuffers( QueueHandle_t xQueue, + * uint8_t ** ppucQueueStorage, + * StaticQueue_t ** ppxStaticQueue ); + * @endcode + * + * Retrieve pointers to a statically created queue's data structure buffer + * and storage area buffer. These are the same buffers that are supplied + * at the time of creation. + * + * @param xQueue The queue for which to retrieve the buffers. + * + * @param ppucQueueStorage Used to return a pointer to the queue's storage + * area buffer. + * + * @param ppxStaticQueue Used to return a pointer to the queue's data + * structure buffer. + * + * @return pdTRUE if buffers were retrieved, pdFALSE otherwise. + * + * \defgroup xQueueGetStaticBuffers xQueueGetStaticBuffers + * \ingroup QueueManagement + */ +#if ( configSUPPORT_STATIC_ALLOCATION == 1 ) + #define xQueueGetStaticBuffers( xQueue, ppucQueueStorage, ppxStaticQueue ) xQueueGenericGetStaticBuffers( ( xQueue ), ( ppucQueueStorage ), ( ppxStaticQueue ) ) +#endif /* configSUPPORT_STATIC_ALLOCATION */ + /** * queue. h *
@@ -1558,6 +1587,18 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
#endif
+/*
+ * Generic version of the function used to retrieve the buffers of statically
+ * created queues. This is called by other functions and macros that retrieve
+ * the buffers of other statically created RTOS objects that use the queue
+ * structure as their base.
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
+ uint8_t ** ppucQueueStorage,
+ StaticQueue_t ** ppxStaticQueue ) PRIVILEGED_FUNCTION;
+#endif
+
/*
* Queue sets provide a mechanism to allow a task to block (pend) on a read
* operation from multiple queues or semaphores simultaneously.
diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/semphr.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/semphr.h
index fd9469d9c9..d72bf45b1b 100644
--- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/semphr.h
+++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/semphr.h
@@ -1170,4 +1170,25 @@ typedef QueueHandle_t SemaphoreHandle_t;
*/
#define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) )
+/**
+ * semphr.h
+ * @code{c}
+ * BaseType_t xSemaphoreGetStaticBuffer( SemaphoreHandle_t xSemaphore );
+ * @endcode
+ *
+ * Retrieve pointer to a statically created binary semaphore, counting semaphore,
+ * or mutex semaphore's data structure buffer. This is the same buffer that is
+ * supplied at the time of creation.
+ *
+ * @param xSemaphore The semaphore for which to retrieve the buffer.
+ *
+ * @param ppxSemaphoreBuffer Used to return a pointer to the semaphore's
+ * data structure buffer.
+ *
+ * @return pdTRUE if buffer was retrieved, pdFALSE otherwise.
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ #define xSemaphoreGetStaticBuffer( xSemaphore, ppxSemaphoreBuffer ) xQueueGenericGetStaticBuffers( ( QueueHandle_t ) ( xSemaphore ), NULL, ( ppxSemaphoreBuffer ) )
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
#endif /* SEMAPHORE_H */
diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/stream_buffer.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/stream_buffer.h
index c5eac02b02..00f9d0585e 100644
--- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/stream_buffer.h
+++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/stream_buffer.h
@@ -219,6 +219,38 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t;
#define xStreamBufferCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer ) \
xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, pucStreamBufferStorageArea, pxStaticStreamBuffer )
+/**
+ * stream_buffer.h
+ *
+ * @code{c}
+ * BaseType_t xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
+ * uint8_t ** ppucStreamBufferStorageArea,
+ * StaticStreamBuffer_t ** ppxStaticStreamBuffer );
+ * @endcode
+ *
+ * Retrieve pointers to a statically created stream buffer's data structure
+ * buffer and storage area buffer. These are the same buffers that are supplied
+ * at the time of creation.
+ *
+ * @param xStreamBuffer The stream buffer for which to retrieve the buffers.
+ *
+ * @param ppucStreamBufferStorageArea Used to return a pointer to the stream
+ * buffer's storage area buffer.
+ *
+ * @param ppxStaticStreamBuffer Used to return a pointer to the stream
+ * buffer's data structure buffer.
+ *
+ * @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
+ *
+ * \defgroup xStreamBufferGetStaticBuffers xStreamBufferGetStaticBuffers
+ * \ingroup StreamBufferManagement
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
+ uint8_t ** ppucStreamBufferStorageArea,
+ StaticStreamBuffer_t ** ppxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
/**
* stream_buffer.h
*
diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h
index 0a91ae8b98..93f6079d08 100644
--- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h
+++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/task.h
@@ -1704,6 +1704,36 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lin
*/
TaskHandle_t xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
+/**
+ * task. h
+ * @code{c}
+ * BaseType_t xTaskGetStaticBuffers( TaskHandle_t xTask,
+ * StackType_t ** ppuxStackBuffer,
+ * StaticTask_t ** ppxTaskBuffer );
+ * @endcode
+ *
+ * Retrieve pointers to a statically created task's data structure
+ * buffer and stack buffer. These are the same buffers that are supplied
+ * at the time of creation.
+ *
+ * @param xTask The task for which to retrieve the buffers.
+ *
+ * @param ppuxStackBuffer Used to return a pointer to the task's stack buffer.
+ *
+ * @param ppxTaskBuffer Used to return a pointer to the task's data structure
+ * buffer.
+ *
+ * @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
+ *
+ * \defgroup xTaskGetStaticBuffers xTaskGetStaticBuffers
+ * \ingroup TaskUtils
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xTaskGetStaticBuffers( TaskHandle_t xTask,
+ StackType_t ** ppuxStackBuffer,
+ StaticTask_t ** ppxTaskBuffer ) PRIVILEGED_FUNCTION;
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
/**
* task.h
* UBaseType_t uxTaskGetStackHighWaterMark( TaskHandle_t xTask );
diff --git a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/timers.h b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/timers.h
index 13492897af..5604cdd91e 100644
--- a/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/timers.h
+++ b/components/freertos/FreeRTOS-Kernel-SMP/include/freertos/timers.h
@@ -1307,6 +1307,25 @@ TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
*/
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
+/**
+ * BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
+ * StaticTimer_t ** ppxTimerBuffer );
+ *
+ * Retrieve pointer to a statically created timer's data structure
+ * buffer. This is the same buffer that is supplied at the time of
+ * creation.
+ *
+ * @param xTimer The timer for which to retrieve the buffer.
+ *
+ * @param ppxTimerBuffer Used to return a pointer to the timers's data
+ * structure buffer.
+ *
+ * @return pdTRUE if the buffer was retrieved, pdFALSE otherwise.
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
+ StaticTimer_t ** ppxTimerBuffer ) PRIVILEGED_FUNCTION;
+#endif /* configSUPPORT_STATIC_ALLOCATION */
/*
* Functions beyond this part are not part of the public API and are intended
* for use by the kernel only.
diff --git a/components/freertos/FreeRTOS-Kernel-SMP/queue.c b/components/freertos/FreeRTOS-Kernel-SMP/queue.c
index 56869290b8..51895e5a23 100644
--- a/components/freertos/FreeRTOS-Kernel-SMP/queue.c
+++ b/components/freertos/FreeRTOS-Kernel-SMP/queue.c
@@ -379,6 +379,55 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
#endif /* configSUPPORT_STATIC_ALLOCATION */
/*-----------------------------------------------------------*/
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+
+ BaseType_t xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
+ uint8_t ** ppucQueueStorage,
+ StaticQueue_t ** ppxStaticQueue )
+ {
+ BaseType_t xReturn;
+ Queue_t * const pxQueue = xQueue;
+
+ configASSERT( pxQueue );
+ configASSERT( ppxStaticQueue );
+
+ #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
+ {
+ /* Check if the queue was statically allocated. */
+ if( pxQueue->ucStaticallyAllocated == ( uint8_t ) pdTRUE )
+ {
+ if( ppucQueueStorage != NULL )
+ {
+ *ppucQueueStorage = ( uint8_t * ) pxQueue->pcHead;
+ }
+
+ *ppxStaticQueue = ( StaticQueue_t * ) pxQueue;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+ }
+ #else /* configSUPPORT_DYNAMIC_ALLOCATION */
+ {
+ /* Queue must have been statically allocated. */
+ if( ppucQueueStorage != NULL )
+ {
+ *ppucQueueStorage = ( uint8_t * ) pxQueue->pcHead;
+ }
+
+ *ppxStaticQueue = ( StaticQueue_t * ) pxQueue;
+ xReturn = pdTRUE;
+ }
+ #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
+
+ return xReturn;
+ }
+
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength,
diff --git a/components/freertos/FreeRTOS-Kernel-SMP/stream_buffer.c b/components/freertos/FreeRTOS-Kernel-SMP/stream_buffer.c
index 47c8a9a652..0208032186 100644
--- a/components/freertos/FreeRTOS-Kernel-SMP/stream_buffer.c
+++ b/components/freertos/FreeRTOS-Kernel-SMP/stream_buffer.c
@@ -367,6 +367,34 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
#endif /* ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*-----------------------------------------------------------*/
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
+ uint8_t ** ppucStreamBufferStorageArea,
+ StaticStreamBuffer_t ** ppxStaticStreamBuffer )
+ {
+ BaseType_t xReturn;
+ const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
+
+ configASSERT( pxStreamBuffer );
+ configASSERT( ppucStreamBufferStorageArea );
+ configASSERT( ppxStaticStreamBuffer );
+
+ if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_STATICALLY_ALLOCATED ) != ( uint8_t ) 0 )
+ {
+ *ppucStreamBufferStorageArea = pxStreamBuffer->pucBuffer;
+ *ppxStaticStreamBuffer = ( StaticStreamBuffer_t * ) pxStreamBuffer;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+
+ return xReturn;
+ }
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer )
{
StreamBuffer_t * pxStreamBuffer = xStreamBuffer;
diff --git a/components/freertos/FreeRTOS-Kernel-SMP/tasks.c b/components/freertos/FreeRTOS-Kernel-SMP/tasks.c
index ff3d3d9030..8ebecd7102 100644
--- a/components/freertos/FreeRTOS-Kernel-SMP/tasks.c
+++ b/components/freertos/FreeRTOS-Kernel-SMP/tasks.c
@@ -3359,6 +3359,53 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
#endif /* INCLUDE_xTaskGetHandle */
/*-----------------------------------------------------------*/
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+
+ BaseType_t xTaskGetStaticBuffers( TaskHandle_t xTask,
+ StackType_t ** ppuxStackBuffer,
+ StaticTask_t ** ppxTaskBuffer )
+ {
+ BaseType_t xReturn;
+ TCB_t * pxTCB;
+
+ configASSERT( ppuxStackBuffer != NULL );
+ configASSERT( ppxTaskBuffer != NULL );
+
+ pxTCB = prvGetTCBFromHandle( xTask );
+
+ #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 )
+ {
+ if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB )
+ {
+ *ppuxStackBuffer = pxTCB->pxStack;
+ *ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
+ xReturn = pdTRUE;
+ }
+ else if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_ONLY )
+ {
+ *ppuxStackBuffer = pxTCB->pxStack;
+ *ppxTaskBuffer = NULL;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+ }
+ #else /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
+ {
+ *ppuxStackBuffer = pxTCB->pxStack;
+ *ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
+ xReturn = pdTRUE;
+ }
+ #endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
+
+ return xReturn;
+ }
+
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray,
diff --git a/components/freertos/FreeRTOS-Kernel-SMP/timers.c b/components/freertos/FreeRTOS-Kernel-SMP/timers.c
index 65455cc8da..b98e9b9ec9 100644
--- a/components/freertos/FreeRTOS-Kernel-SMP/timers.c
+++ b/components/freertos/FreeRTOS-Kernel-SMP/timers.c
@@ -534,6 +534,30 @@
}
/*-----------------------------------------------------------*/
+ #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
+ StaticTimer_t ** ppxTimerBuffer )
+ {
+ BaseType_t xReturn;
+ Timer_t * pxTimer = xTimer;
+
+ configASSERT( ppxTimerBuffer != NULL );
+
+ if( ( pxTimer->ucStatus & tmrSTATUS_IS_STATICALLY_ALLOCATED ) != 0 )
+ {
+ *ppxTimerBuffer = ( StaticTimer_t * ) pxTimer;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+
+ return xReturn;
+ }
+ #endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
const char * pcTimerGetName( TimerHandle_t xTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
{
Timer_t * pxTimer = xTimer;
diff --git a/components/freertos/FreeRTOS-Kernel/event_groups.c b/components/freertos/FreeRTOS-Kernel/event_groups.c
index ffdf23db5c..8b1b184b17 100644
--- a/components/freertos/FreeRTOS-Kernel/event_groups.c
+++ b/components/freertos/FreeRTOS-Kernel/event_groups.c
@@ -702,6 +702,42 @@ void vEventGroupDelete( EventGroupHandle_t xEventGroup )
}
/*-----------------------------------------------------------*/
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
+ StaticEventGroup_t ** ppxEventGroupBuffer )
+ {
+ BaseType_t xReturn;
+ EventGroup_t * pxEventBits = xEventGroup;
+
+ configASSERT( pxEventBits );
+ configASSERT( ppxEventGroupBuffer );
+
+ #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
+ {
+ /* Check if the event group was statically allocated. */
+ if( pxEventBits->ucStaticallyAllocated == ( uint8_t ) pdTRUE )
+ {
+ *ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+ }
+ #else /* configSUPPORT_DYNAMIC_ALLOCATION */
+ {
+ /* Event group must have been statically allocated. */
+ *ppxEventGroupBuffer = ( StaticEventGroup_t * ) pxEventBits;
+ xReturn = pdTRUE;
+ }
+ #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
+
+ return xReturn;
+ }
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
/* For internal use only - execute a 'set bits' command that was pended from
* an interrupt. */
void vEventGroupSetBitsCallback( void * pvEventGroup,
diff --git a/components/freertos/FreeRTOS-Kernel/include/freertos/event_groups.h b/components/freertos/FreeRTOS-Kernel/include/freertos/event_groups.h
index d84dcaf92b..8a26ccf9fe 100644
--- a/components/freertos/FreeRTOS-Kernel/include/freertos/event_groups.h
+++ b/components/freertos/FreeRTOS-Kernel/include/freertos/event_groups.h
@@ -807,6 +807,30 @@ EventBits_t xEventGroupGetBitsFromISR( EventGroupHandle_t xEventGroup ) PRIVILEG
*/
void vEventGroupDelete( EventGroupHandle_t xEventGroup ) PRIVILEGED_FUNCTION;
+/**
+ * @cond !DOC_EXCLUDE_HEADER_SECTION
+ * event_groups.h
+ * @code{c}
+ * BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
+ * StaticEventGroup_t ** ppxEventGroupBuffer );
+ * @endcode
+ * @endcond
+ *
+ * Retrieve a pointer to a statically created event groups's data structure
+ * buffer. It is the same buffer that is supplied at the time of creation.
+ *
+ * @param xEventGroup The event group for which to retrieve the buffer.
+ *
+ * @param ppxEventGroupBuffer Used to return a pointer to the event groups's
+ * data structure buffer.
+ *
+ * @return pdTRUE if the buffer was retrieved, pdFALSE otherwise.
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xEventGroupGetStaticBuffer( EventGroupHandle_t xEventGroup,
+ StaticEventGroup_t ** ppxEventGroupBuffer ) PRIVILEGED_FUNCTION;
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
/** @cond !DOC_EXCLUDE_HEADER_SECTION */
/* For internal use only. */
diff --git a/components/freertos/FreeRTOS-Kernel/include/freertos/message_buffer.h b/components/freertos/FreeRTOS-Kernel/include/freertos/message_buffer.h
index 36efe9dc37..701a5d4ae9 100644
--- a/components/freertos/FreeRTOS-Kernel/include/freertos/message_buffer.h
+++ b/components/freertos/FreeRTOS-Kernel/include/freertos/message_buffer.h
@@ -226,6 +226,39 @@ typedef void * MessageBufferHandle_t;
#define xMessageBufferCreateStatic( xBufferSizeBytes, pucMessageBufferStorageArea, pxStaticMessageBuffer ) \
( MessageBufferHandle_t ) xStreamBufferGenericCreateStatic( xBufferSizeBytes, 0, pdTRUE, pucMessageBufferStorageArea, pxStaticMessageBuffer )
+/**
+ * @cond !DOC_EXCLUDE_HEADER_SECTION
+ * message_buffer.h
+ *
+ * @code{c}
+ * BaseType_t xMessageBufferGetStaticBuffers( MessageBufferHandle_t xMessageBuffer,
+ * uint8_t ** ppucMessageBufferStorageArea,
+ * StaticMessageBuffer_t ** ppxStaticMessageBuffer );
+ * @endcode
+ * @endcond
+ *
+ * Retrieve pointers to a statically created message buffer's data structure
+ * buffer and storage area buffer. These are the same buffers that are supplied
+ * at the time of creation.
+ *
+ * @param xMessageBuffer The message buffer for which to retrieve the buffers.
+ *
+ * @param ppucMessageBufferStorageArea Used to return a pointer to the
+ * message buffer's storage area buffer.
+ *
+ * @param ppxStaticMessageBuffer Used to return a pointer to the message
+ * buffer's data structure buffer.
+ *
+ * @return pdTRUE if buffers were retrieved, pdFALSE otherwise..
+ *
+ * \defgroup xMessageBufferGetStaticBuffers xMessageBufferGetStaticBuffers
+ * \ingroup MessageBufferManagement
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ #define xMessageBufferGetStaticBuffers( xMessageBuffer, ppucMessageBufferStorageArea, ppxStaticMessageBuffer ) \
+ xStreamBufferGetStaticBuffers( ( xMessageBuffer ), ( ppucMessageBufferStorageArea ), ( ppxStaticMessageBuffer ) )
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* message_buffer.h
diff --git a/components/freertos/FreeRTOS-Kernel/include/freertos/queue.h b/components/freertos/FreeRTOS-Kernel/include/freertos/queue.h
index a5200d7312..c16faf1046 100644
--- a/components/freertos/FreeRTOS-Kernel/include/freertos/queue.h
+++ b/components/freertos/FreeRTOS-Kernel/include/freertos/queue.h
@@ -252,6 +252,37 @@ typedef struct QueueDefinition * QueueSetMemberHandle_t;
#define xQueueCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxQueueBuffer ) xQueueGenericCreateStatic( ( uxQueueLength ), ( uxItemSize ), ( pucQueueStorage ), ( pxQueueBuffer ), ( queueQUEUE_TYPE_BASE ) )
#endif /* configSUPPORT_STATIC_ALLOCATION */
+/**
+ * @cond !DOC_EXCLUDE_HEADER_SECTION
+ * queue. h
+ * @code{c}
+ * BaseType_t xQueueGetStaticBuffers( QueueHandle_t xQueue,
+ * uint8_t ** ppucQueueStorage,
+ * StaticQueue_t ** ppxStaticQueue );
+ * @endcode
+ * @endcond
+ *
+ * Retrieve pointers to a statically created queue's data structure buffer
+ * and storage area buffer. These are the same buffers that are supplied
+ * at the time of creation.
+ *
+ * @param xQueue The queue for which to retrieve the buffers.
+ *
+ * @param ppucQueueStorage Used to return a pointer to the queue's storage
+ * area buffer.
+ *
+ * @param ppxStaticQueue Used to return a pointer to the queue's data
+ * structure buffer.
+ *
+ * @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
+ *
+ * \defgroup xQueueGetStaticBuffers xQueueGetStaticBuffers
+ * \ingroup QueueManagement
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ #define xQueueGetStaticBuffers( xQueue, ppucQueueStorage, ppxStaticQueue ) xQueueGenericGetStaticBuffers( ( xQueue ), ( ppucQueueStorage ), ( ppxStaticQueue ) )
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* queue. h
@@ -1649,6 +1680,18 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;
const uint8_t ucQueueType ) PRIVILEGED_FUNCTION;
#endif
+/*
+ * Generic version of the function used to retrieve the buffers of statically
+ * created queues. This is called by other functions and macros that retrieve
+ * the buffers of other statically created RTOS objects that use the queue
+ * structure as their base.
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
+ uint8_t ** ppucQueueStorage,
+ StaticQueue_t ** ppxStaticQueue ) PRIVILEGED_FUNCTION;
+#endif
+
/**
* Queue sets provide a mechanism to allow a task to block (pend) on a read
* operation from multiple queues or semaphores simultaneously.
diff --git a/components/freertos/FreeRTOS-Kernel/include/freertos/semphr.h b/components/freertos/FreeRTOS-Kernel/include/freertos/semphr.h
index 41d724a12c..47d8ae13c5 100644
--- a/components/freertos/FreeRTOS-Kernel/include/freertos/semphr.h
+++ b/components/freertos/FreeRTOS-Kernel/include/freertos/semphr.h
@@ -1244,4 +1244,27 @@ typedef QueueHandle_t SemaphoreHandle_t;
*/
#define uxSemaphoreGetCount( xSemaphore ) uxQueueMessagesWaiting( ( QueueHandle_t ) ( xSemaphore ) )
+/**
+ * @cond !DOC_EXCLUDE_HEADER_SECTION
+ * semphr.h
+ * @code{c}
+ * BaseType_t xSemaphoreGetStaticBuffer( SemaphoreHandle_t xSemaphore );
+ * @endcode
+ * @endcond
+ *
+ * Retrieve pointer to a statically created binary semaphore, counting semaphore,
+ * or mutex semaphore's data structure buffer. This is the same buffer that is
+ * supplied at the time of creation.
+ *
+ * @param xSemaphore The semaphore for which to retrieve the buffer.
+ *
+ * @param ppxSemaphoreBuffer Used to return a pointer to the semaphore's
+ * data structure buffer.
+ *
+ * @return pdTRUE if buffer was retrieved, pdFALSE otherwise.
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ #define xSemaphoreGetStaticBuffer( xSemaphore, ppxSemaphoreBuffer ) xQueueGenericGetStaticBuffers( ( QueueHandle_t ) ( xSemaphore ), NULL, ( ppxSemaphoreBuffer ) )
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
#endif /* SEMAPHORE_H */
diff --git a/components/freertos/FreeRTOS-Kernel/include/freertos/stream_buffer.h b/components/freertos/FreeRTOS-Kernel/include/freertos/stream_buffer.h
index 3bbecb223c..6a11fbfe79 100644
--- a/components/freertos/FreeRTOS-Kernel/include/freertos/stream_buffer.h
+++ b/components/freertos/FreeRTOS-Kernel/include/freertos/stream_buffer.h
@@ -236,6 +236,40 @@ typedef struct StreamBufferDef_t * StreamBufferHandle_t;
#define xStreamBufferCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pucStreamBufferStorageArea, pxStaticStreamBuffer ) \
xStreamBufferGenericCreateStatic( xBufferSizeBytes, xTriggerLevelBytes, pdFALSE, pucStreamBufferStorageArea, pxStaticStreamBuffer )
+/**
+ * @cond !DOC_EXCLUDE_HEADER_SECTION
+ * stream_buffer.h
+ *
+ * @code{c}
+ * BaseType_t xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
+ * uint8_t ** ppucStreamBufferStorageArea,
+ * StaticStreamBuffer_t ** ppxStaticStreamBuffer );
+ * @endcode
+ * @endcond
+ *
+ * Retrieve pointers to a statically created stream buffer's data structure
+ * buffer and storage area buffer. These are the same buffers that are supplied
+ * at the time of creation.
+ *
+ * @param xStreamBuffer The stream buffer for which to retrieve the buffers.
+ *
+ * @param ppucStreamBufferStorageArea Used to return a pointer to the stream
+ * buffer's storage area buffer.
+ *
+ * @param ppxStaticStreamBuffer Used to return a pointer to the stream
+ * buffer's data structure buffer.
+ *
+ * @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
+ *
+ * \defgroup xStreamBufferGetStaticBuffers xStreamBufferGetStaticBuffers
+ * \ingroup StreamBufferManagement
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
+ uint8_t ** ppucStreamBufferStorageArea,
+ StaticStreamBuffer_t ** ppxStaticStreamBuffer ) PRIVILEGED_FUNCTION;
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* stream_buffer.h
diff --git a/components/freertos/FreeRTOS-Kernel/include/freertos/task.h b/components/freertos/FreeRTOS-Kernel/include/freertos/task.h
index 43c5fa310e..2c016eb596 100644
--- a/components/freertos/FreeRTOS-Kernel/include/freertos/task.h
+++ b/components/freertos/FreeRTOS-Kernel/include/freertos/task.h
@@ -1852,6 +1852,38 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) PRIVILEGED_FUNCTION; /*lin
*/
TaskHandle_t xTaskGetHandle( const char * pcNameToQuery ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
+/**
+ * @cond !DOC_EXCLUDE_HEADER_SECTION
+ * task. h
+ * @code{c}
+ * BaseType_t xTaskGetStaticBuffers( TaskHandle_t xTask,
+ * StackType_t ** ppuxStackBuffer,
+ * StaticTask_t ** ppxTaskBuffer );
+ * @endcode
+ * @endcond
+ *
+ * Retrieve pointers to a statically created task's data structure
+ * buffer and stack buffer. These are the same buffers that are supplied
+ * at the time of creation.
+ *
+ * @param xTask The task for which to retrieve the buffers.
+ *
+ * @param ppuxStackBuffer Used to return a pointer to the task's stack buffer.
+ *
+ * @param ppxTaskBuffer Used to return a pointer to the task's data structure
+ * buffer.
+ *
+ * @return pdTRUE if buffers were retrieved, pdFALSE otherwise.
+ *
+ * \defgroup xTaskGetStaticBuffers xTaskGetStaticBuffers
+ * \ingroup TaskUtils
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xTaskGetStaticBuffers( TaskHandle_t xTask,
+ StackType_t ** ppuxStackBuffer,
+ StaticTask_t ** ppxTaskBuffer ) PRIVILEGED_FUNCTION;
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
/**
* @cond !DOC_EXCLUDE_HEADER_SECTION
* task.h
diff --git a/components/freertos/FreeRTOS-Kernel/include/freertos/timers.h b/components/freertos/FreeRTOS-Kernel/include/freertos/timers.h
index fed9b380b1..00c9f5179b 100644
--- a/components/freertos/FreeRTOS-Kernel/include/freertos/timers.h
+++ b/components/freertos/FreeRTOS-Kernel/include/freertos/timers.h
@@ -1314,6 +1314,26 @@ TickType_t xTimerGetPeriod( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
*/
TickType_t xTimerGetExpiryTime( TimerHandle_t xTimer ) PRIVILEGED_FUNCTION;
+/**
+ * BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
+ * StaticTimer_t ** ppxTimerBuffer );
+ *
+ * Retrieve pointer to a statically created timer's data structure
+ * buffer. This is the same buffer that is supplied at the time of
+ * creation.
+ *
+ * @param xTimer The timer for which to retrieve the buffer.
+ *
+ * @param ppxTimerBuffer Used to return a pointer to the timers's data
+ * structure buffer.
+ *
+ * @return pdTRUE if the buffer was retrieved, pdFALSE otherwise.
+ */
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
+ StaticTimer_t ** ppxTimerBuffer ) PRIVILEGED_FUNCTION;
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+
/** @cond !DOC_EXCLUDE_HEADER_SECTION */
/*
diff --git a/components/freertos/FreeRTOS-Kernel/queue.c b/components/freertos/FreeRTOS-Kernel/queue.c
index 2c3c76f20f..69da28f732 100644
--- a/components/freertos/FreeRTOS-Kernel/queue.c
+++ b/components/freertos/FreeRTOS-Kernel/queue.c
@@ -417,6 +417,55 @@ BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
#endif /* configSUPPORT_STATIC_ALLOCATION */
/*-----------------------------------------------------------*/
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+
+ BaseType_t xQueueGenericGetStaticBuffers( QueueHandle_t xQueue,
+ uint8_t ** ppucQueueStorage,
+ StaticQueue_t ** ppxStaticQueue )
+ {
+ BaseType_t xReturn;
+ Queue_t * const pxQueue = xQueue;
+
+ configASSERT( pxQueue );
+ configASSERT( ppxStaticQueue );
+
+ #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
+ {
+ /* Check if the queue was statically allocated. */
+ if( pxQueue->ucStaticallyAllocated == ( uint8_t ) pdTRUE )
+ {
+ if( ppucQueueStorage != NULL )
+ {
+ *ppucQueueStorage = ( uint8_t * ) pxQueue->pcHead;
+ }
+
+ *ppxStaticQueue = ( StaticQueue_t * ) pxQueue;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+ }
+ #else /* configSUPPORT_DYNAMIC_ALLOCATION */
+ {
+ /* Queue must have been statically allocated. */
+ if( ppucQueueStorage != NULL )
+ {
+ *ppucQueueStorage = ( uint8_t * ) pxQueue->pcHead;
+ }
+
+ *ppxStaticQueue = ( StaticQueue_t * ) pxQueue;
+ xReturn = pdTRUE;
+ }
+ #endif /* configSUPPORT_DYNAMIC_ALLOCATION */
+
+ return xReturn;
+ }
+
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
#if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength,
diff --git a/components/freertos/FreeRTOS-Kernel/stream_buffer.c b/components/freertos/FreeRTOS-Kernel/stream_buffer.c
index fa9a3ce251..d67f091cba 100644
--- a/components/freertos/FreeRTOS-Kernel/stream_buffer.c
+++ b/components/freertos/FreeRTOS-Kernel/stream_buffer.c
@@ -387,6 +387,34 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
#endif /* ( configSUPPORT_STATIC_ALLOCATION == 1 ) */
/*-----------------------------------------------------------*/
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xStreamBufferGetStaticBuffers( StreamBufferHandle_t xStreamBuffer,
+ uint8_t ** ppucStreamBufferStorageArea,
+ StaticStreamBuffer_t ** ppxStaticStreamBuffer )
+ {
+ BaseType_t xReturn;
+ const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;
+
+ configASSERT( pxStreamBuffer );
+ configASSERT( ppucStreamBufferStorageArea );
+ configASSERT( ppxStaticStreamBuffer );
+
+ if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_STATICALLY_ALLOCATED ) != ( uint8_t ) 0 )
+ {
+ *ppucStreamBufferStorageArea = pxStreamBuffer->pucBuffer;
+ *ppxStaticStreamBuffer = ( StaticStreamBuffer_t * ) pxStreamBuffer;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+
+ return xReturn;
+ }
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer )
{
StreamBuffer_t * pxStreamBuffer = xStreamBuffer;
diff --git a/components/freertos/FreeRTOS-Kernel/tasks.c b/components/freertos/FreeRTOS-Kernel/tasks.c
index 32d054dda1..5478fef96b 100644
--- a/components/freertos/FreeRTOS-Kernel/tasks.c
+++ b/components/freertos/FreeRTOS-Kernel/tasks.c
@@ -2899,6 +2899,53 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery ) /*lint !e971 Unqualified char
#endif /* INCLUDE_xTaskGetHandle */
/*-----------------------------------------------------------*/
+#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+
+ BaseType_t xTaskGetStaticBuffers( TaskHandle_t xTask,
+ StackType_t ** ppuxStackBuffer,
+ StaticTask_t ** ppxTaskBuffer )
+ {
+ BaseType_t xReturn;
+ TCB_t * pxTCB;
+
+ configASSERT( ppuxStackBuffer != NULL );
+ configASSERT( ppxTaskBuffer != NULL );
+
+ pxTCB = prvGetTCBFromHandle( xTask );
+
+ #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 )
+ {
+ if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_AND_TCB )
+ {
+ *ppuxStackBuffer = pxTCB->pxStack;
+ *ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
+ xReturn = pdTRUE;
+ }
+ else if( pxTCB->ucStaticallyAllocated == tskSTATICALLY_ALLOCATED_STACK_ONLY )
+ {
+ *ppuxStackBuffer = pxTCB->pxStack;
+ *ppxTaskBuffer = NULL;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+ }
+ #else /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
+ {
+ *ppuxStackBuffer = pxTCB->pxStack;
+ *ppxTaskBuffer = ( StaticTask_t * ) pxTCB;
+ xReturn = pdTRUE;
+ }
+ #endif /* tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE == 1 */
+
+ return xReturn;
+ }
+
+#endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
#if ( configUSE_TRACE_FACILITY == 1 )
UBaseType_t uxTaskGetSystemState( TaskStatus_t * const pxTaskStatusArray,
diff --git a/components/freertos/FreeRTOS-Kernel/timers.c b/components/freertos/FreeRTOS-Kernel/timers.c
index 448e183bb2..d68ab1e371 100644
--- a/components/freertos/FreeRTOS-Kernel/timers.c
+++ b/components/freertos/FreeRTOS-Kernel/timers.c
@@ -512,6 +512,30 @@
}
/*-----------------------------------------------------------*/
+ #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
+ BaseType_t xTimerGetStaticBuffer( TimerHandle_t xTimer,
+ StaticTimer_t ** ppxTimerBuffer )
+ {
+ BaseType_t xReturn;
+ Timer_t * pxTimer = xTimer;
+
+ configASSERT( ppxTimerBuffer != NULL );
+
+ if( ( pxTimer->ucStatus & tmrSTATUS_IS_STATICALLY_ALLOCATED ) != 0 )
+ {
+ *ppxTimerBuffer = ( StaticTimer_t * ) pxTimer;
+ xReturn = pdTRUE;
+ }
+ else
+ {
+ xReturn = pdFALSE;
+ }
+
+ return xReturn;
+ }
+ #endif /* configSUPPORT_STATIC_ALLOCATION */
+/*-----------------------------------------------------------*/
+
const char * pcTimerGetName( TimerHandle_t xTimer ) /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
{
Timer_t * pxTimer = xTimer;
diff --git a/components/freertos/esp_additions/include/freertos/idf_additions.h b/components/freertos/esp_additions/include/freertos/idf_additions.h
index 22aac424b7..3b5a7b347e 100644
--- a/components/freertos/esp_additions/include/freertos/idf_additions.h
+++ b/components/freertos/esp_additions/include/freertos/idf_additions.h
@@ -36,7 +36,7 @@
* @brief Create a new task that is pinned to a particular core
*
* Helper function to create a task that is pinned to a particular core, or has
- * no affinity. In other wrods, the created task will have an affinity mask of:
+ * no affinity. In other words, the created task will have an affinity mask of:
* - (1 << xCoreID) if it is pinned to a particular core
* - Set to tskNO_AFFINITY if it has no affinity
*
@@ -119,7 +119,7 @@
TaskHandle_t xTaskGetIdleTaskHandleForCPU( BaseType_t xCoreID );
/**
- * @brief Get the current core affintiy of a particular task
+ * @brief Get the current core affinity of a particular task
*
* Helper function to get the core affinity of a particular task. If the task is
* pinned to a particular core, the core ID is returned. If the task is not