From 93f008b8bb2eed4e98ea658195a67b75fe40b291 Mon Sep 17 00:00:00 2001 From: schilkp Date: Thu, 6 Jun 2024 07:39:46 +0200 Subject: [PATCH] Add extended traceCREATE_COUNTING_SEMAPHORE hook. Adds an extended version of traceCREATE_COUNTING_SEMAPHORE that also exposes the handle of the semaphore. This provides the tracer with the initial semaphore count which is set after the call to traceQUEUE_CREATE and was not hygienically exposed without this hook. --- include/FreeRTOS.h | 7 +++++++ queue.c | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/FreeRTOS.h b/include/FreeRTOS.h index 6878ce871..0775a6ece 100644 --- a/include/FreeRTOS.h +++ b/include/FreeRTOS.h @@ -757,6 +757,13 @@ #define traceCREATE_COUNTING_SEMAPHORE() #endif +#ifndef traceCREATE_COUNTING_SEMAPHORE_EXT + +/* Extended version of traceCREATE_COUNTING_SEMAPHORE that also exposes the queue + * handle after the initial count has been set */ + #define traceCREATE_COUNTING_SEMAPHORE_EXT( xHandle ) traceCREATE_COUNTING_SEMAPHORE() +#endif + #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED #define traceCREATE_COUNTING_SEMAPHORE_FAILED() #endif diff --git a/queue.c b/queue.c index 5b97e7cf2..bb041cf49 100644 --- a/queue.c +++ b/queue.c @@ -880,7 +880,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, { ( ( Queue_t * ) xHandle )->uxMessagesWaiting = uxInitialCount; - traceCREATE_COUNTING_SEMAPHORE(); + traceCREATE_COUNTING_SEMAPHORE_EXT( xHandle ); } else { @@ -919,7 +919,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, { ( ( Queue_t * ) xHandle )->uxMessagesWaiting = uxInitialCount; - traceCREATE_COUNTING_SEMAPHORE(); + traceCREATE_COUNTING_SEMAPHORE_EXT( xHandle ); } else {