Skip to content

Commit

Permalink
[NXP] Add static mutex support to logging function
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Girardot <[email protected]>
  • Loading branch information
Martin-NXP committed Jan 13, 2025
1 parent 04cf4ac commit 0a82259
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/platform/nxp/common/Logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,23 @@
namespace chip {
namespace Logging {
namespace Platform {
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
StaticSemaphore_t xLoggingSemaphoreBuffer;
#endif

/**
* CHIP log output function.
* Called only by ember-print (zcl log)
*/
void LogV(const char * module, uint8_t category, const char * msg, va_list v)
{
static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutex();
#if ( configSUPPORT_STATIC_ALLOCATION == 1 )
static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutexStatic(&xLoggingSemaphoreBuffer);
#else
static SemaphoreHandle_t xLoggingSemaphore = xSemaphoreCreateMutex();
#endif
assert(xLoggingSemaphore != NULL);

char formattedMsg[CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE] = { 0 };
size_t prefixLen;

Expand Down

0 comments on commit 0a82259

Please sign in to comment.