Line data Source code
1 : /* SPDX-FileCopyrightText: Copyright 2026 Cozens Software Solutions Limited
2 : * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 OR LicenseRef-PolyForm-Internal-Use-1.0.0 OR LicenseRef-COSOSO-Commercial
3 : */
4 :
5 : #ifndef SOLIDSYSLOGCMSISRTOSMUTEXPRIVATE_H
6 : #define SOLIDSYSLOGCMSISRTOSMUTEXPRIVATE_H
7 :
8 : #include <stdbool.h>
9 : #include <stdint.h>
10 :
11 : #include "cmsis_os2.h"
12 :
13 : #include "SolidSyslogCmsisRtosMutexErrors.h"
14 : #include "SolidSyslogError.h"
15 : #include "SolidSyslogMutexDefinition.h"
16 : #include "SolidSyslogPrival.h"
17 :
18 : /* osMutexNew returns an opaque id that need not be the control block it was
19 : * given - CMSIS-FreeRTOS sets the low bit for a recursive mutex - so the id is
20 : * stored rather than derived, and the control block stays the caller's. */
21 : struct SolidSyslogCmsisRtosMutex
22 : {
23 : struct SolidSyslogMutex Base;
24 : osMutexId_t Id;
25 : };
26 :
27 : bool SolidSyslogCmsisRtosMutex_Initialise(
28 : struct SolidSyslogMutex* base,
29 : void* controlBlock,
30 : uint32_t controlBlockBytes
31 : );
32 : void SolidSyslogCmsisRtosMutex_Cleanup(struct SolidSyslogMutex* base);
33 :
34 20 : static inline void CmsisRtosMutex_Report(
35 : enum SolidSyslogSeverity severity,
36 : uint16_t category,
37 : enum SolidSyslogMutexErrors code
38 : )
39 : {
40 20 : SolidSyslog_Error(severity, &SolidSyslogCmsisRtosMutexErrorSource, category, (int32_t) code);
41 20 : }
42 :
43 : #endif /* SOLIDSYSLOGCMSISRTOSMUTEXPRIVATE_H */
|