Test: Gather test execution code in app_broker
This change consolidates all code for tests execution into a single
module named app_broker. The broker creates execution environment for
tests (regression and PSA aPI) requireing the tests implement only
entry functoin: void test_app(void *arg) defined in test_app.h
Signed-off-by: Anton Komlev <anton.komlev@arm.com>
Change-Id: I410f6dd0a635b4b543a25af528195d9365dcf320
diff --git a/app_broker/CMSIS/CMakeLists.txt b/app_broker/CMSIS/CMakeLists.txt
new file mode 100644
index 0000000..3a20f9c
--- /dev/null
+++ b/app_broker/CMSIS/CMakeLists.txt
@@ -0,0 +1,65 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2023, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+#
+# This CMake script used in a split build only. In the legacy 'sinlge' build
+# this file is ignoed. Please don't be confused.
+#
+cmake_minimum_required(VERSION 3.15)
+cmake_policy(SET CMP0079 NEW)
+
+add_library(CMSIS_5_RTX_V8MMN STATIC IMPORTED GLOBAL)
+add_library(CMSIS_5_RTX_V8MMFN STATIC IMPORTED GLOBAL)
+add_library(CMSIS_5_RTX_V8MBN STATIC IMPORTED GLOBAL)
+add_library(CMSIS_5_RTX_CM3 STATIC IMPORTED GLOBAL)
+
+set(CMSIS_LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/RTOS2/RTX/Library)
+
+if ("${CMAKE_C_COMPILER_ID}" STREQUAL GNU)
+ set_target_properties(CMSIS_5_RTX_V8MMN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/GCC/libRTX_V8MMN.a)
+ set_target_properties(CMSIS_5_RTX_V8MMFN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/GCC/libRTX_V8MMFN.a)
+ set_target_properties(CMSIS_5_RTX_V8MBN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/GCC/libRTX_V8MBN.a)
+ set_target_properties(CMSIS_5_RTX_CM3 PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/GCC/libRTX_CM3.a)
+elseif("${CMAKE_C_COMPILER_ID}" STREQUAL ARMClang)
+ set_target_properties(CMSIS_5_RTX_V8MMN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/ARM/RTX_V8MMN.lib)
+ set_target_properties(CMSIS_5_RTX_V8MMFN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/ARM/RTX_V8MMFN.lib)
+ set_target_properties(CMSIS_5_RTX_V8MBN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/ARM/RTX_V8MBN.lib)
+ set_target_properties(CMSIS_5_RTX_CM3 PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/ARM/RTX_CM3.lib)
+elseif("${CMAKE_C_COMPILER_ID}" STREQUAL IAR)
+ add_library(CMSIS_5_RTX_V81MMN STATIC IMPORTED GLOBAL)
+ set_target_properties(CMSIS_5_RTX_V8MMN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/IAR/RTX_V8MMN.a)
+ set_target_properties(CMSIS_5_RTX_V81MMN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/IAR/RTX_V81MMN.a)
+ set_target_properties(CMSIS_5_RTX_V8MMFN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/IAR/RTX_V8MMFN.a)
+ set_target_properties(CMSIS_5_RTX_V8MBN PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/IAR/RTX_V8MBN.a)
+ set_target_properties(CMSIS_5_RTX_CM3 PROPERTIES IMPORTED_LOCATION ${CMSIS_LIBS_DIR}/IAR/RTX_CM3.a)
+else()
+ message(FATAL_ERROR "${CMAKE_C_COMPILER_ID} does not have CMSIS RTX static libraries set up")
+endif()
+
+add_library(RTX_OS STATIC)
+
+target_sources(RTX_OS
+ PUBLIC
+ RTOS2/RTX/Config/RTX_Config.c
+ RTOS2/RTX/Source/rtx_lib.c
+)
+
+target_include_directories(RTX_OS
+ PUBLIC
+ Core/Include
+ RTOS2/Include
+ RTOS2/RTX/Include
+ RTOS2/RTX/Config
+)
+
+target_link_libraries(RTX_OS
+ PRIVATE
+ CMSIS_5_RTX_V8MMN
+ tfm_test_broker
+ PUBLIC
+ platform_ns # for cmsis_compiler.h
+ psa_interface # for os_wrapper/common.h
+)
diff --git a/app_broker/CMSIS/LICENSE.txt b/app_broker/CMSIS/LICENSE.txt
new file mode 100644
index 0000000..8dada3e
--- /dev/null
+++ b/app_broker/CMSIS/LICENSE.txt
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "{}"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright {yyyy} {name of copyright owner}
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/app_broker/CMSIS/README b/app_broker/CMSIS/README
new file mode 100644
index 0000000..307528f
--- /dev/null
+++ b/app_broker/CMSIS/README
@@ -0,0 +1,15 @@
+The source codes under this folder are copied from:
+https://github.com/ARM-software/CMSIS_5.git, tag 5.5.0, without modifications.
+Only CMakeLists.txt file is added for TF-M test build purpose.
+
+The prebuilt libraries have two versions:
+ - v5.5.0 for ARMCLANG and GCC compilers
+ - v5.7.0 for IAR compiler
+
+The v5.7.0 libraries for ARMCLANG and GCC have linking issues on Musca_A and
+AN524. So libraries for these two compilers keep using v5.5.0 which has been
+tested and verified.
+
+The IAR libraries of v5.5.0 has a problem and has been updated in CMSIS_5 5.7.0.
+So IAR libraries use v5.7.0.
+
diff --git a/app_broker/CMSIS/RTOS2/Include/cmsis_os2.h b/app_broker/CMSIS/RTOS2/Include/cmsis_os2.h
new file mode 100644
index 0000000..e0b602c
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/Include/cmsis_os2.h
@@ -0,0 +1,756 @@
+/*
+ * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ----------------------------------------------------------------------
+ *
+ * $Date: 18. June 2018
+ * $Revision: V2.1.3
+ *
+ * Project: CMSIS-RTOS2 API
+ * Title: cmsis_os2.h header file
+ *
+ * Version 2.1.3
+ * Additional functions allowed to be called from Interrupt Service Routines:
+ * - osThreadGetId
+ * Version 2.1.2
+ * Additional functions allowed to be called from Interrupt Service Routines:
+ * - osKernelGetInfo, osKernelGetState
+ * Version 2.1.1
+ * Additional functions allowed to be called from Interrupt Service Routines:
+ * - osKernelGetTickCount, osKernelGetTickFreq
+ * Changed Kernel Tick type to uint32_t:
+ * - updated: osKernelGetTickCount, osDelayUntil
+ * Version 2.1.0
+ * Support for critical and uncritical sections (nesting safe):
+ * - updated: osKernelLock, osKernelUnlock
+ * - added: osKernelRestoreLock
+ * Updated Thread and Event Flags:
+ * - changed flags parameter and return type from int32_t to uint32_t
+ * Version 2.0.0
+ * Initial Release
+ *---------------------------------------------------------------------------*/
+
+#ifndef CMSIS_OS2_H_
+#define CMSIS_OS2_H_
+
+#ifndef __NO_RETURN
+#if defined(__CC_ARM)
+#define __NO_RETURN __declspec(noreturn)
+#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
+#define __NO_RETURN __attribute__((__noreturn__))
+#elif defined(__GNUC__)
+#define __NO_RETURN __attribute__((__noreturn__))
+#elif defined(__ICCARM__)
+#define __NO_RETURN __noreturn
+#else
+#define __NO_RETURN
+#endif
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+// ==== Enumerations, structures, defines ====
+
+/// Version information.
+typedef struct {
+ uint32_t api; ///< API version (major.minor.rev: mmnnnrrrr dec).
+ uint32_t kernel; ///< Kernel version (major.minor.rev: mmnnnrrrr dec).
+} osVersion_t;
+
+/// Kernel state.
+typedef enum {
+ osKernelInactive = 0, ///< Inactive.
+ osKernelReady = 1, ///< Ready.
+ osKernelRunning = 2, ///< Running.
+ osKernelLocked = 3, ///< Locked.
+ osKernelSuspended = 4, ///< Suspended.
+ osKernelError = -1, ///< Error.
+ osKernelReserved = 0x7FFFFFFFU ///< Prevents enum down-size compiler optimization.
+} osKernelState_t;
+
+/// Thread state.
+typedef enum {
+ osThreadInactive = 0, ///< Inactive.
+ osThreadReady = 1, ///< Ready.
+ osThreadRunning = 2, ///< Running.
+ osThreadBlocked = 3, ///< Blocked.
+ osThreadTerminated = 4, ///< Terminated.
+ osThreadError = -1, ///< Error.
+ osThreadReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
+} osThreadState_t;
+
+/// Priority values.
+typedef enum {
+ osPriorityNone = 0, ///< No priority (not initialized).
+ osPriorityIdle = 1, ///< Reserved for Idle thread.
+ osPriorityLow = 8, ///< Priority: low
+ osPriorityLow1 = 8+1, ///< Priority: low + 1
+ osPriorityLow2 = 8+2, ///< Priority: low + 2
+ osPriorityLow3 = 8+3, ///< Priority: low + 3
+ osPriorityLow4 = 8+4, ///< Priority: low + 4
+ osPriorityLow5 = 8+5, ///< Priority: low + 5
+ osPriorityLow6 = 8+6, ///< Priority: low + 6
+ osPriorityLow7 = 8+7, ///< Priority: low + 7
+ osPriorityBelowNormal = 16, ///< Priority: below normal
+ osPriorityBelowNormal1 = 16+1, ///< Priority: below normal + 1
+ osPriorityBelowNormal2 = 16+2, ///< Priority: below normal + 2
+ osPriorityBelowNormal3 = 16+3, ///< Priority: below normal + 3
+ osPriorityBelowNormal4 = 16+4, ///< Priority: below normal + 4
+ osPriorityBelowNormal5 = 16+5, ///< Priority: below normal + 5
+ osPriorityBelowNormal6 = 16+6, ///< Priority: below normal + 6
+ osPriorityBelowNormal7 = 16+7, ///< Priority: below normal + 7
+ osPriorityNormal = 24, ///< Priority: normal
+ osPriorityNormal1 = 24+1, ///< Priority: normal + 1
+ osPriorityNormal2 = 24+2, ///< Priority: normal + 2
+ osPriorityNormal3 = 24+3, ///< Priority: normal + 3
+ osPriorityNormal4 = 24+4, ///< Priority: normal + 4
+ osPriorityNormal5 = 24+5, ///< Priority: normal + 5
+ osPriorityNormal6 = 24+6, ///< Priority: normal + 6
+ osPriorityNormal7 = 24+7, ///< Priority: normal + 7
+ osPriorityAboveNormal = 32, ///< Priority: above normal
+ osPriorityAboveNormal1 = 32+1, ///< Priority: above normal + 1
+ osPriorityAboveNormal2 = 32+2, ///< Priority: above normal + 2
+ osPriorityAboveNormal3 = 32+3, ///< Priority: above normal + 3
+ osPriorityAboveNormal4 = 32+4, ///< Priority: above normal + 4
+ osPriorityAboveNormal5 = 32+5, ///< Priority: above normal + 5
+ osPriorityAboveNormal6 = 32+6, ///< Priority: above normal + 6
+ osPriorityAboveNormal7 = 32+7, ///< Priority: above normal + 7
+ osPriorityHigh = 40, ///< Priority: high
+ osPriorityHigh1 = 40+1, ///< Priority: high + 1
+ osPriorityHigh2 = 40+2, ///< Priority: high + 2
+ osPriorityHigh3 = 40+3, ///< Priority: high + 3
+ osPriorityHigh4 = 40+4, ///< Priority: high + 4
+ osPriorityHigh5 = 40+5, ///< Priority: high + 5
+ osPriorityHigh6 = 40+6, ///< Priority: high + 6
+ osPriorityHigh7 = 40+7, ///< Priority: high + 7
+ osPriorityRealtime = 48, ///< Priority: realtime
+ osPriorityRealtime1 = 48+1, ///< Priority: realtime + 1
+ osPriorityRealtime2 = 48+2, ///< Priority: realtime + 2
+ osPriorityRealtime3 = 48+3, ///< Priority: realtime + 3
+ osPriorityRealtime4 = 48+4, ///< Priority: realtime + 4
+ osPriorityRealtime5 = 48+5, ///< Priority: realtime + 5
+ osPriorityRealtime6 = 48+6, ///< Priority: realtime + 6
+ osPriorityRealtime7 = 48+7, ///< Priority: realtime + 7
+ osPriorityISR = 56, ///< Reserved for ISR deferred thread.
+ osPriorityError = -1, ///< System cannot determine priority or illegal priority.
+ osPriorityReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
+} osPriority_t;
+
+/// Entry point of a thread.
+typedef void (*osThreadFunc_t) (void *argument);
+
+/// Timer callback function.
+typedef void (*osTimerFunc_t) (void *argument);
+
+/// Timer type.
+typedef enum {
+ osTimerOnce = 0, ///< One-shot timer.
+ osTimerPeriodic = 1 ///< Repeating timer.
+} osTimerType_t;
+
+// Timeout value.
+#define osWaitForever 0xFFFFFFFFU ///< Wait forever timeout value.
+
+// Flags options (\ref osThreadFlagsWait and \ref osEventFlagsWait).
+#define osFlagsWaitAny 0x00000000U ///< Wait for any flag (default).
+#define osFlagsWaitAll 0x00000001U ///< Wait for all flags.
+#define osFlagsNoClear 0x00000002U ///< Do not clear flags which have been specified to wait for.
+
+// Flags errors (returned by osThreadFlagsXxxx and osEventFlagsXxxx).
+#define osFlagsError 0x80000000U ///< Error indicator.
+#define osFlagsErrorUnknown 0xFFFFFFFFU ///< osError (-1).
+#define osFlagsErrorTimeout 0xFFFFFFFEU ///< osErrorTimeout (-2).
+#define osFlagsErrorResource 0xFFFFFFFDU ///< osErrorResource (-3).
+#define osFlagsErrorParameter 0xFFFFFFFCU ///< osErrorParameter (-4).
+#define osFlagsErrorISR 0xFFFFFFFAU ///< osErrorISR (-6).
+
+// Thread attributes (attr_bits in \ref osThreadAttr_t).
+#define osThreadDetached 0x00000000U ///< Thread created in detached mode (default)
+#define osThreadJoinable 0x00000001U ///< Thread created in joinable mode
+
+// Mutex attributes (attr_bits in \ref osMutexAttr_t).
+#define osMutexRecursive 0x00000001U ///< Recursive mutex.
+#define osMutexPrioInherit 0x00000002U ///< Priority inherit protocol.
+#define osMutexRobust 0x00000008U ///< Robust mutex.
+
+/// Status code values returned by CMSIS-RTOS functions.
+typedef enum {
+ osOK = 0, ///< Operation completed successfully.
+ osError = -1, ///< Unspecified RTOS error: run-time error but no other error message fits.
+ osErrorTimeout = -2, ///< Operation not completed within the timeout period.
+ osErrorResource = -3, ///< Resource not available.
+ osErrorParameter = -4, ///< Parameter error.
+ osErrorNoMemory = -5, ///< System is out of memory: it was impossible to allocate or reserve memory for the operation.
+ osErrorISR = -6, ///< Not allowed in ISR context: the function cannot be called from interrupt service routines.
+ osStatusReserved = 0x7FFFFFFF ///< Prevents enum down-size compiler optimization.
+} osStatus_t;
+
+
+/// \details Thread ID identifies the thread.
+typedef void *osThreadId_t;
+
+/// \details Timer ID identifies the timer.
+typedef void *osTimerId_t;
+
+/// \details Event Flags ID identifies the event flags.
+typedef void *osEventFlagsId_t;
+
+/// \details Mutex ID identifies the mutex.
+typedef void *osMutexId_t;
+
+/// \details Semaphore ID identifies the semaphore.
+typedef void *osSemaphoreId_t;
+
+/// \details Memory Pool ID identifies the memory pool.
+typedef void *osMemoryPoolId_t;
+
+/// \details Message Queue ID identifies the message queue.
+typedef void *osMessageQueueId_t;
+
+
+#ifndef TZ_MODULEID_T
+#define TZ_MODULEID_T
+/// \details Data type that identifies secure software modules called by a process.
+typedef uint32_t TZ_ModuleId_t;
+#endif
+
+
+/// Attributes structure for thread.
+typedef struct {
+ const char *name; ///< name of the thread
+ uint32_t attr_bits; ///< attribute bits
+ void *cb_mem; ///< memory for control block
+ uint32_t cb_size; ///< size of provided memory for control block
+ void *stack_mem; ///< memory for stack
+ uint32_t stack_size; ///< size of stack
+ osPriority_t priority; ///< initial thread priority (default: osPriorityNormal)
+ TZ_ModuleId_t tz_module; ///< TrustZone module identifier
+ uint32_t reserved; ///< reserved (must be 0)
+} osThreadAttr_t;
+
+/// Attributes structure for timer.
+typedef struct {
+ const char *name; ///< name of the timer
+ uint32_t attr_bits; ///< attribute bits
+ void *cb_mem; ///< memory for control block
+ uint32_t cb_size; ///< size of provided memory for control block
+} osTimerAttr_t;
+
+/// Attributes structure for event flags.
+typedef struct {
+ const char *name; ///< name of the event flags
+ uint32_t attr_bits; ///< attribute bits
+ void *cb_mem; ///< memory for control block
+ uint32_t cb_size; ///< size of provided memory for control block
+} osEventFlagsAttr_t;
+
+/// Attributes structure for mutex.
+typedef struct {
+ const char *name; ///< name of the mutex
+ uint32_t attr_bits; ///< attribute bits
+ void *cb_mem; ///< memory for control block
+ uint32_t cb_size; ///< size of provided memory for control block
+} osMutexAttr_t;
+
+/// Attributes structure for semaphore.
+typedef struct {
+ const char *name; ///< name of the semaphore
+ uint32_t attr_bits; ///< attribute bits
+ void *cb_mem; ///< memory for control block
+ uint32_t cb_size; ///< size of provided memory for control block
+} osSemaphoreAttr_t;
+
+/// Attributes structure for memory pool.
+typedef struct {
+ const char *name; ///< name of the memory pool
+ uint32_t attr_bits; ///< attribute bits
+ void *cb_mem; ///< memory for control block
+ uint32_t cb_size; ///< size of provided memory for control block
+ void *mp_mem; ///< memory for data storage
+ uint32_t mp_size; ///< size of provided memory for data storage
+} osMemoryPoolAttr_t;
+
+/// Attributes structure for message queue.
+typedef struct {
+ const char *name; ///< name of the message queue
+ uint32_t attr_bits; ///< attribute bits
+ void *cb_mem; ///< memory for control block
+ uint32_t cb_size; ///< size of provided memory for control block
+ void *mq_mem; ///< memory for data storage
+ uint32_t mq_size; ///< size of provided memory for data storage
+} osMessageQueueAttr_t;
+
+
+// ==== Kernel Management Functions ====
+
+/// Initialize the RTOS Kernel.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osKernelInitialize (void);
+
+/// Get RTOS Kernel Information.
+/// \param[out] version pointer to buffer for retrieving version information.
+/// \param[out] id_buf pointer to buffer for retrieving kernel identification string.
+/// \param[in] id_size size of buffer for kernel identification string.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size);
+
+/// Get the current RTOS Kernel state.
+/// \return current RTOS Kernel state.
+osKernelState_t osKernelGetState (void);
+
+/// Start the RTOS Kernel scheduler.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osKernelStart (void);
+
+/// Lock the RTOS Kernel scheduler.
+/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
+int32_t osKernelLock (void);
+
+/// Unlock the RTOS Kernel scheduler.
+/// \return previous lock state (1 - locked, 0 - not locked, error code if negative).
+int32_t osKernelUnlock (void);
+
+/// Restore the RTOS Kernel scheduler lock state.
+/// \param[in] lock lock state obtained by \ref osKernelLock or \ref osKernelUnlock.
+/// \return new lock state (1 - locked, 0 - not locked, error code if negative).
+int32_t osKernelRestoreLock (int32_t lock);
+
+/// Suspend the RTOS Kernel scheduler.
+/// \return time in ticks, for how long the system can sleep or power-down.
+uint32_t osKernelSuspend (void);
+
+/// Resume the RTOS Kernel scheduler.
+/// \param[in] sleep_ticks time in ticks for how long the system was in sleep or power-down mode.
+void osKernelResume (uint32_t sleep_ticks);
+
+/// Get the RTOS kernel tick count.
+/// \return RTOS kernel current tick count.
+uint32_t osKernelGetTickCount (void);
+
+/// Get the RTOS kernel tick frequency.
+/// \return frequency of the kernel tick in hertz, i.e. kernel ticks per second.
+uint32_t osKernelGetTickFreq (void);
+
+/// Get the RTOS kernel system timer count.
+/// \return RTOS kernel current system timer count as 32-bit value.
+uint32_t osKernelGetSysTimerCount (void);
+
+/// Get the RTOS kernel system timer frequency.
+/// \return frequency of the system timer in hertz, i.e. timer ticks per second.
+uint32_t osKernelGetSysTimerFreq (void);
+
+
+// ==== Thread Management Functions ====
+
+/// Create a thread and add it to Active Threads.
+/// \param[in] func thread function.
+/// \param[in] argument pointer that is passed to the thread function as start argument.
+/// \param[in] attr thread attributes; NULL: default values.
+/// \return thread ID for reference by other functions or NULL in case of error.
+osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr);
+
+/// Get name of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return name as null-terminated string.
+const char *osThreadGetName (osThreadId_t thread_id);
+
+/// Return the thread ID of the current running thread.
+/// \return thread ID for reference by other functions or NULL in case of error.
+osThreadId_t osThreadGetId (void);
+
+/// Get current thread state of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return current thread state of the specified thread.
+osThreadState_t osThreadGetState (osThreadId_t thread_id);
+
+/// Get stack size of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return stack size in bytes.
+uint32_t osThreadGetStackSize (osThreadId_t thread_id);
+
+/// Get available stack space of a thread based on stack watermark recording during execution.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return remaining stack space in bytes.
+uint32_t osThreadGetStackSpace (osThreadId_t thread_id);
+
+/// Change priority of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \param[in] priority new priority value for the thread function.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority);
+
+/// Get current priority of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return current priority value of the specified thread.
+osPriority_t osThreadGetPriority (osThreadId_t thread_id);
+
+/// Pass control to next thread that is in state \b READY.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osThreadYield (void);
+
+/// Suspend execution of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osThreadSuspend (osThreadId_t thread_id);
+
+/// Resume execution of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osThreadResume (osThreadId_t thread_id);
+
+/// Detach a thread (thread storage can be reclaimed when thread terminates).
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osThreadDetach (osThreadId_t thread_id);
+
+/// Wait for specified thread to terminate.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osThreadJoin (osThreadId_t thread_id);
+
+/// Terminate execution of current running thread.
+__NO_RETURN void osThreadExit (void);
+
+/// Terminate execution of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osThreadTerminate (osThreadId_t thread_id);
+
+/// Get number of active threads.
+/// \return number of active threads.
+uint32_t osThreadGetCount (void);
+
+/// Enumerate active threads.
+/// \param[out] thread_array pointer to array for retrieving thread IDs.
+/// \param[in] array_items maximum number of items in array for retrieving thread IDs.
+/// \return number of enumerated threads.
+uint32_t osThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items);
+
+
+// ==== Thread Flags Functions ====
+
+/// Set the specified Thread Flags of a thread.
+/// \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+/// \param[in] flags specifies the flags of the thread that shall be set.
+/// \return thread flags after setting or error code if highest bit set.
+uint32_t osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags);
+
+/// Clear the specified Thread Flags of current running thread.
+/// \param[in] flags specifies the flags of the thread that shall be cleared.
+/// \return thread flags before clearing or error code if highest bit set.
+uint32_t osThreadFlagsClear (uint32_t flags);
+
+/// Get the current Thread Flags of current running thread.
+/// \return current thread flags.
+uint32_t osThreadFlagsGet (void);
+
+/// Wait for one or more Thread Flags of the current running thread to become signaled.
+/// \param[in] flags specifies the flags to wait for.
+/// \param[in] options specifies flags options (osFlagsXxxx).
+/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+/// \return thread flags before clearing or error code if highest bit set.
+uint32_t osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout);
+
+
+// ==== Generic Wait Functions ====
+
+/// Wait for Timeout (Time Delay).
+/// \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value
+/// \return status code that indicates the execution status of the function.
+osStatus_t osDelay (uint32_t ticks);
+
+/// Wait until specified time.
+/// \param[in] ticks absolute time in ticks
+/// \return status code that indicates the execution status of the function.
+osStatus_t osDelayUntil (uint32_t ticks);
+
+
+// ==== Timer Management Functions ====
+
+/// Create and Initialize a timer.
+/// \param[in] func function pointer to callback function.
+/// \param[in] type \ref osTimerOnce for one-shot or \ref osTimerPeriodic for periodic behavior.
+/// \param[in] argument argument to the timer callback function.
+/// \param[in] attr timer attributes; NULL: default values.
+/// \return timer ID for reference by other functions or NULL in case of error.
+osTimerId_t osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr);
+
+/// Get name of a timer.
+/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
+/// \return name as null-terminated string.
+const char *osTimerGetName (osTimerId_t timer_id);
+
+/// Start or restart a timer.
+/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
+/// \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value of the timer.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osTimerStart (osTimerId_t timer_id, uint32_t ticks);
+
+/// Stop a timer.
+/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osTimerStop (osTimerId_t timer_id);
+
+/// Check if a timer is running.
+/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
+/// \return 0 not running, 1 running.
+uint32_t osTimerIsRunning (osTimerId_t timer_id);
+
+/// Delete a timer.
+/// \param[in] timer_id timer ID obtained by \ref osTimerNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osTimerDelete (osTimerId_t timer_id);
+
+
+// ==== Event Flags Management Functions ====
+
+/// Create and Initialize an Event Flags object.
+/// \param[in] attr event flags attributes; NULL: default values.
+/// \return event flags ID for reference by other functions or NULL in case of error.
+osEventFlagsId_t osEventFlagsNew (const osEventFlagsAttr_t *attr);
+
+/// Get name of an Event Flags object.
+/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+/// \return name as null-terminated string.
+const char *osEventFlagsGetName (osEventFlagsId_t ef_id);
+
+/// Set the specified Event Flags.
+/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+/// \param[in] flags specifies the flags that shall be set.
+/// \return event flags after setting or error code if highest bit set.
+uint32_t osEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags);
+
+/// Clear the specified Event Flags.
+/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+/// \param[in] flags specifies the flags that shall be cleared.
+/// \return event flags before clearing or error code if highest bit set.
+uint32_t osEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags);
+
+/// Get the current Event Flags.
+/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+/// \return current event flags.
+uint32_t osEventFlagsGet (osEventFlagsId_t ef_id);
+
+/// Wait for one or more Event Flags to become signaled.
+/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+/// \param[in] flags specifies the flags to wait for.
+/// \param[in] options specifies flags options (osFlagsXxxx).
+/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+/// \return event flags before clearing or error code if highest bit set.
+uint32_t osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout);
+
+/// Delete an Event Flags object.
+/// \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osEventFlagsDelete (osEventFlagsId_t ef_id);
+
+
+// ==== Mutex Management Functions ====
+
+/// Create and Initialize a Mutex object.
+/// \param[in] attr mutex attributes; NULL: default values.
+/// \return mutex ID for reference by other functions or NULL in case of error.
+osMutexId_t osMutexNew (const osMutexAttr_t *attr);
+
+/// Get name of a Mutex object.
+/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+/// \return name as null-terminated string.
+const char *osMutexGetName (osMutexId_t mutex_id);
+
+/// Acquire a Mutex or timeout if it is locked.
+/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout);
+
+/// Release a Mutex that was acquired by \ref osMutexAcquire.
+/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMutexRelease (osMutexId_t mutex_id);
+
+/// Get Thread which owns a Mutex object.
+/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+/// \return thread ID of owner thread or NULL when mutex was not acquired.
+osThreadId_t osMutexGetOwner (osMutexId_t mutex_id);
+
+/// Delete a Mutex object.
+/// \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMutexDelete (osMutexId_t mutex_id);
+
+
+// ==== Semaphore Management Functions ====
+
+/// Create and Initialize a Semaphore object.
+/// \param[in] max_count maximum number of available tokens.
+/// \param[in] initial_count initial number of available tokens.
+/// \param[in] attr semaphore attributes; NULL: default values.
+/// \return semaphore ID for reference by other functions or NULL in case of error.
+osSemaphoreId_t osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr);
+
+/// Get name of a Semaphore object.
+/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+/// \return name as null-terminated string.
+const char *osSemaphoreGetName (osSemaphoreId_t semaphore_id);
+
+/// Acquire a Semaphore token or timeout if no tokens are available.
+/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout);
+
+/// Release a Semaphore token up to the initial maximum count.
+/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osSemaphoreRelease (osSemaphoreId_t semaphore_id);
+
+/// Get current Semaphore token count.
+/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+/// \return number of tokens available.
+uint32_t osSemaphoreGetCount (osSemaphoreId_t semaphore_id);
+
+/// Delete a Semaphore object.
+/// \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osSemaphoreDelete (osSemaphoreId_t semaphore_id);
+
+
+// ==== Memory Pool Management Functions ====
+
+/// Create and Initialize a Memory Pool object.
+/// \param[in] block_count maximum number of memory blocks in memory pool.
+/// \param[in] block_size memory block size in bytes.
+/// \param[in] attr memory pool attributes; NULL: default values.
+/// \return memory pool ID for reference by other functions or NULL in case of error.
+osMemoryPoolId_t osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr);
+
+/// Get name of a Memory Pool object.
+/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+/// \return name as null-terminated string.
+const char *osMemoryPoolGetName (osMemoryPoolId_t mp_id);
+
+/// Allocate a memory block from a Memory Pool.
+/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+/// \return address of the allocated memory block or NULL in case of no memory is available.
+void *osMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout);
+
+/// Return an allocated memory block back to a Memory Pool.
+/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+/// \param[in] block address of the allocated memory block to be returned to the memory pool.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMemoryPoolFree (osMemoryPoolId_t mp_id, void *block);
+
+/// Get maximum number of memory blocks in a Memory Pool.
+/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+/// \return maximum number of memory blocks.
+uint32_t osMemoryPoolGetCapacity (osMemoryPoolId_t mp_id);
+
+/// Get memory block size in a Memory Pool.
+/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+/// \return memory block size in bytes.
+uint32_t osMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id);
+
+/// Get number of memory blocks used in a Memory Pool.
+/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+/// \return number of memory blocks used.
+uint32_t osMemoryPoolGetCount (osMemoryPoolId_t mp_id);
+
+/// Get number of memory blocks available in a Memory Pool.
+/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+/// \return number of memory blocks available.
+uint32_t osMemoryPoolGetSpace (osMemoryPoolId_t mp_id);
+
+/// Delete a Memory Pool object.
+/// \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMemoryPoolDelete (osMemoryPoolId_t mp_id);
+
+
+// ==== Message Queue Management Functions ====
+
+/// Create and Initialize a Message Queue object.
+/// \param[in] msg_count maximum number of messages in queue.
+/// \param[in] msg_size maximum message size in bytes.
+/// \param[in] attr message queue attributes; NULL: default values.
+/// \return message queue ID for reference by other functions or NULL in case of error.
+osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
+
+/// Get name of a Message Queue object.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \return name as null-terminated string.
+const char *osMessageQueueGetName (osMessageQueueId_t mq_id);
+
+/// Put a Message into a Queue or timeout if Queue is full.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \param[in] msg_ptr pointer to buffer with message to put into a queue.
+/// \param[in] msg_prio message priority.
+/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
+
+/// Get a Message from a Queue or timeout if Queue is empty.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \param[out] msg_ptr pointer to buffer for message to get from a queue.
+/// \param[out] msg_prio pointer to buffer for message priority or NULL.
+/// \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout);
+
+/// Get maximum number of messages in a Message Queue.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \return maximum number of messages.
+uint32_t osMessageQueueGetCapacity (osMessageQueueId_t mq_id);
+
+/// Get maximum message size in a Memory Pool.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \return maximum message size in bytes.
+uint32_t osMessageQueueGetMsgSize (osMessageQueueId_t mq_id);
+
+/// Get number of queued messages in a Message Queue.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \return number of queued messages.
+uint32_t osMessageQueueGetCount (osMessageQueueId_t mq_id);
+
+/// Get number of available slots for messages in a Message Queue.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \return number of available slots for messages.
+uint32_t osMessageQueueGetSpace (osMessageQueueId_t mq_id);
+
+/// Reset a Message Queue to initial empty state.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMessageQueueReset (osMessageQueueId_t mq_id);
+
+/// Delete a Message Queue object.
+/// \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+/// \return status code that indicates the execution status of the function.
+osStatus_t osMessageQueueDelete (osMessageQueueId_t mq_id);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // CMSIS_OS2_H_
diff --git a/app_broker/CMSIS/RTOS2/RTX/Config/RTX_Config.c b/app_broker/CMSIS/RTOS2/RTX/Config/RTX_Config.c
new file mode 100644
index 0000000..e487101
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Config/RTX_Config.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2013-2018 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * $Revision: V5.1.0
+ *
+ * Project: CMSIS-RTOS RTX
+ * Title: RTX Configuration
+ *
+ * -----------------------------------------------------------------------------
+ */
+
+#include "cmsis_compiler.h"
+#include "rtx_os.h"
+
+// OS Idle Thread
+__WEAK __NO_RETURN void osRtxIdleThread (void *argument) {
+ (void)argument;
+
+ for (;;) {}
+}
+
+// OS Error Callback function
+__WEAK uint32_t osRtxErrorNotify (uint32_t code, void *object_id) {
+ (void)object_id;
+
+ switch (code) {
+ case osRtxErrorStackUnderflow:
+ // Stack overflow detected for thread (thread_id=object_id)
+ break;
+ case osRtxErrorISRQueueOverflow:
+ // ISR Queue overflow detected when inserting object (object_id)
+ break;
+ case osRtxErrorTimerQueueOverflow:
+ // User Timer Callback Queue overflow detected for timer (timer_id=object_id)
+ break;
+ case osRtxErrorClibSpace:
+ // Standard C/C++ library libspace not available: increase OS_THREAD_LIBSPACE_NUM
+ break;
+ case osRtxErrorClibMutex:
+ // Standard C/C++ library mutex initialization failed
+ break;
+ default:
+ // Reserved
+ break;
+ }
+ for (;;) {}
+//return 0U;
+}
diff --git a/app_broker/CMSIS/RTOS2/RTX/Config/RTX_Config.h b/app_broker/CMSIS/RTOS2/RTX/Config/RTX_Config.h
new file mode 100644
index 0000000..1671aab
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Config/RTX_Config.h
@@ -0,0 +1,578 @@
+/*
+ * Copyright (c) 2013-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * $Revision: V5.5.0
+ *
+ * Project: CMSIS-RTOS RTX
+ * Title: RTX Configuration definitions
+ *
+ * -----------------------------------------------------------------------------
+ */
+
+#ifndef RTX_CONFIG_H_
+#define RTX_CONFIG_H_
+
+#ifdef _RTE_
+#include "RTE_Components.h"
+#ifdef RTE_RTX_CONFIG_H
+#include RTE_RTX_CONFIG_H
+#endif
+#endif
+
+//-------- <<< Use Configuration Wizard in Context Menu >>> --------------------
+
+// <h>System Configuration
+// =======================
+
+// <o>Global Dynamic Memory size [bytes] <0-1073741824:8>
+// <i> Defines the combined global dynamic memory size.
+// <i> Default: 4096
+#ifndef OS_DYNAMIC_MEM_SIZE
+#define OS_DYNAMIC_MEM_SIZE 8192
+#endif
+
+// <o>Kernel Tick Frequency [Hz] <1-1000000>
+// <i> Defines base time unit for delays and timeouts.
+// <i> Default: 1000 (1ms tick)
+#ifndef OS_TICK_FREQ
+#define OS_TICK_FREQ 1000
+#endif
+
+// <e>Round-Robin Thread switching
+// <i> Enables Round-Robin Thread switching.
+#ifndef OS_ROBIN_ENABLE
+#define OS_ROBIN_ENABLE 1
+#endif
+
+// <o>Round-Robin Timeout <1-1000>
+// <i> Defines how many ticks a thread will execute before a thread switch.
+// <i> Default: 5
+#ifndef OS_ROBIN_TIMEOUT
+#define OS_ROBIN_TIMEOUT 5
+#endif
+
+// </e>
+
+// <o>ISR FIFO Queue
+// <4=> 4 entries <8=> 8 entries <12=> 12 entries <16=> 16 entries
+// <24=> 24 entries <32=> 32 entries <48=> 48 entries <64=> 64 entries
+// <96=> 96 entries <128=> 128 entries <196=> 196 entries <256=> 256 entries
+// <i> RTOS Functions called from ISR store requests to this buffer.
+// <i> Default: 16 entries
+#ifndef OS_ISR_FIFO_QUEUE
+#define OS_ISR_FIFO_QUEUE 16
+#endif
+
+// <q>Object Memory usage counters
+// <i> Enables object memory usage counters (requires RTX source variant).
+#ifndef OS_OBJ_MEM_USAGE
+#define OS_OBJ_MEM_USAGE 0
+#endif
+
+// </h>
+
+// <h>Thread Configuration
+// =======================
+
+// <e>Object specific Memory allocation
+// <i> Enables object specific memory allocation.
+#ifndef OS_THREAD_OBJ_MEM
+#define OS_THREAD_OBJ_MEM 0
+#endif
+
+// <o>Number of user Threads <1-1000>
+// <i> Defines maximum number of user threads that can be active at the same time.
+// <i> Applies to user threads with system provided memory for control blocks.
+#ifndef OS_THREAD_NUM
+#define OS_THREAD_NUM 1
+#endif
+
+// <o>Number of user Threads with default Stack size <0-1000>
+// <i> Defines maximum number of user threads with default stack size.
+// <i> Applies to user threads with zero stack size specified.
+#ifndef OS_THREAD_DEF_STACK_NUM
+#define OS_THREAD_DEF_STACK_NUM 0
+#endif
+
+// <o>Total Stack size [bytes] for user Threads with user-provided Stack size <0-1073741824:8>
+// <i> Defines the combined stack size for user threads with user-provided stack size.
+// <i> Applies to user threads with user-provided stack size and system provided memory for stack.
+// <i> Default: 0
+#ifndef OS_THREAD_USER_STACK_SIZE
+#define OS_THREAD_USER_STACK_SIZE 0
+#endif
+
+// </e>
+
+// <o>Default Thread Stack size [bytes] <96-1073741824:8>
+// <i> Defines stack size for threads with zero stack size specified.
+// <i> Default: 256
+#ifndef OS_STACK_SIZE
+#define OS_STACK_SIZE 256
+#endif
+
+// <o>Idle Thread Stack size [bytes] <72-1073741824:8>
+// <i> Defines stack size for Idle thread.
+// <i> Default: 256
+#ifndef OS_IDLE_THREAD_STACK_SIZE
+#define OS_IDLE_THREAD_STACK_SIZE 256
+#endif
+
+// <o>Idle Thread TrustZone Module Identifier
+// <i> Defines TrustZone Thread Context Management Identifier.
+// <i> Applies only to cores with TrustZone technology.
+// <i> Default: 0 (not used)
+#ifndef OS_IDLE_THREAD_TZ_MOD_ID
+#define OS_IDLE_THREAD_TZ_MOD_ID 0
+#endif
+
+// <q>Stack overrun checking
+// <i> Enables stack overrun check at thread switch.
+// <i> Enabling this option increases slightly the execution time of a thread switch.
+#ifndef OS_STACK_CHECK
+#define OS_STACK_CHECK 1
+#endif
+
+// <q>Stack usage watermark
+// <i> Initializes thread stack with watermark pattern for analyzing stack usage.
+// <i> Enabling this option increases significantly the execution time of thread creation.
+#ifndef OS_STACK_WATERMARK
+#define OS_STACK_WATERMARK 0
+#endif
+
+// <o>Processor mode for Thread execution
+// <0=> Unprivileged mode
+// <1=> Privileged mode
+// <i> Default: Privileged mode
+#ifndef OS_PRIVILEGE_MODE
+#define OS_PRIVILEGE_MODE 1
+#endif
+
+// </h>
+
+// <h>Timer Configuration
+// ======================
+
+// <e>Object specific Memory allocation
+// <i> Enables object specific memory allocation.
+#ifndef OS_TIMER_OBJ_MEM
+#define OS_TIMER_OBJ_MEM 0
+#endif
+
+// <o>Number of Timer objects <1-1000>
+// <i> Defines maximum number of objects that can be active at the same time.
+// <i> Applies to objects with system provided memory for control blocks.
+#ifndef OS_TIMER_NUM
+#define OS_TIMER_NUM 1
+#endif
+
+// </e>
+
+// <o>Timer Thread Priority
+// <8=> Low
+// <16=> Below Normal <24=> Normal <32=> Above Normal
+// <40=> High
+// <48=> Realtime
+// <i> Defines priority for timer thread
+// <i> Default: High
+#ifndef OS_TIMER_THREAD_PRIO
+#define OS_TIMER_THREAD_PRIO 40
+#endif
+
+// <o>Timer Thread Stack size [bytes] <0-1073741824:8>
+// <i> Defines stack size for Timer thread.
+// <i> May be set to 0 when timers are not used.
+// <i> Default: 256
+#ifndef OS_TIMER_THREAD_STACK_SIZE
+#define OS_TIMER_THREAD_STACK_SIZE 256
+#endif
+
+// <o>Timer Thread TrustZone Module Identifier
+// <i> Defines TrustZone Thread Context Management Identifier.
+// <i> Applies only to cores with TrustZone technology.
+// <i> Default: 0 (not used)
+#ifndef OS_TIMER_THREAD_TZ_MOD_ID
+#define OS_TIMER_THREAD_TZ_MOD_ID 0
+#endif
+
+// <o>Timer Callback Queue entries <0-256>
+// <i> Number of concurrent active timer callback functions.
+// <i> May be set to 0 when timers are not used.
+// <i> Default: 4
+#ifndef OS_TIMER_CB_QUEUE
+#define OS_TIMER_CB_QUEUE 4
+#endif
+
+// </h>
+
+// <h>Event Flags Configuration
+// ============================
+
+// <e>Object specific Memory allocation
+// <i> Enables object specific memory allocation.
+#ifndef OS_EVFLAGS_OBJ_MEM
+#define OS_EVFLAGS_OBJ_MEM 0
+#endif
+
+// <o>Number of Event Flags objects <1-1000>
+// <i> Defines maximum number of objects that can be active at the same time.
+// <i> Applies to objects with system provided memory for control blocks.
+#ifndef OS_EVFLAGS_NUM
+#define OS_EVFLAGS_NUM 1
+#endif
+
+// </e>
+
+// </h>
+
+// <h>Mutex Configuration
+// ======================
+
+// <e>Object specific Memory allocation
+// <i> Enables object specific memory allocation.
+#ifndef OS_MUTEX_OBJ_MEM
+#define OS_MUTEX_OBJ_MEM 0
+#endif
+
+// <o>Number of Mutex objects <1-1000>
+// <i> Defines maximum number of objects that can be active at the same time.
+// <i> Applies to objects with system provided memory for control blocks.
+#ifndef OS_MUTEX_NUM
+#define OS_MUTEX_NUM 1
+#endif
+
+// </e>
+
+// </h>
+
+// <h>Semaphore Configuration
+// ==========================
+
+// <e>Object specific Memory allocation
+// <i> Enables object specific memory allocation.
+#ifndef OS_SEMAPHORE_OBJ_MEM
+#define OS_SEMAPHORE_OBJ_MEM 0
+#endif
+
+// <o>Number of Semaphore objects <1-1000>
+// <i> Defines maximum number of objects that can be active at the same time.
+// <i> Applies to objects with system provided memory for control blocks.
+#ifndef OS_SEMAPHORE_NUM
+#define OS_SEMAPHORE_NUM 1
+#endif
+
+// </e>
+
+// </h>
+
+// <h>Memory Pool Configuration
+// ============================
+
+// <e>Object specific Memory allocation
+// <i> Enables object specific memory allocation.
+#ifndef OS_MEMPOOL_OBJ_MEM
+#define OS_MEMPOOL_OBJ_MEM 0
+#endif
+
+// <o>Number of Memory Pool objects <1-1000>
+// <i> Defines maximum number of objects that can be active at the same time.
+// <i> Applies to objects with system provided memory for control blocks.
+#ifndef OS_MEMPOOL_NUM
+#define OS_MEMPOOL_NUM 1
+#endif
+
+// <o>Data Storage Memory size [bytes] <0-1073741824:8>
+// <i> Defines the combined data storage memory size.
+// <i> Applies to objects with system provided memory for data storage.
+// <i> Default: 0
+#ifndef OS_MEMPOOL_DATA_SIZE
+#define OS_MEMPOOL_DATA_SIZE 0
+#endif
+
+// </e>
+
+// </h>
+
+// <h>Message Queue Configuration
+// ==============================
+
+// <e>Object specific Memory allocation
+// <i> Enables object specific memory allocation.
+#ifndef OS_MSGQUEUE_OBJ_MEM
+#define OS_MSGQUEUE_OBJ_MEM 0
+#endif
+
+// <o>Number of Message Queue objects <1-1000>
+// <i> Defines maximum number of objects that can be active at the same time.
+// <i> Applies to objects with system provided memory for control blocks.
+#ifndef OS_MSGQUEUE_NUM
+#define OS_MSGQUEUE_NUM 1
+#endif
+
+// <o>Data Storage Memory size [bytes] <0-1073741824:8>
+// <i> Defines the combined data storage memory size.
+// <i> Applies to objects with system provided memory for data storage.
+// <i> Default: 0
+#ifndef OS_MSGQUEUE_DATA_SIZE
+#define OS_MSGQUEUE_DATA_SIZE 0
+#endif
+
+// </e>
+
+// </h>
+
+// <h>Event Recorder Configuration
+// ===============================
+
+// <e>Global Initialization
+// <i> Initialize Event Recorder during 'osKernelInitialize'.
+#ifndef OS_EVR_INIT
+#define OS_EVR_INIT 0
+#endif
+
+// <q>Start recording
+// <i> Start event recording after initialization.
+#ifndef OS_EVR_START
+#define OS_EVR_START 1
+#endif
+
+// <h>Global Event Filter Setup
+// <i> Initial recording level applied to all components.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_LEVEL
+#define OS_EVR_LEVEL 0x00U
+#endif
+
+// <h>RTOS Event Filter Setup
+// <i> Recording levels for RTX components.
+// <i> Only applicable if events for the respective component are generated.
+
+// <h>Memory Management
+// <i> Recording level for Memory Management events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_MEMORY_LEVEL
+#define OS_EVR_MEMORY_LEVEL 0x01U
+#endif
+
+// <h>Kernel
+// <i> Recording level for Kernel events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_KERNEL_LEVEL
+#define OS_EVR_KERNEL_LEVEL 0x01U
+#endif
+
+// <h>Thread
+// <i> Recording level for Thread events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_THREAD_LEVEL
+#define OS_EVR_THREAD_LEVEL 0x05U
+#endif
+
+// <h>Generic Wait
+// <i> Recording level for Generic Wait events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_WAIT_LEVEL
+#define OS_EVR_WAIT_LEVEL 0x01U
+#endif
+
+// <h>Thread Flags
+// <i> Recording level for Thread Flags events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_THFLAGS_LEVEL
+#define OS_EVR_THFLAGS_LEVEL 0x01U
+#endif
+
+// <h>Event Flags
+// <i> Recording level for Event Flags events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_EVFLAGS_LEVEL
+#define OS_EVR_EVFLAGS_LEVEL 0x01U
+#endif
+
+// <h>Timer
+// <i> Recording level for Timer events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_TIMER_LEVEL
+#define OS_EVR_TIMER_LEVEL 0x01U
+#endif
+
+// <h>Mutex
+// <i> Recording level for Mutex events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_MUTEX_LEVEL
+#define OS_EVR_MUTEX_LEVEL 0x01U
+#endif
+
+// <h>Semaphore
+// <i> Recording level for Semaphore events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_SEMAPHORE_LEVEL
+#define OS_EVR_SEMAPHORE_LEVEL 0x01U
+#endif
+
+// <h>Memory Pool
+// <i> Recording level for Memory Pool events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_MEMPOOL_LEVEL
+#define OS_EVR_MEMPOOL_LEVEL 0x01U
+#endif
+
+// <h>Message Queue
+// <i> Recording level for Message Queue events.
+// <o.0>Error events
+// <o.1>API function call events
+// <o.2>Operation events
+// <o.3>Detailed operation events
+// </h>
+#ifndef OS_EVR_MSGQUEUE_LEVEL
+#define OS_EVR_MSGQUEUE_LEVEL 0x01U
+#endif
+
+// </h>
+
+// </e>
+
+// <h>RTOS Event Generation
+// <i> Enables event generation for RTX components (requires RTX source variant).
+
+// <q>Memory Management
+// <i> Enables Memory Management event generation.
+#ifndef OS_EVR_MEMORY
+#define OS_EVR_MEMORY 1
+#endif
+
+// <q>Kernel
+// <i> Enables Kernel event generation.
+#ifndef OS_EVR_KERNEL
+#define OS_EVR_KERNEL 1
+#endif
+
+// <q>Thread
+// <i> Enables Thread event generation.
+#ifndef OS_EVR_THREAD
+#define OS_EVR_THREAD 1
+#endif
+
+// <q>Generic Wait
+// <i> Enables Generic Wait event generation.
+#ifndef OS_EVR_WAIT
+#define OS_EVR_WAIT 1
+#endif
+
+// <q>Thread Flags
+// <i> Enables Thread Flags event generation.
+#ifndef OS_EVR_THFLAGS
+#define OS_EVR_THFLAGS 1
+#endif
+
+// <q>Event Flags
+// <i> Enables Event Flags event generation.
+#ifndef OS_EVR_EVFLAGS
+#define OS_EVR_EVFLAGS 1
+#endif
+
+// <q>Timer
+// <i> Enables Timer event generation.
+#ifndef OS_EVR_TIMER
+#define OS_EVR_TIMER 1
+#endif
+
+// <q>Mutex
+// <i> Enables Mutex event generation.
+#ifndef OS_EVR_MUTEX
+#define OS_EVR_MUTEX 1
+#endif
+
+// <q>Semaphore
+// <i> Enables Semaphore event generation.
+#ifndef OS_EVR_SEMAPHORE
+#define OS_EVR_SEMAPHORE 1
+#endif
+
+// <q>Memory Pool
+// <i> Enables Memory Pool event generation.
+#ifndef OS_EVR_MEMPOOL
+#define OS_EVR_MEMPOOL 1
+#endif
+
+// <q>Message Queue
+// <i> Enables Message Queue event generation.
+#ifndef OS_EVR_MSGQUEUE
+#define OS_EVR_MSGQUEUE 1
+#endif
+
+// </h>
+
+// </h>
+
+// Number of Threads which use standard C/C++ library libspace
+// (when thread specific memory allocation is not used).
+#if (OS_THREAD_OBJ_MEM == 0)
+#define OS_THREAD_LIBSPACE_NUM 4
+#else
+#define OS_THREAD_LIBSPACE_NUM OS_THREAD_NUM
+#endif
+
+//------------- <<< end of configuration section >>> ---------------------------
+
+#endif // RTX_CONFIG_H_
diff --git a/app_broker/CMSIS/RTOS2/RTX/Include/rtx_evr.h b/app_broker/CMSIS/RTOS2/RTX/Include/rtx_evr.h
new file mode 100644
index 0000000..bcc82a6
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Include/rtx_evr.h
@@ -0,0 +1,1974 @@
+/*
+ * Copyright (c) 2013-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Project: CMSIS-RTOS RTX
+ * Title: RTX Event Recorder definitions
+ *
+ * -----------------------------------------------------------------------------
+ */
+
+#ifndef RTX_EVR_H_
+#define RTX_EVR_H_
+
+#include "cmsis_os2.h" // CMSIS RTOS API
+#include "RTX_Config.h" // RTX Configuration
+#include "rtx_os.h" // RTX OS definitions
+
+// Initial Thread configuration covered also Thread Flags and Generic Wait
+#ifndef OS_EVR_THFLAGS
+#define OS_EVR_THFLAGS OS_EVR_THREAD
+#endif
+#ifndef OS_EVR_WAIT
+#define OS_EVR_WAIT OS_EVR_THREAD
+#endif
+
+#ifdef _RTE_
+#include "RTE_Components.h"
+#endif
+
+#ifdef RTE_Compiler_EventRecorder
+
+//lint -emacro((835,845),EventID) [MISRA Note 13]
+
+#include "EventRecorder.h"
+#include "EventRecorderConf.h"
+
+#if ((defined(OS_EVR_INIT) && (OS_EVR_INIT != 0)) || (EVENT_TIMESTAMP_SOURCE == 2))
+#ifndef EVR_RTX_KERNEL_GET_STATE_DISABLE
+#define EVR_RTX_KERNEL_GET_STATE_DISABLE
+#endif
+#endif
+
+#if (EVENT_TIMESTAMP_SOURCE == 2)
+#ifndef EVR_RTX_KERNEL_GET_SYS_TIMER_COUNT_DISABLE
+#define EVR_RTX_KERNEL_GET_SYS_TIMER_COUNT_DISABLE
+#endif
+#ifndef EVR_RTX_KERNEL_GET_SYS_TIMER_FREQ_DISABLE
+#define EVR_RTX_KERNEL_GET_SYS_TIMER_FREQ_DISABLE
+#endif
+#endif
+
+/// RTOS component number
+#define EvtRtxMemoryNo (0xF0U)
+#define EvtRtxKernelNo (0xF1U)
+#define EvtRtxThreadNo (0xF2U)
+#define EvtRtxThreadFlagsNo (0xF4U)
+#define EvtRtxWaitNo (0xF3U)
+#define EvtRtxTimerNo (0xF6U)
+#define EvtRtxEventFlagsNo (0xF5U)
+#define EvtRtxMutexNo (0xF7U)
+#define EvtRtxSemaphoreNo (0xF8U)
+#define EvtRtxMemoryPoolNo (0xF9U)
+#define EvtRtxMessageQueueNo (0xFAU)
+
+#endif // RTE_Compiler_EventRecorder
+
+
+/// Extended Status codes
+#define osRtxErrorKernelNotReady (-7)
+#define osRtxErrorKernelNotRunning (-8)
+#define osRtxErrorInvalidControlBlock (-9)
+#define osRtxErrorInvalidDataMemory (-10)
+#define osRtxErrorInvalidThreadStack (-11)
+#define osRtxErrorInvalidPriority (-12)
+#define osRtxErrorThreadNotJoinable (-13)
+#define osRtxErrorMutexNotOwned (-14)
+#define osRtxErrorMutexNotLocked (-15)
+#define osRtxErrorMutexLockLimit (-16)
+#define osRtxErrorSemaphoreCountLimit (-17)
+#define osRtxErrorTZ_InitContext_S (-18)
+#define osRtxErrorTZ_AllocContext_S (-19)
+#define osRtxErrorTZ_FreeContext_S (-20)
+#define osRtxErrorTZ_LoadContext_S (-21)
+#define osRtxErrorTZ_SaveContext_S (-22)
+
+
+// ==== Memory Events ====
+
+/**
+ \brief Event on memory initialization (Op)
+ \param[in] mem pointer to memory pool.
+ \param[in] size size of a memory pool in bytes.
+ \param[in] result execution status: 1 - success, 0 - failure.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMORY != 0) && !defined(EVR_RTX_MEMORY_INIT_DISABLE))
+extern void EvrRtxMemoryInit (void *mem, uint32_t size, uint32_t result);
+#else
+#define EvrRtxMemoryInit(mem, size, result)
+#endif
+
+/**
+ \brief Event on memory allocate (Op)
+ \param[in] mem pointer to memory pool.
+ \param[in] size size of a memory block in bytes.
+ \param[in] type memory block type: 0 - generic, 1 - control block.
+ \param[in] block pointer to allocated memory block or NULL in case of no memory is available.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMORY != 0) && !defined(EVR_RTX_MEMORY_ALLOC_DISABLE))
+extern void EvrRtxMemoryAlloc (void *mem, uint32_t size, uint32_t type, void *block);
+#else
+#define EvrRtxMemoryAlloc(mem, size, type, block)
+#endif
+
+/**
+ \brief Event on memory free (Op)
+ \param[in] mem pointer to memory pool.
+ \param[in] block memory block to be returned to the memory pool.
+ \param[in] result execution status: 1 - success, 0 - failure.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMORY != 0) && !defined(EVR_RTX_MEMORY_FREE_DISABLE))
+extern void EvrRtxMemoryFree (void *mem, void *block, uint32_t result);
+#else
+#define EvrRtxMemoryFree(mem, block, result)
+#endif
+
+/**
+ \brief Event on memory block initialization (Op)
+ \param[in] mp_info memory pool info.
+ \param[in] block_count maximum number of memory blocks in memory pool.
+ \param[in] block_size size of a memory block in bytes.
+ \param[in] block_mem pointer to memory for block storage.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMORY != 0) && !defined(EVR_RTX_MEMORY_BLOCK_INIT_DISABLE))
+extern void EvrRtxMemoryBlockInit (osRtxMpInfo_t *mp_info, uint32_t block_count, uint32_t block_size, void *block_mem);
+#else
+#define EvrRtxMemoryBlockInit(mp_info, block_count, block_size, block_mem)
+#endif
+
+/**
+ \brief Event on memory block alloc (Op)
+ \param[in] mp_info memory pool info.
+ \param[in] block address of the allocated memory block or NULL in case of no memory is available.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMORY != 0) && !defined(EVR_RTX_MEMORY_BLOCK_ALLOC_DISABLE))
+extern void EvrRtxMemoryBlockAlloc (osRtxMpInfo_t *mp_info, void *block);
+#else
+#define EvrRtxMemoryBlockAlloc(mp_info, block)
+#endif
+
+/**
+ \brief Event on memory block free (Op)
+ \param[in] mp_info memory pool info.
+ \param[in] block address of the allocated memory block to be returned to the memory pool.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMORY != 0) && !defined(EVR_RTX_MEMORY_BLOCK_FREE_DISABLE))
+extern void EvrRtxMemoryBlockFree (osRtxMpInfo_t *mp_info, void *block, int32_t status);
+#else
+#define EvrRtxMemoryBlockFree(mp_info, block, status)
+#endif
+
+
+// ==== Kernel Events ====
+
+/**
+ \brief Event on RTOS kernel error (Error)
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_ERROR_DISABLE))
+extern void EvrRtxKernelError (int32_t status);
+#else
+#define EvrRtxKernelError(status)
+#endif
+
+/**
+ \brief Event on RTOS kernel initialize (API)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_INITIALIZE_DISABLE))
+extern void EvrRtxKernelInitialize (void);
+#else
+#define EvrRtxKernelInitialize()
+#endif
+
+/**
+ \brief Event on successful RTOS kernel initialize (Op)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_INITIALIZED_DISABLE))
+extern void EvrRtxKernelInitialized (void);
+#else
+#define EvrRtxKernelInitialized()
+#endif
+
+/**
+ \brief Event on RTOS kernel information retrieve (API)
+ \param[in] version pointer to buffer for retrieving version information.
+ \param[in] id_buf pointer to buffer for retrieving kernel identification string.
+ \param[in] id_size size of buffer for kernel identification string.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_GET_INFO_DISABLE))
+extern void EvrRtxKernelGetInfo (osVersion_t *version, char *id_buf, uint32_t id_size);
+#else
+#define EvrRtxKernelGetInfo(version, id_buf, id_size)
+#endif
+
+/**
+ \brief Event on successful RTOS kernel information retrieve (Op)
+ \param[in] version pointer to buffer for retrieving version information.
+ \param[in] id_buf pointer to buffer for retrieving kernel identification string.
+ \param[in] id_size size of buffer for kernel identification string.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_INFO_RETRIEVED_DISABLE))
+extern void EvrRtxKernelInfoRetrieved (const osVersion_t *version, const char *id_buf, uint32_t id_size);
+#else
+#define EvrRtxKernelInfoRetrieved(version, id_buf, id_size)
+#endif
+
+/**
+ \brief Event on current RTOS Kernel state retrieve (API)
+ \param[in] state current RTOS Kernel state.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_GET_STATE_DISABLE))
+extern void EvrRtxKernelGetState (osKernelState_t state);
+#else
+#define EvrRtxKernelGetState(state)
+#endif
+
+/**
+ \brief Event on RTOS Kernel scheduler start (API)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_START_DISABLE))
+extern void EvrRtxKernelStart (void);
+#else
+#define EvrRtxKernelStart()
+#endif
+
+/**
+ \brief Event on successful RTOS Kernel scheduler start (Op)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_STARTED_DISABLE))
+extern void EvrRtxKernelStarted (void);
+#else
+#define EvrRtxKernelStarted()
+#endif
+
+/**
+ \brief Event on RTOS Kernel scheduler lock (API)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_LOCK_DISABLE))
+extern void EvrRtxKernelLock (void);
+#else
+#define EvrRtxKernelLock()
+#endif
+
+/**
+ \brief Event on successful RTOS Kernel scheduler lock (Op)
+ \param[in] lock previous lock state (1 - locked, 0 - not locked).
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_LOCKED_DISABLE))
+extern void EvrRtxKernelLocked (int32_t lock);
+#else
+#define EvrRtxKernelLocked(lock)
+#endif
+
+/**
+ \brief Event on RTOS Kernel scheduler unlock (API)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_UNLOCK_DISABLE))
+extern void EvrRtxKernelUnlock (void);
+#else
+#define EvrRtxKernelUnlock()
+#endif
+
+/**
+ \brief Event on successful RTOS Kernel scheduler unlock (Op)
+ \param[in] lock previous lock state (1 - locked, 0 - not locked).
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_UNLOCKED_DISABLE))
+extern void EvrRtxKernelUnlocked (int32_t lock);
+#else
+#define EvrRtxKernelUnlocked(lock)
+#endif
+
+/**
+ \brief Event on RTOS Kernel scheduler lock state restore (API)
+ \param[in] lock lock state obtained by \ref osKernelLock or \ref osKernelUnlock.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_RESTORE_LOCK_DISABLE))
+extern void EvrRtxKernelRestoreLock (int32_t lock);
+#else
+#define EvrRtxKernelRestoreLock(lock)
+#endif
+
+/**
+ \brief Event on successful RTOS Kernel scheduler lock state restore (Op)
+ \param[in] lock new lock state (1 - locked, 0 - not locked).
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_LOCK_RESTORED_DISABLE))
+extern void EvrRtxKernelLockRestored (int32_t lock);
+#else
+#define EvrRtxKernelLockRestored(lock)
+#endif
+
+/**
+ \brief Event on RTOS Kernel scheduler suspend (API)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_SUSPEND_DISABLE))
+extern void EvrRtxKernelSuspend (void);
+#else
+#define EvrRtxKernelSuspend()
+#endif
+
+/**
+ \brief Event on successful RTOS Kernel scheduler suspend (Op)
+ \param[in] sleep_ticks time in ticks, for how long the system can sleep or power-down.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_SUSPENDED_DISABLE))
+extern void EvrRtxKernelSuspended (uint32_t sleep_ticks);
+#else
+#define EvrRtxKernelSuspended(sleep_ticks)
+#endif
+
+/**
+ \brief Event on RTOS Kernel scheduler resume (API)
+ \param[in] sleep_ticks time in ticks, for how long the system was in sleep or power-down mode.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_RESUME_DISABLE))
+extern void EvrRtxKernelResume (uint32_t sleep_ticks);
+#else
+#define EvrRtxKernelResume(sleep_ticks)
+#endif
+
+/**
+ \brief Event on successful RTOS Kernel scheduler resume (Op)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_RESUMED_DISABLE))
+extern void EvrRtxKernelResumed (void);
+#else
+#define EvrRtxKernelResumed()
+#endif
+
+/**
+ \brief Event on RTOS kernel tick count retrieve (API)
+ \param[in] count RTOS kernel current tick count.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_GET_TICK_COUNT_DISABLE))
+extern void EvrRtxKernelGetTickCount (uint32_t count);
+#else
+#define EvrRtxKernelGetTickCount(count)
+#endif
+
+/**
+ \brief Event on RTOS kernel tick frequency retrieve (API)
+ \param[in] freq frequency of the kernel tick.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_GET_TICK_FREQ_DISABLE))
+extern void EvrRtxKernelGetTickFreq (uint32_t freq);
+#else
+#define EvrRtxKernelGetTickFreq(freq)
+#endif
+
+/**
+ \brief Event on RTOS kernel system timer count retrieve (API)
+ \param[in] count RTOS kernel current system timer count as 32-bit value.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_GET_SYS_TIMER_COUNT_DISABLE))
+extern void EvrRtxKernelGetSysTimerCount (uint32_t count);
+#else
+#define EvrRtxKernelGetSysTimerCount(count)
+#endif
+
+/**
+ \brief Event on RTOS kernel system timer frequency retrieve (API)
+ \param[in] freq frequency of the system timer.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_KERNEL != 0) && !defined(EVR_RTX_KERNEL_GET_SYS_TIMER_FREQ_DISABLE))
+extern void EvrRtxKernelGetSysTimerFreq (uint32_t freq);
+#else
+#define EvrRtxKernelGetSysTimerFreq(freq)
+#endif
+
+
+// ==== Thread Events ====
+
+/**
+ \brief Event on thread error (Error)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId or NULL when ID is unknown.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_ERROR_DISABLE))
+extern void EvrRtxThreadError (osThreadId_t thread_id, int32_t status);
+#else
+#define EvrRtxThreadError(thread_id, status)
+#endif
+
+/**
+ \brief Event on thread create and intialize (API)
+ \param[in] func thread function.
+ \param[in] argument pointer that is passed to the thread function as start argument.
+ \param[in] attr thread attributes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_NEW_DISABLE))
+extern void EvrRtxThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr);
+#else
+#define EvrRtxThreadNew(func, argument, attr)
+#endif
+
+/**
+ \brief Event on successful thread create (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] thread_addr thread entry address.
+ \param[in] name pointer to thread object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_CREATED_DISABLE))
+extern void EvrRtxThreadCreated (osThreadId_t thread_id, uint32_t thread_addr, const char *name);
+#else
+#define EvrRtxThreadCreated(thread_id, thread_addr, name)
+#endif
+
+/**
+ \brief Event on thread name retrieve (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] name pointer to thread object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_GET_NAME_DISABLE))
+extern void EvrRtxThreadGetName (osThreadId_t thread_id, const char *name);
+#else
+#define EvrRtxThreadGetName(thread_id, name)
+#endif
+
+/**
+ \brief Event on current running thread ID retrieve (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_GET_ID_DISABLE))
+extern void EvrRtxThreadGetId (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadGetId(thread_id)
+#endif
+
+/**
+ \brief Event on thread state retrieve (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] state current thread state of the specified thread.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_GET_STATE_DISABLE))
+extern void EvrRtxThreadGetState (osThreadId_t thread_id, osThreadState_t state);
+#else
+#define EvrRtxThreadGetState(thread_id, state)
+#endif
+
+/**
+ \brief Event on thread stack size retrieve (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] stack_size stack size in bytes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_GET_STACK_SIZE_DISABLE))
+extern void EvrRtxThreadGetStackSize (osThreadId_t thread_id, uint32_t stack_size);
+#else
+#define EvrRtxThreadGetStackSize(thread_id, stack_size)
+#endif
+
+/**
+ \brief Event on available stack space retrieve (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] stack_space remaining stack space in bytes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_GET_STACK_SPACE_DISABLE))
+extern void EvrRtxThreadGetStackSpace (osThreadId_t thread_id, uint32_t stack_space);
+#else
+#define EvrRtxThreadGetStackSpace(thread_id, stack_space)
+#endif
+
+/**
+ \brief Event on thread priority set (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] priority new priority value for the thread function.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_SET_PRIORITY_DISABLE))
+extern void EvrRtxThreadSetPriority (osThreadId_t thread_id, osPriority_t priority);
+#else
+#define EvrRtxThreadSetPriority(thread_id, priority)
+#endif
+
+/**
+ \brief Event on thread priority updated (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] priority new priority value for the thread function.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_PRIORITY_UPDATED_DISABLE))
+extern void EvrRtxThreadPriorityUpdated (osThreadId_t thread_id, osPriority_t priority);
+#else
+#define EvrRtxThreadPriorityUpdated(thread_id, priority)
+#endif
+
+/**
+ \brief Event on thread priority retrieve (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] priority current priority value of the specified thread.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_GET_PRIORITY_DISABLE))
+extern void EvrRtxThreadGetPriority (osThreadId_t thread_id, osPriority_t priority);
+#else
+#define EvrRtxThreadGetPriority(thread_id, priority)
+#endif
+
+/**
+ \brief Event on thread yield (API)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_YIELD_DISABLE))
+extern void EvrRtxThreadYield (void);
+#else
+#define EvrRtxThreadYield()
+#endif
+
+/**
+ \brief Event on thread suspend (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_SUSPEND_DISABLE))
+extern void EvrRtxThreadSuspend (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadSuspend(thread_id)
+#endif
+
+/**
+ \brief Event on successful thread suspend (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_SUSPENDED_DISABLE))
+extern void EvrRtxThreadSuspended (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadSuspended(thread_id)
+#endif
+
+/**
+ \brief Event on thread resume (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_RESUME_DISABLE))
+extern void EvrRtxThreadResume (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadResume(thread_id)
+#endif
+
+/**
+ \brief Event on successful thread resume (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_RESUMED_DISABLE))
+extern void EvrRtxThreadResumed (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadResumed(thread_id)
+#endif
+
+/**
+ \brief Event on thread detach (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_DETACH_DISABLE))
+extern void EvrRtxThreadDetach (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadDetach(thread_id)
+#endif
+
+/**
+ \brief Event on successful thread detach (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_DETACHED_DISABLE))
+extern void EvrRtxThreadDetached (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadDetached(thread_id)
+#endif
+
+/**
+ \brief Event on thread join (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_JOIN_DISABLE))
+extern void EvrRtxThreadJoin (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadJoin(thread_id)
+#endif
+
+/**
+ \brief Event on pending thread join (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_JOIN_PENDING_DISABLE))
+extern void EvrRtxThreadJoinPending (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadJoinPending(thread_id)
+#endif
+
+/**
+ \brief Event on successful thread join (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_JOINED_DISABLE))
+extern void EvrRtxThreadJoined (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadJoined(thread_id)
+#endif
+
+/**
+ \brief Event on thread execution block (Detail)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_BLOCKED_DISABLE))
+extern void EvrRtxThreadBlocked (osThreadId_t thread_id, uint32_t timeout);
+#else
+#define EvrRtxThreadBlocked(thread_id, timeout)
+#endif
+
+/**
+ \brief Event on thread execution unblock (Detail)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] ret_val extended execution status of the thread.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_UNBLOCKED_DISABLE))
+extern void EvrRtxThreadUnblocked (osThreadId_t thread_id, uint32_t ret_val);
+#else
+#define EvrRtxThreadUnblocked(thread_id, ret_val)
+#endif
+
+/**
+ \brief Event on running thread pre-emption (Detail)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_PREEMPTED_DISABLE))
+extern void EvrRtxThreadPreempted (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadPreempted(thread_id)
+#endif
+
+/**
+ \brief Event on running thread switch (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_SWITCHED_DISABLE))
+extern void EvrRtxThreadSwitched (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadSwitched(thread_id)
+#endif
+
+/**
+ \brief Event on thread exit (API)
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_EXIT_DISABLE))
+extern void EvrRtxThreadExit (void);
+#else
+#define EvrRtxThreadExit()
+#endif
+
+/**
+ \brief Event on thread terminate (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_TERMINATE_DISABLE))
+extern void EvrRtxThreadTerminate (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadTerminate(thread_id)
+#endif
+
+/**
+ \brief Event on successful thread terminate (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_DESTROYED_DISABLE))
+extern void EvrRtxThreadDestroyed (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadDestroyed(thread_id)
+#endif
+
+/**
+ \brief Event on active thread count retrieve (API)
+ \param[in] count number of active threads.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_GET_COUNT_DISABLE))
+extern void EvrRtxThreadGetCount (uint32_t count);
+#else
+#define EvrRtxThreadGetCount(count)
+#endif
+
+/**
+ \brief Event on active threads enumerate (API)
+ \param[in] thread_array pointer to array for retrieving thread IDs.
+ \param[in] array_items maximum number of items in array for retrieving thread IDs.
+ \param[in] count number of enumerated threads.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THREAD != 0) && !defined(EVR_RTX_THREAD_ENUMERATE_DISABLE))
+extern void EvrRtxThreadEnumerate (osThreadId_t *thread_array, uint32_t array_items, uint32_t count);
+#else
+#define EvrRtxThreadEnumerate(thread_array, array_items, count)
+#endif
+
+
+// ==== Thread Flags Events ====
+
+/**
+ \brief Event on thread flags error (Error)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId or NULL when ID is unknown.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_ERROR_DISABLE))
+extern void EvrRtxThreadFlagsError (osThreadId_t thread_id, int32_t status);
+#else
+#define EvrRtxThreadFlagsError(thread_id, status)
+#endif
+
+/**
+ \brief Event on thread flags set (API)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] flags flags of the thread that shall be set.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_SET_DISABLE))
+extern void EvrRtxThreadFlagsSet (osThreadId_t thread_id, uint32_t flags);
+#else
+#define EvrRtxThreadFlagsSet(thread_id, flags)
+#endif
+
+/**
+ \brief Event on successful thread flags set (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+ \param[in] thread_flags thread flags after setting.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_SET_DONE_DISABLE))
+extern void EvrRtxThreadFlagsSetDone (osThreadId_t thread_id, uint32_t thread_flags);
+#else
+#define EvrRtxThreadFlagsSetDone(thread_id, thread_flags)
+#endif
+
+/**
+ \brief Event on thread flags clear (API)
+ \param[in] flags flags of the thread that shall be cleared.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_CLEAR_DISABLE))
+extern void EvrRtxThreadFlagsClear (uint32_t flags);
+#else
+#define EvrRtxThreadFlagsClear(flags)
+#endif
+
+/**
+ \brief Event on successful thread flags clear (Op)
+ \param[in] thread_flags thread flags before clearing.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_CLEAR_DONE_DISABLE))
+extern void EvrRtxThreadFlagsClearDone (uint32_t thread_flags);
+#else
+#define EvrRtxThreadFlagsClearDone(thread_flags)
+#endif
+
+/**
+ \brief Event on thread flags retrieve (API)
+ \param[in] thread_flags current thread flags.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_GET_DISABLE))
+extern void EvrRtxThreadFlagsGet (uint32_t thread_flags);
+#else
+#define EvrRtxThreadFlagsGet(thread_flags)
+#endif
+
+/**
+ \brief Event on wait for thread flags (API)
+ \param[in] flags flags to wait for.
+ \param[in] options flags options (osFlagsXxxx).
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_WAIT_DISABLE))
+extern void EvrRtxThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout);
+#else
+#define EvrRtxThreadFlagsWait(flags, options, timeout)
+#endif
+
+/**
+ \brief Event on pending wait for thread flags (Op)
+ \param[in] flags flags to wait for.
+ \param[in] options flags options (osFlagsXxxx).
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_WAIT_PENDING_DISABLE))
+extern void EvrRtxThreadFlagsWaitPending (uint32_t flags, uint32_t options, uint32_t timeout);
+#else
+#define EvrRtxThreadFlagsWaitPending(flags, options, timeout)
+#endif
+
+/**
+ \brief Event on wait timeout for thread flags (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_WAIT_TIMEOUT_DISABLE))
+extern void EvrRtxThreadFlagsWaitTimeout (osThreadId_t thread_id);
+#else
+#define EvrRtxThreadFlagsWaitTimeout(thread_id)
+#endif
+
+/**
+ \brief Event on successful wait for thread flags (Op)
+ \param[in] flags flags to wait for.
+ \param[in] options flags options (osFlagsXxxx).
+ \param[in] thread_flags thread flags before clearing.
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_WAIT_COMPLETED_DISABLE))
+extern void EvrRtxThreadFlagsWaitCompleted (uint32_t flags, uint32_t options, uint32_t thread_flags, osThreadId_t thread_id);
+#else
+#define EvrRtxThreadFlagsWaitCompleted(flags, options, thread_flags, thread_id)
+#endif
+
+/**
+ \brief Event on unsuccessful wait for thread flags (Op)
+ \param[in] flags flags to wait for.
+ \param[in] options flags options (osFlagsXxxx).
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_THFLAGS != 0) && !defined(EVR_RTX_THREAD_FLAGS_WAIT_NOT_COMPLETED_DISABLE))
+extern void EvrRtxThreadFlagsWaitNotCompleted (uint32_t flags, uint32_t options);
+#else
+#define EvrRtxThreadFlagsWaitNotCompleted(flags, options)
+#endif
+
+
+// ==== Generic Wait Events ====
+
+/**
+ \brief Event on delay error (Error)
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_ERROR_DISABLE))
+extern void EvrRtxDelayError (int32_t status);
+#else
+#define EvrRtxDelayError(status)
+#endif
+
+/**
+ \brief Event on delay for specified time (API)
+ \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_DISABLE))
+extern void EvrRtxDelay (uint32_t ticks);
+#else
+#define EvrRtxDelay(ticks)
+#endif
+
+/**
+ \brief Event on delay until specified time (API)
+ \param[in] ticks absolute time in ticks.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_UNTIL_DISABLE))
+extern void EvrRtxDelayUntil (uint32_t ticks);
+#else
+#define EvrRtxDelayUntil(ticks)
+#endif
+
+/**
+ \brief Event on delay started (Op)
+ \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_STARTED_DISABLE))
+extern void EvrRtxDelayStarted (uint32_t ticks);
+#else
+#define EvrRtxDelayStarted(ticks)
+#endif
+
+/**
+ \brief Event on delay until specified time started (Op)
+ \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_UNTIL_STARTED_DISABLE))
+extern void EvrRtxDelayUntilStarted (uint32_t ticks);
+#else
+#define EvrRtxDelayUntilStarted(ticks)
+#endif
+
+/**
+ \brief Event on delay completed (Op)
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_WAIT != 0) && !defined(EVR_RTX_DELAY_COMPLETED_DISABLE))
+extern void EvrRtxDelayCompleted (osThreadId_t thread_id);
+#else
+#define EvrRtxDelayCompleted(thread_id)
+#endif
+
+
+// ==== Timer Events ====
+
+/**
+ \brief Event on timer error (Error)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew or NULL when ID is unknown.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_ERROR_DISABLE))
+extern void EvrRtxTimerError (osTimerId_t timer_id, int32_t status);
+#else
+#define EvrRtxTimerError(timer_id, status)
+#endif
+
+/**
+ \brief Event on timer callback call (Op)
+ \param[in] func start address of a timer call back function.
+ \param[in] argument argument to the timer call back function.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_CALLBACK_DISABLE))
+extern void EvrRtxTimerCallback (osTimerFunc_t func, void *argument);
+#else
+#define EvrRtxTimerCallback(func, argument)
+#endif
+
+/**
+ \brief Event on timer create and initialize (API)
+ \param[in] func start address of a timer call back function.
+ \param[in] type osTimerOnce for one-shot or osTimerPeriodic for periodic behavior.
+ \param[in] argument argument to the timer call back function.
+ \param[in] attr timer attributes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_NEW_DISABLE))
+extern void EvrRtxTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr);
+#else
+#define EvrRtxTimerNew(func, type, argument, attr)
+#endif
+
+/**
+ \brief Event on successful timer create (Op)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+ \param[in] name pointer to timer object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_CREATED_DISABLE))
+extern void EvrRtxTimerCreated (osTimerId_t timer_id, const char *name);
+#else
+#define EvrRtxTimerCreated(timer_id, name)
+#endif
+
+/**
+ \brief Event on timer name retrieve (API)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+ \param[in] name pointer to timer object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_GET_NAME_DISABLE))
+extern void EvrRtxTimerGetName (osTimerId_t timer_id, const char *name);
+#else
+#define EvrRtxTimerGetName(timer_id, name)
+#endif
+
+/**
+ \brief Event on timer start (API)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+ \param[in] ticks \ref CMSIS_RTOS_TimeOutValue "time ticks" value of the timer.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_START_DISABLE))
+extern void EvrRtxTimerStart (osTimerId_t timer_id, uint32_t ticks);
+#else
+#define EvrRtxTimerStart(timer_id, ticks)
+#endif
+
+/**
+ \brief Event on successful timer start (Op)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_STARTED_DISABLE))
+extern void EvrRtxTimerStarted (osTimerId_t timer_id);
+#else
+#define EvrRtxTimerStarted(timer_id)
+#endif
+
+/**
+ \brief Event on timer stop (API)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_STOP_DISABLE))
+extern void EvrRtxTimerStop (osTimerId_t timer_id);
+#else
+#define EvrRtxTimerStop(timer_id)
+#endif
+
+/**
+ \brief Event on successful timer stop (Op)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_STOPPED_DISABLE))
+extern void EvrRtxTimerStopped (osTimerId_t timer_id);
+#else
+#define EvrRtxTimerStopped(timer_id)
+#endif
+
+/**
+ \brief Event on timer running state check (API)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+ \param[in] running running state: 0 not running, 1 running.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_IS_RUNNING_DISABLE))
+extern void EvrRtxTimerIsRunning (osTimerId_t timer_id, uint32_t running);
+#else
+#define EvrRtxTimerIsRunning(timer_id, running)
+#endif
+
+/**
+ \brief Event on timer delete (API)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_DELETE_DISABLE))
+extern void EvrRtxTimerDelete (osTimerId_t timer_id);
+#else
+#define EvrRtxTimerDelete(timer_id)
+#endif
+
+/**
+ \brief Event on successful timer delete (Op)
+ \param[in] timer_id timer ID obtained by \ref osTimerNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_TIMER != 0) && !defined(EVR_RTX_TIMER_DESTROYED_DISABLE))
+extern void EvrRtxTimerDestroyed (osTimerId_t timer_id);
+#else
+#define EvrRtxTimerDestroyed(timer_id)
+#endif
+
+
+// ==== Event Flags Events ====
+
+/**
+ \brief Event on event flags error (Error)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew or NULL when ID is unknown.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_ERROR_DISABLE))
+extern void EvrRtxEventFlagsError (osEventFlagsId_t ef_id, int32_t status);
+#else
+#define EvrRtxEventFlagsError(ef_id, status)
+#endif
+
+/**
+ \brief Event on event flags create and initialize (API)
+ \param[in] attr event flags attributes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_NEW_DISABLE))
+extern void EvrRtxEventFlagsNew (const osEventFlagsAttr_t *attr);
+#else
+#define EvrRtxEventFlagsNew(attr)
+#endif
+
+/**
+ \brief Event on successful event flags create (Op)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] name pointer to event flags object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_CREATED_DISABLE))
+extern void EvrRtxEventFlagsCreated (osEventFlagsId_t ef_id, const char *name);
+#else
+#define EvrRtxEventFlagsCreated(ef_id, name)
+#endif
+
+/**
+ \brief Event on event flags name retrieve (API)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] name pointer to event flags object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_GET_NAME_DISABLE))
+extern void EvrRtxEventFlagsGetName (osEventFlagsId_t ef_id, const char *name);
+#else
+#define EvrRtxEventFlagsGetName(ef_id, name)
+#endif
+
+/**
+ \brief Event on event flags set (API)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] flags flags that shall be set.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_SET_DISABLE))
+extern void EvrRtxEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags);
+#else
+#define EvrRtxEventFlagsSet(ef_id, flags)
+#endif
+
+/**
+ \brief Event on successful event flags set (Op)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] event_flags event flags after setting.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_SET_DONE_DISABLE))
+extern void EvrRtxEventFlagsSetDone (osEventFlagsId_t ef_id, uint32_t event_flags);
+#else
+#define EvrRtxEventFlagsSetDone(ef_id, event_flags)
+#endif
+
+/**
+ \brief Event on event flags clear (API)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] flags flags that shall be cleared.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_CLEAR_DISABLE))
+extern void EvrRtxEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags);
+#else
+#define EvrRtxEventFlagsClear(ef_id, flags)
+#endif
+
+/**
+ \brief Event on successful event flags clear (Op)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] event_flags event flags before clearing.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_CLEAR_DONE_DISABLE))
+extern void EvrRtxEventFlagsClearDone (osEventFlagsId_t ef_id, uint32_t event_flags);
+#else
+#define EvrRtxEventFlagsClearDone(ef_id, event_flags)
+#endif
+
+/**
+ \brief Event on event flags retrieve (API)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] event_flags current event flags.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_GET_DISABLE))
+extern void EvrRtxEventFlagsGet (osEventFlagsId_t ef_id, uint32_t event_flags);
+#else
+#define EvrRtxEventFlagsGet(ef_id, event_flags)
+#endif
+
+/**
+ \brief Event on wait for event flags (API)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] flags flags to wait for.
+ \param[in] options flags options (osFlagsXxxx).
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_WAIT_DISABLE))
+extern void EvrRtxEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout);
+#else
+#define EvrRtxEventFlagsWait(ef_id, flags, options, timeout)
+#endif
+
+/**
+ \brief Event on pending wait for event flags (Op)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] flags flags to wait for.
+ \param[in] options flags options (osFlagsXxxx).
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_WAIT_PENDING_DISABLE))
+extern void EvrRtxEventFlagsWaitPending (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t timeout);
+#else
+#define EvrRtxEventFlagsWaitPending(ef_id, flags, options, timeout)
+#endif
+
+/**
+ \brief Event on wait timeout for event flags (Op)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_WAIT_TIMEOUT_DISABLE))
+extern void EvrRtxEventFlagsWaitTimeout (osEventFlagsId_t ef_id);
+#else
+#define EvrRtxEventFlagsWaitTimeout(ef_id)
+#endif
+
+/**
+ \brief Event on successful wait for event flags (Op)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] flags flags to wait for.
+ \param[in] options flags options (osFlagsXxxx).
+ \param[in] event_flags event flags before clearing or 0 if specified flags have not been set.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_WAIT_COMPLETED_DISABLE))
+extern void EvrRtxEventFlagsWaitCompleted (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options, uint32_t event_flags);
+#else
+#define EvrRtxEventFlagsWaitCompleted(ef_id, flags, options, event_flags)
+#endif
+
+/**
+ \brief Event on unsuccessful wait for event flags (Op)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+ \param[in] flags flags to wait for.
+ \param[in] options flags options (osFlagsXxxx).
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_WAIT_NOT_COMPLETED_DISABLE))
+extern void EvrRtxEventFlagsWaitNotCompleted (osEventFlagsId_t ef_id, uint32_t flags, uint32_t options);
+#else
+#define EvrRtxEventFlagsWaitNotCompleted(ef_id, flags, options)
+#endif
+
+/**
+ \brief Event on event flags delete (API)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_DELETE_DISABLE))
+extern void EvrRtxEventFlagsDelete (osEventFlagsId_t ef_id);
+#else
+#define EvrRtxEventFlagsDelete(ef_id)
+#endif
+
+/**
+ \brief Event on successful event flags delete (Op)
+ \param[in] ef_id event flags ID obtained by \ref osEventFlagsNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_EVFLAGS != 0) && !defined(EVR_RTX_EVENT_FLAGS_DESTROYED_DISABLE))
+extern void EvrRtxEventFlagsDestroyed (osEventFlagsId_t ef_id);
+#else
+#define EvrRtxEventFlagsDestroyed(ef_id)
+#endif
+
+
+// ==== Mutex Events ====
+
+/**
+ \brief Event on mutex error (Error)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew or NULL when ID is unknown.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_ERROR_DISABLE))
+extern void EvrRtxMutexError (osMutexId_t mutex_id, int32_t status);
+#else
+#define EvrRtxMutexError(mutex_id, status)
+#endif
+
+/**
+ \brief Event on mutex create and initialize (API)
+ \param[in] attr mutex attributes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_NEW_DISABLE))
+extern void EvrRtxMutexNew (const osMutexAttr_t *attr);
+#else
+#define EvrRtxMutexNew(attr)
+#endif
+
+/**
+ \brief Event on successful mutex create (Op)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+ \param[in] name pointer to mutex object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_CREATED_DISABLE))
+extern void EvrRtxMutexCreated (osMutexId_t mutex_id, const char *name);
+#else
+#define EvrRtxMutexCreated(mutex_id, name)
+#endif
+
+/**
+ \brief Event on mutex name retrieve (API)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+ \param[in] name pointer to mutex object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_GET_NAME_DISABLE))
+extern void EvrRtxMutexGetName (osMutexId_t mutex_id, const char *name);
+#else
+#define EvrRtxMutexGetName(mutex_id, name)
+#endif
+
+/**
+ \brief Event on mutex acquire (API)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_ACQUIRE_DISABLE))
+extern void EvrRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout);
+#else
+#define EvrRtxMutexAcquire(mutex_id, timeout)
+#endif
+
+/**
+ \brief Event on pending mutex acquire (Op)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_ACQUIRE_PENDING_DISABLE))
+extern void EvrRtxMutexAcquirePending (osMutexId_t mutex_id, uint32_t timeout);
+#else
+#define EvrRtxMutexAcquirePending(mutex_id, timeout);
+#endif
+
+/**
+ \brief Event on mutex acquire timeout (Op)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_ACQUIRE_TIMEOUT_DISABLE))
+extern void EvrRtxMutexAcquireTimeout (osMutexId_t mutex_id);
+#else
+#define EvrRtxMutexAcquireTimeout(mutex_id)
+#endif
+
+/**
+ \brief Event on successful mutex acquire (Op)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+ \param[in] lock current number of times mutex object is locked.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_ACQUIRED_DISABLE))
+extern void EvrRtxMutexAcquired (osMutexId_t mutex_id, uint32_t lock);
+#else
+#define EvrRtxMutexAcquired(mutex_id, lock)
+#endif
+
+/**
+ \brief Event on unsuccessful mutex acquire (Op)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_NOT_ACQUIRED_DISABLE))
+extern void EvrRtxMutexNotAcquired (osMutexId_t mutex_id);
+#else
+#define EvrRtxMutexNotAcquired(mutex_id)
+#endif
+
+/**
+ \brief Event on mutex release (API)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_RELEASE_DISABLE))
+extern void EvrRtxMutexRelease (osMutexId_t mutex_id);
+#else
+#define EvrRtxMutexRelease(mutex_id)
+#endif
+
+/**
+ \brief Event on successful mutex release (Op)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+ \param[in] lock current number of times mutex object is locked.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_RELEASED_DISABLE))
+extern void EvrRtxMutexReleased (osMutexId_t mutex_id, uint32_t lock);
+#else
+#define EvrRtxMutexReleased(mutex_id, lock)
+#endif
+
+/**
+ \brief Event on mutex owner retrieve (API)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+ \param[in] thread_id thread ID obtained by \ref osThreadNew or \ref osThreadGetId.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_GET_OWNER_DISABLE))
+extern void EvrRtxMutexGetOwner (osMutexId_t mutex_id, osThreadId_t thread_id);
+#else
+#define EvrRtxMutexGetOwner(mutex_id, thread_id)
+#endif
+
+/**
+ \brief Event on mutex delete (API)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_DELETE_DISABLE))
+extern void EvrRtxMutexDelete (osMutexId_t mutex_id);
+#else
+#define EvrRtxMutexDelete(mutex_id)
+#endif
+
+/**
+ \brief Event on successful mutex delete (Op)
+ \param[in] mutex_id mutex ID obtained by \ref osMutexNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MUTEX != 0) && !defined(EVR_RTX_MUTEX_DESTROYED_DISABLE))
+extern void EvrRtxMutexDestroyed (osMutexId_t mutex_id);
+#else
+#define EvrRtxMutexDestroyed(mutex_id)
+#endif
+
+
+// ==== Semaphore Events ====
+
+/**
+ \brief Event on semaphore error (Error)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew or NULL when ID is unknown.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_ERROR_DISABLE))
+extern void EvrRtxSemaphoreError (osSemaphoreId_t semaphore_id, int32_t status);
+#else
+#define EvrRtxSemaphoreError(semaphore_id, status)
+#endif
+
+/**
+ \brief Event on semaphore create and initialize (API)
+ \param[in] max_count maximum number of available tokens.
+ \param[in] initial_count initial number of available tokens.
+ \param[in] attr semaphore attributes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_NEW_DISABLE))
+extern void EvrRtxSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr);
+#else
+#define EvrRtxSemaphoreNew(max_count, initial_count, attr)
+#endif
+
+/**
+ \brief Event on successful semaphore create (Op)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+ \param[in] name pointer to semaphore object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_CREATED_DISABLE))
+extern void EvrRtxSemaphoreCreated (osSemaphoreId_t semaphore_id, const char *name);
+#else
+#define EvrRtxSemaphoreCreated(semaphore_id, name)
+#endif
+
+/**
+ \brief Event on semaphore name retrieve (API)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+ \param[in] name pointer to semaphore object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_GET_NAME_DISABLE))
+extern void EvrRtxSemaphoreGetName (osSemaphoreId_t semaphore_id, const char *name);
+#else
+#define EvrRtxSemaphoreGetName(semaphore_id, name)
+#endif
+
+/**
+ \brief Event on semaphore acquire (API)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_ACQUIRE_DISABLE))
+extern void EvrRtxSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeout);
+#else
+#define EvrRtxSemaphoreAcquire(semaphore_id, timeout)
+#endif
+
+/**
+ \brief Event on pending semaphore acquire (Op)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_ACQUIRE_PENDING_DISABLE))
+extern void EvrRtxSemaphoreAcquirePending (osSemaphoreId_t semaphore_id, uint32_t timeout);
+#else
+#define EvrRtxSemaphoreAcquirePending(semaphore_id, timeout);
+#endif
+
+/**
+ \brief Event on semaphore acquire timeout (Op)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_ACQUIRE_TIMEOUT_DISABLE))
+extern void EvrRtxSemaphoreAcquireTimeout (osSemaphoreId_t semaphore_id);
+#else
+#define EvrRtxSemaphoreAcquireTimeout(semaphore_id)
+#endif
+
+/**
+ \brief Event on successful semaphore acquire (Op)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+ \param[in] tokens number of available tokens.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_ACQUIRED_DISABLE))
+extern void EvrRtxSemaphoreAcquired (osSemaphoreId_t semaphore_id, uint32_t tokens);
+#else
+#define EvrRtxSemaphoreAcquired(semaphore_id, tokens)
+#endif
+
+/**
+ \brief Event on unsuccessful semaphore acquire (Op)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_NOT_ACQUIRED_DISABLE))
+extern void EvrRtxSemaphoreNotAcquired (osSemaphoreId_t semaphore_id);
+#else
+#define EvrRtxSemaphoreNotAcquired(semaphore_id)
+#endif
+
+/**
+ \brief Event on semaphore release (API)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_RELEASE_DISABLE))
+extern void EvrRtxSemaphoreRelease (osSemaphoreId_t semaphore_id);
+#else
+#define EvrRtxSemaphoreRelease(semaphore_id)
+#endif
+
+/**
+ \brief Event on successful semaphore release (Op)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+ \param[in] tokens number of available tokens.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_RELEASED_DISABLE))
+extern void EvrRtxSemaphoreReleased (osSemaphoreId_t semaphore_id, uint32_t tokens);
+#else
+#define EvrRtxSemaphoreReleased(semaphore_id, tokens)
+#endif
+
+/**
+ \brief Event on semaphore token count retrieval (API)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+ \param[in] count current number of available tokens.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_GET_COUNT_DISABLE))
+extern void EvrRtxSemaphoreGetCount (osSemaphoreId_t semaphore_id, uint32_t count);
+#else
+#define EvrRtxSemaphoreGetCount(semaphore_id, count)
+#endif
+
+/**
+ \brief Event on semaphore delete (API)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_DELETE_DISABLE))
+extern void EvrRtxSemaphoreDelete (osSemaphoreId_t semaphore_id);
+#else
+#define EvrRtxSemaphoreDelete(semaphore_id)
+#endif
+
+/**
+ \brief Event on successful semaphore delete (Op)
+ \param[in] semaphore_id semaphore ID obtained by \ref osSemaphoreNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_SEMAPHORE != 0) && !defined(EVR_RTX_SEMAPHORE_DESTROYED_DISABLE))
+extern void EvrRtxSemaphoreDestroyed (osSemaphoreId_t semaphore_id);
+#else
+#define EvrRtxSemaphoreDestroyed(semaphore_id)
+#endif
+
+
+// ==== Memory Pool Events ====
+
+/**
+ \brief Event on memory pool error (Error)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew or NULL when ID is unknown.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_ERROR_DISABLE))
+extern void EvrRtxMemoryPoolError (osMemoryPoolId_t mp_id, int32_t status);
+#else
+#define EvrRtxMemoryPoolError(mp_id, status)
+#endif
+
+/**
+ \brief Event on memory pool create and initialize (API)
+ \param[in] block_count maximum number of memory blocks in memory pool.
+ \param[in] block_size memory block size in bytes.
+ \param[in] attr memory pool attributes; NULL: default values.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_NEW_DISABLE))
+extern void EvrRtxMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr);
+#else
+#define EvrRtxMemoryPoolNew(block_count, block_size, attr)
+#endif
+
+/**
+ \brief Event on successful memory pool create (Op)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] name pointer to memory pool object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_CREATED_DISABLE))
+extern void EvrRtxMemoryPoolCreated (osMemoryPoolId_t mp_id, const char *name);
+#else
+#define EvrRtxMemoryPoolCreated(mp_id, name)
+#endif
+
+/**
+ \brief Event on memory pool name retrieve (API)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] name pointer to memory pool object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_GET_NAME_DISABLE))
+extern void EvrRtxMemoryPoolGetName (osMemoryPoolId_t mp_id, const char *name);
+#else
+#define EvrRtxMemoryPoolGetName(mp_id, name)
+#endif
+
+/**
+ \brief Event on memory pool allocation (API)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_ALLOC_DISABLE))
+extern void EvrRtxMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout);
+#else
+#define EvrRtxMemoryPoolAlloc(mp_id, timeout)
+#endif
+
+/**
+ \brief Event on pending memory pool allocation (Op)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_ALLOC_PENDING_DISABLE))
+extern void EvrRtxMemoryPoolAllocPending (osMemoryPoolId_t mp_id, uint32_t timeout);
+#else
+#define EvrRtxMemoryPoolAllocPending(mp_id, timeout)
+#endif
+
+/**
+ \brief Event on memory pool allocation timeout (Op)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_ALLOC_TIMEOUT_DISABLE))
+extern void EvrRtxMemoryPoolAllocTimeout (osMemoryPoolId_t mp_id);
+#else
+#define EvrRtxMemoryPoolAllocTimeout(mp_id)
+#endif
+
+/**
+ \brief Event on successful memory pool allocation (Op)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] block address of the allocated memory block.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_ALLOCATED_DISABLE))
+extern void EvrRtxMemoryPoolAllocated (osMemoryPoolId_t mp_id, void *block);
+#else
+#define EvrRtxMemoryPoolAllocated(mp_id, block)
+#endif
+
+/**
+ \brief Event on unsuccessful memory pool allocation (Op)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_ALLOC_FAILED_DISABLE))
+extern void EvrRtxMemoryPoolAllocFailed (osMemoryPoolId_t mp_id);
+#else
+#define EvrRtxMemoryPoolAllocFailed(mp_id)
+#endif
+
+/**
+ \brief Event on memory pool free (API)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] block address of the allocated memory block to be returned to the memory pool.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_FREE_DISABLE))
+extern void EvrRtxMemoryPoolFree (osMemoryPoolId_t mp_id, void *block);
+#else
+#define EvrRtxMemoryPoolFree(mp_id, block)
+#endif
+
+/**
+ \brief Event on successful memory pool free (Op)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] block address of the allocated memory block to be returned to the memory pool.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_DEALLOCATED_DISABLE))
+extern void EvrRtxMemoryPoolDeallocated (osMemoryPoolId_t mp_id, void *block);
+#else
+#define EvrRtxMemoryPoolDeallocated(mp_id, block)
+#endif
+
+/**
+ \brief Event on unsuccessful memory pool free (Op)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] block address of the allocated memory block to be returned to the memory pool.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_FREE_FAILED_DISABLE))
+extern void EvrRtxMemoryPoolFreeFailed (osMemoryPoolId_t mp_id, void *block);
+#else
+#define EvrRtxMemoryPoolFreeFailed(mp_id, block)
+#endif
+
+/**
+ \brief Event on memory pool capacity retrieve (API)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] capacity maximum number of memory blocks.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_GET_CAPACITY_DISABLE))
+extern void EvrRtxMemoryPoolGetCapacity (osMemoryPoolId_t mp_id, uint32_t capacity);
+#else
+#define EvrRtxMemoryPoolGetCapacity(mp_id, capacity)
+#endif
+
+/**
+ \brief Event on memory pool block size retrieve (API)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] block_size memory block size in bytes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_GET_BLOCK_SZIE_DISABLE))
+extern void EvrRtxMemoryPoolGetBlockSize (osMemoryPoolId_t mp_id, uint32_t block_size);
+#else
+#define EvrRtxMemoryPoolGetBlockSize(mp_id, block_size)
+#endif
+
+/**
+ \brief Event on used memory pool blocks retrieve (API)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] count number of memory blocks used.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_GET_COUNT_DISABLE))
+extern void EvrRtxMemoryPoolGetCount (osMemoryPoolId_t mp_id, uint32_t count);
+#else
+#define EvrRtxMemoryPoolGetCount(mp_id, count)
+#endif
+
+/**
+ \brief Event on available memory pool blocks retrieve (API)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+ \param[in] space number of memory blocks available.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_GET_SPACE_DISABLE))
+extern void EvrRtxMemoryPoolGetSpace (osMemoryPoolId_t mp_id, uint32_t space);
+#else
+#define EvrRtxMemoryPoolGetSpace(mp_id, space)
+#endif
+
+/**
+ \brief Event on memory pool delete (API)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_DELETE_DISABLE))
+extern void EvrRtxMemoryPoolDelete (osMemoryPoolId_t mp_id);
+#else
+#define EvrRtxMemoryPoolDelete(mp_id)
+#endif
+
+/**
+ \brief Event on successful memory pool delete (Op)
+ \param[in] mp_id memory pool ID obtained by \ref osMemoryPoolNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MEMPOOL != 0) && !defined(EVR_RTX_MEMORY_POOL_DESTROYED_DISABLE))
+extern void EvrRtxMemoryPoolDestroyed (osMemoryPoolId_t mp_id);
+#else
+#define EvrRtxMemoryPoolDestroyed(mp_id)
+#endif
+
+
+// ==== Message Queue Events ====
+
+/**
+ \brief Event on message queue error (Error)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew or NULL when ID is unknown.
+ \param[in] status extended execution status.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_ERROR_DISABLE))
+extern void EvrRtxMessageQueueError (osMessageQueueId_t mq_id, int32_t status);
+#else
+#define EvrRtxMessageQueueError(mq_id, status)
+#endif
+
+/**
+ \brief Event on message queue create and initialization (API)
+ \param[in] msg_count maximum number of messages in queue.
+ \param[in] msg_size maximum message size in bytes.
+ \param[in] attr message queue attributes; NULL: default values.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_NEW_DISABLE))
+extern void EvrRtxMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr);
+#else
+#define EvrRtxMessageQueueNew(msg_count, msg_size, attr)
+#endif
+
+/**
+ \brief Event on successful message queue create (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] name pointer to message queue object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_CREATED_DISABLE))
+extern void EvrRtxMessageQueueCreated (osMessageQueueId_t mq_id, const char *name);
+#else
+#define EvrRtxMessageQueueCreated(mq_id, name)
+#endif
+
+/**
+ \brief Event on message queue name retrieve(API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] name pointer to message queue object name.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_NAME_DISABLE))
+extern void EvrRtxMessageQueueGetName (osMessageQueueId_t mq_id, const char *name);
+#else
+#define EvrRtxMessageQueueGetName(mq_id, name)
+#endif
+
+/**
+ \brief Event on message put (API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer with message to put into a queue.
+ \param[in] msg_prio message priority.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_PUT_DISABLE))
+extern void EvrRtxMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr, uint8_t msg_prio, uint32_t timeout);
+#else
+#define EvrRtxMessageQueuePut(mq_id, msg_ptr, msg_prio, timeout)
+#endif
+
+/**
+ \brief Event on pending message put (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer with message to put into a queue.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_PUT_PENDING_DISABLE))
+extern void EvrRtxMessageQueuePutPending (osMessageQueueId_t mq_id, const void *msg_ptr, uint32_t timeout);
+#else
+#define EvrRtxMessageQueuePutPending(mq_id, msg_ptr, timeout)
+#endif
+
+/**
+ \brief Event on message put timeout (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_PUT_TIMEOUT_DISABLE))
+extern void EvrRtxMessageQueuePutTimeout (osMessageQueueId_t mq_id);
+#else
+#define EvrRtxMessageQueuePutTimeout(mq_id)
+#endif
+
+/**
+ \brief Event on pending message insert (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer with message to put into a queue.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_INSERT_PENDING_DISABLE))
+extern void EvrRtxMessageQueueInsertPending (osMessageQueueId_t mq_id, const void *msg_ptr);
+#else
+#define EvrRtxMessageQueueInsertPending(mq_id, msg_ptr)
+#endif
+
+/**
+ \brief Event on successful message insert (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer with message to put into a queue.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_INSERTED_DISABLE))
+extern void EvrRtxMessageQueueInserted (osMessageQueueId_t mq_id, const void *msg_ptr);
+#else
+#define EvrRtxMessageQueueInserted(mq_id, msg_ptr)
+#endif
+
+/**
+ \brief Event on unsuccessful message insert (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer with message to put into a queue.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_NOT_INSERTED_DISABLE))
+extern void EvrRtxMessageQueueNotInserted (osMessageQueueId_t mq_id, const void *msg_ptr);
+#else
+#define EvrRtxMessageQueueNotInserted(mq_id, msg_ptr)
+#endif
+
+/**
+ \brief Event on message get (API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer for message to get from a queue.
+ \param[in] msg_prio message priority.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_DISABLE))
+extern void EvrRtxMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout);
+#else
+#define EvrRtxMessageQueueGet(mq_id, msg_ptr, msg_prio, timeout)
+#endif
+
+/**
+ \brief Event on pending message get (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer for message to get from a queue.
+ \param[in] timeout \ref CMSIS_RTOS_TimeOutValue or 0 in case of no time-out.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_PENDING_DISABLE))
+extern void EvrRtxMessageQueueGetPending (osMessageQueueId_t mq_id, void *msg_ptr, uint32_t timeout);
+#else
+#define EvrRtxMessageQueueGetPending(mq_id, msg_ptr, timeout)
+#endif
+
+/**
+ \brief Event on message get timeout (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_TIMEOUT_DISABLE))
+extern void EvrRtxMessageQueueGetTimeout (osMessageQueueId_t mq_id);
+#else
+#define EvrRtxMessageQueueGetTimeout(mq_id)
+#endif
+
+/**
+ \brief Event on successful message get (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer for message to get from a queue.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_RETRIEVED_DISABLE))
+extern void EvrRtxMessageQueueRetrieved (osMessageQueueId_t mq_id, void *msg_ptr);
+#else
+#define EvrRtxMessageQueueRetrieved(mq_id, msg_ptr)
+#endif
+
+/**
+ \brief Event on unsuccessful message get (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_ptr pointer to buffer for message to get from a queue.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_NOT_RETRIEVED_DISABLE))
+extern void EvrRtxMessageQueueNotRetrieved (osMessageQueueId_t mq_id, void *msg_ptr);
+#else
+#define EvrRtxMessageQueueNotRetrieved(mq_id, msg_ptr)
+#endif
+
+/**
+ \brief Event on message queue capacity retrieve (API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] capacity maximum number of messages.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_CAPACITY_DISABLE))
+extern void EvrRtxMessageQueueGetCapacity (osMessageQueueId_t mq_id, uint32_t capacity);
+#else
+#define EvrRtxMessageQueueGetCapacity(mq_id, capacity)
+#endif
+
+/**
+ \brief Event on message queue message size retrieve (API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] msg_size maximum message size in bytes.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_MSG_SIZE_DISABLE))
+extern void EvrRtxMessageQueueGetMsgSize (osMessageQueueId_t mq_id, uint32_t msg_size);
+#else
+#define EvrRtxMessageQueueGetMsgSize(mq_id, msg_size)
+#endif
+
+/**
+ \brief Event on message queue message count retrieve (API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] count number of queued messages.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_COUNT_DISABLE))
+extern void EvrRtxMessageQueueGetCount (osMessageQueueId_t mq_id, uint32_t count);
+#else
+#define EvrRtxMessageQueueGetCount(mq_id, count)
+#endif
+
+/**
+ \brief Event on message queue message slots retrieve (API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+ \param[in] space number of available slots for messages.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_GET_SPACE_DISABLE))
+extern void EvrRtxMessageQueueGetSpace (osMessageQueueId_t mq_id, uint32_t space);
+#else
+#define EvrRtxMessageQueueGetSpace(mq_id, space)
+#endif
+
+/**
+ \brief Event on message queue reset (API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_RESET_DISABLE))
+extern void EvrRtxMessageQueueReset (osMessageQueueId_t mq_id);
+#else
+#define EvrRtxMessageQueueReset(mq_id)
+#endif
+
+/**
+ \brief Event on successful message queue reset (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_RESET_DONE_DISABLE))
+extern void EvrRtxMessageQueueResetDone (osMessageQueueId_t mq_id);
+#else
+#define EvrRtxMessageQueueResetDone(mq_id)
+#endif
+
+/**
+ \brief Event on message queue delete (API)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_DELETE_DISABLE))
+extern void EvrRtxMessageQueueDelete (osMessageQueueId_t mq_id);
+#else
+#define EvrRtxMessageQueueDelete(mq_id)
+#endif
+
+/**
+ \brief Event on successful message queue delete (Op)
+ \param[in] mq_id message queue ID obtained by \ref osMessageQueueNew.
+*/
+#if (!defined(EVR_RTX_DISABLE) && (OS_EVR_MSGQUEUE != 0) && !defined(EVR_RTX_MESSAGE_QUEUE_DESTROYED_DISABLE))
+extern void EvrRtxMessageQueueDestroyed (osMessageQueueId_t mq_id);
+#else
+#define EvrRtxMessageQueueDestroyed(mq_id)
+#endif
+
+
+#endif // RTX_EVR_H_
diff --git a/app_broker/CMSIS/RTOS2/RTX/Include/rtx_os.h b/app_broker/CMSIS/RTOS2/RTX/Include/rtx_os.h
new file mode 100644
index 0000000..2b348cc
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Include/rtx_os.h
@@ -0,0 +1,472 @@
+/*
+ * Copyright (c) 2013-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Project: CMSIS-RTOS RTX
+ * Title: RTX OS definitions
+ *
+ * -----------------------------------------------------------------------------
+ */
+
+#ifndef RTX_OS_H_
+#define RTX_OS_H_
+
+#include <stdint.h>
+#include <stddef.h>
+#include "cmsis_os2.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+/// Kernel Information
+#define osRtxVersionAPI 20010003 ///< API version (2.1.3)
+#define osRtxVersionKernel 50050000 ///< Kernel version (5.5.0)
+#define osRtxKernelId "RTX V5.5.0" ///< Kernel identification string
+
+
+// ==== Common definitions ====
+
+/// Object Identifier definitions
+#define osRtxIdInvalid 0x00U
+#define osRtxIdThread 0xF1U
+#define osRtxIdTimer 0xF2U
+#define osRtxIdEventFlags 0xF3U
+#define osRtxIdMutex 0xF5U
+#define osRtxIdSemaphore 0xF6U
+#define osRtxIdMemoryPool 0xF7U
+#define osRtxIdMessage 0xF9U
+#define osRtxIdMessageQueue 0xFAU
+
+/// Object Flags definitions
+#define osRtxFlagSystemObject 0x01U
+#define osRtxFlagSystemMemory 0x02U
+
+
+// ==== Kernel definitions ====
+
+/// Kernel State definitions
+#define osRtxKernelInactive ((uint8_t)osKernelInactive)
+#define osRtxKernelReady ((uint8_t)osKernelReady)
+#define osRtxKernelRunning ((uint8_t)osKernelRunning)
+#define osRtxKernelLocked ((uint8_t)osKernelLocked)
+#define osRtxKernelSuspended ((uint8_t)osKernelSuspended)
+
+
+// ==== Thread definitions ====
+
+/// Thread State definitions (extending osThreadState)
+#define osRtxThreadStateMask 0x0FU
+
+#define osRtxThreadInactive ((uint8_t)osThreadInactive)
+#define osRtxThreadReady ((uint8_t)osThreadReady)
+#define osRtxThreadRunning ((uint8_t)osThreadRunning)
+#define osRtxThreadBlocked ((uint8_t)osThreadBlocked)
+#define osRtxThreadTerminated ((uint8_t)osThreadTerminated)
+
+#define osRtxThreadWaitingDelay ((uint8_t)(osRtxThreadBlocked | 0x10U))
+#define osRtxThreadWaitingJoin ((uint8_t)(osRtxThreadBlocked | 0x20U))
+#define osRtxThreadWaitingThreadFlags ((uint8_t)(osRtxThreadBlocked | 0x30U))
+#define osRtxThreadWaitingEventFlags ((uint8_t)(osRtxThreadBlocked | 0x40U))
+#define osRtxThreadWaitingMutex ((uint8_t)(osRtxThreadBlocked | 0x50U))
+#define osRtxThreadWaitingSemaphore ((uint8_t)(osRtxThreadBlocked | 0x60U))
+#define osRtxThreadWaitingMemoryPool ((uint8_t)(osRtxThreadBlocked | 0x70U))
+#define osRtxThreadWaitingMessageGet ((uint8_t)(osRtxThreadBlocked | 0x80U))
+#define osRtxThreadWaitingMessagePut ((uint8_t)(osRtxThreadBlocked | 0x90U))
+
+/// Thread Flags definitions
+#define osRtxThreadFlagDefStack 0x10U ///< Default Stack flag
+
+/// Stack Marker definitions
+#define osRtxStackMagicWord 0xE25A2EA5U ///< Stack Magic Word (Stack Base)
+#define osRtxStackFillPattern 0xCCCCCCCCU ///< Stack Fill Pattern
+
+/// Thread Control Block
+typedef struct osRtxThread_s {
+ uint8_t id; ///< Object Identifier
+ uint8_t state; ///< Object State
+ uint8_t flags; ///< Object Flags
+ uint8_t attr; ///< Object Attributes
+ const char *name; ///< Object Name
+ struct osRtxThread_s *thread_next; ///< Link pointer to next Thread in Object list
+ struct osRtxThread_s *thread_prev; ///< Link pointer to previous Thread in Object list
+ struct osRtxThread_s *delay_next; ///< Link pointer to next Thread in Delay list
+ struct osRtxThread_s *delay_prev; ///< Link pointer to previous Thread in Delay list
+ struct osRtxThread_s *thread_join; ///< Thread waiting to Join
+ uint32_t delay; ///< Delay Time
+ int8_t priority; ///< Thread Priority
+ int8_t priority_base; ///< Base Priority
+ uint8_t stack_frame; ///< Stack Frame (EXC_RETURN[7..0])
+ uint8_t flags_options; ///< Thread/Event Flags Options
+ uint32_t wait_flags; ///< Waiting Thread/Event Flags
+ uint32_t thread_flags; ///< Thread Flags
+ struct osRtxMutex_s *mutex_list; ///< Link pointer to list of owned Mutexes
+ void *stack_mem; ///< Stack Memory
+ uint32_t stack_size; ///< Stack Size
+ uint32_t sp; ///< Current Stack Pointer
+ uint32_t thread_addr; ///< Thread entry address
+ uint32_t tz_memory; ///< TrustZone Memory Identifier
+#ifdef RTX_TF_M_EXTENSION
+ uint32_t tz_module; ///< TrustZone Module Identifier
+#endif
+} osRtxThread_t;
+
+
+// ==== Timer definitions ====
+
+/// Timer State definitions
+#define osRtxTimerInactive 0x00U ///< Timer Inactive
+#define osRtxTimerStopped 0x01U ///< Timer Stopped
+#define osRtxTimerRunning 0x02U ///< Timer Running
+
+/// Timer Type definitions
+#define osRtxTimerPeriodic ((uint8_t)osTimerPeriodic)
+
+/// Timer Function Information
+typedef struct {
+ osTimerFunc_t func; ///< Function Pointer
+ void *arg; ///< Function Argument
+} osRtxTimerFinfo_t;
+
+/// Timer Control Block
+typedef struct osRtxTimer_s {
+ uint8_t id; ///< Object Identifier
+ uint8_t state; ///< Object State
+ uint8_t flags; ///< Object Flags
+ uint8_t type; ///< Timer Type (Periodic/One-shot)
+ const char *name; ///< Object Name
+ struct osRtxTimer_s *prev; ///< Pointer to previous active Timer
+ struct osRtxTimer_s *next; ///< Pointer to next active Timer
+ uint32_t tick; ///< Timer current Tick
+ uint32_t load; ///< Timer Load value
+ osRtxTimerFinfo_t finfo; ///< Timer Function Info
+} osRtxTimer_t;
+
+
+// ==== Event Flags definitions ====
+
+/// Event Flags Control Block
+typedef struct {
+ uint8_t id; ///< Object Identifier
+ uint8_t reserved_state; ///< Object State (not used)
+ uint8_t flags; ///< Object Flags
+ uint8_t reserved;
+ const char *name; ///< Object Name
+ osRtxThread_t *thread_list; ///< Waiting Threads List
+ uint32_t event_flags; ///< Event Flags
+} osRtxEventFlags_t;
+
+
+// ==== Mutex definitions ====
+
+/// Mutex Control Block
+typedef struct osRtxMutex_s {
+ uint8_t id; ///< Object Identifier
+ uint8_t reserved_state; ///< Object State (not used)
+ uint8_t flags; ///< Object Flags
+ uint8_t attr; ///< Object Attributes
+ const char *name; ///< Object Name
+ osRtxThread_t *thread_list; ///< Waiting Threads List
+ osRtxThread_t *owner_thread; ///< Owner Thread
+ struct osRtxMutex_s *owner_prev; ///< Pointer to previous owned Mutex
+ struct osRtxMutex_s *owner_next; ///< Pointer to next owned Mutex
+ uint8_t lock; ///< Lock counter
+ uint8_t padding[3];
+} osRtxMutex_t;
+
+
+// ==== Semaphore definitions ====
+
+/// Semaphore Control Block
+typedef struct {
+ uint8_t id; ///< Object Identifier
+ uint8_t reserved_state; ///< Object State (not used)
+ uint8_t flags; ///< Object Flags
+ uint8_t reserved;
+ const char *name; ///< Object Name
+ osRtxThread_t *thread_list; ///< Waiting Threads List
+ uint16_t tokens; ///< Current number of tokens
+ uint16_t max_tokens; ///< Maximum number of tokens
+} osRtxSemaphore_t;
+
+
+// ==== Memory Pool definitions ====
+
+/// Memory Pool Information
+typedef struct {
+ uint32_t max_blocks; ///< Maximum number of Blocks
+ uint32_t used_blocks; ///< Number of used Blocks
+ uint32_t block_size; ///< Block Size
+ void *block_base; ///< Block Memory Base Address
+ void *block_lim; ///< Block Memory Limit Address
+ void *block_free; ///< First free Block Address
+} osRtxMpInfo_t;
+
+/// Memory Pool Control Block
+typedef struct {
+ uint8_t id; ///< Object Identifier
+ uint8_t reserved_state; ///< Object State (not used)
+ uint8_t flags; ///< Object Flags
+ uint8_t reserved;
+ const char *name; ///< Object Name
+ osRtxThread_t *thread_list; ///< Waiting Threads List
+ osRtxMpInfo_t mp_info; ///< Memory Pool Info
+} osRtxMemoryPool_t;
+
+
+// ==== Message Queue definitions ====
+
+/// Message Control Block
+typedef struct osRtxMessage_s {
+ uint8_t id; ///< Object Identifier
+ uint8_t reserved_state; ///< Object State (not used)
+ uint8_t flags; ///< Object Flags
+ uint8_t priority; ///< Message Priority
+ struct osRtxMessage_s *prev; ///< Pointer to previous Message
+ struct osRtxMessage_s *next; ///< Pointer to next Message
+} osRtxMessage_t;
+
+/// Message Queue Control Block
+typedef struct {
+ uint8_t id; ///< Object Identifier
+ uint8_t reserved_state; ///< Object State (not used)
+ uint8_t flags; ///< Object Flags
+ uint8_t reserved;
+ const char *name; ///< Object Name
+ osRtxThread_t *thread_list; ///< Waiting Threads List
+ osRtxMpInfo_t mp_info; ///< Memory Pool Info
+ uint32_t msg_size; ///< Message Size
+ uint32_t msg_count; ///< Number of queued Messages
+ osRtxMessage_t *msg_first; ///< Pointer to first Message
+ osRtxMessage_t *msg_last; ///< Pointer to last Message
+} osRtxMessageQueue_t;
+
+
+// ==== Generic Object definitions ====
+
+/// Generic Object Control Block
+typedef struct {
+ uint8_t id; ///< Object Identifier
+ uint8_t state; ///< Object State
+ uint8_t flags; ///< Object Flags
+ uint8_t reserved;
+ const char *name; ///< Object Name
+ osRtxThread_t *thread_list; ///< Threads List
+} osRtxObject_t;
+
+
+// ==== OS Runtime Information definitions ====
+
+/// OS Runtime Information structure
+typedef struct {
+ const char *os_id; ///< OS Identification
+ uint32_t version; ///< OS Version
+ struct { ///< Kernel Info
+ uint8_t state; ///< State
+ volatile uint8_t blocked; ///< Blocked
+ uint8_t pendSV; ///< Pending SV
+ uint8_t reserved;
+ uint32_t tick; ///< Tick counter
+ } kernel;
+ int32_t tick_irqn; ///< Tick Timer IRQ Number
+ struct { ///< Thread Info
+ struct { ///< Thread Run Info
+ osRtxThread_t *curr; ///< Current running Thread
+ osRtxThread_t *next; ///< Next Thread to Run
+ } run;
+ osRtxObject_t ready; ///< Ready List Object
+ osRtxThread_t *idle; ///< Idle Thread
+ osRtxThread_t *delay_list; ///< Delay List
+ osRtxThread_t *wait_list; ///< Wait List (no Timeout)
+ osRtxThread_t *terminate_list; ///< Terminate Thread List
+ struct { ///< Thread Round Robin Info
+ osRtxThread_t *thread; ///< Round Robin Thread
+ uint32_t tick; ///< Round Robin Time Tick
+ uint32_t timeout; ///< Round Robin Timeout
+ } robin;
+ } thread;
+ struct { ///< Timer Info
+ osRtxTimer_t *list; ///< Active Timer List
+ osRtxThread_t *thread; ///< Timer Thread
+ osRtxMessageQueue_t *mq; ///< Timer Message Queue
+ void (*tick)(void); ///< Timer Tick Function
+ } timer;
+ struct { ///< ISR Post Processing Queue
+ uint16_t max; ///< Maximum Items
+ uint16_t cnt; ///< Item Count
+ uint16_t in; ///< Incoming Item Index
+ uint16_t out; ///< Outgoing Item Index
+ void **data; ///< Queue Data
+ } isr_queue;
+ struct { ///< ISR Post Processing functions
+ void (*thread)(osRtxThread_t*); ///< Thread Post Processing function
+ void (*event_flags)(osRtxEventFlags_t*); ///< Event Flags Post Processing function
+ void (*semaphore)(osRtxSemaphore_t*); ///< Semaphore Post Processing function
+ void (*memory_pool)(osRtxMemoryPool_t*); ///< Memory Pool Post Processing function
+ void (*message)(osRtxMessage_t*); ///< Message Post Processing function
+ } post_process;
+ struct { ///< Memory Pools (Variable Block Size)
+ void *stack; ///< Stack Memory
+ void *mp_data; ///< Memory Pool Data Memory
+ void *mq_data; ///< Message Queue Data Memory
+ void *common; ///< Common Memory
+ } mem;
+ struct { ///< Memory Pools (Fixed Block Size)
+ osRtxMpInfo_t *stack; ///< Stack for Threads
+ osRtxMpInfo_t *thread; ///< Thread Control Blocks
+ osRtxMpInfo_t *timer; ///< Timer Control Blocks
+ osRtxMpInfo_t *event_flags; ///< Event Flags Control Blocks
+ osRtxMpInfo_t *mutex; ///< Mutex Control Blocks
+ osRtxMpInfo_t *semaphore; ///< Semaphore Control Blocks
+ osRtxMpInfo_t *memory_pool; ///< Memory Pool Control Blocks
+ osRtxMpInfo_t *message_queue; ///< Message Queue Control Blocks
+ } mpi;
+} osRtxInfo_t;
+
+extern osRtxInfo_t osRtxInfo; ///< OS Runtime Information
+
+/// OS Runtime Object Memory Usage structure
+typedef struct {
+ uint32_t cnt_alloc; ///< Counter for alloc
+ uint32_t cnt_free; ///< Counter for free
+ uint32_t max_used; ///< Maximum used
+} osRtxObjectMemUsage_t;
+
+/// OS Runtime Object Memory Usage variables
+extern osRtxObjectMemUsage_t osRtxThreadMemUsage;
+extern osRtxObjectMemUsage_t osRtxTimerMemUsage;
+extern osRtxObjectMemUsage_t osRtxEventFlagsMemUsage;
+extern osRtxObjectMemUsage_t osRtxMutexMemUsage;
+extern osRtxObjectMemUsage_t osRtxSemaphoreMemUsage;
+extern osRtxObjectMemUsage_t osRtxMemoryPoolMemUsage;
+extern osRtxObjectMemUsage_t osRtxMessageQueueMemUsage;
+
+
+// ==== OS API definitions ====
+
+// Object Limits definitions
+#define osRtxThreadFlagsLimit 31U ///< number of Thread Flags available per thread
+#define osRtxEventFlagsLimit 31U ///< number of Event Flags available per object
+#define osRtxMutexLockLimit 255U ///< maximum number of recursive mutex locks
+#define osRtxSemaphoreTokenLimit 65535U ///< maximum number of tokens per semaphore
+
+// Control Block sizes
+#define osRtxThreadCbSize sizeof(osRtxThread_t)
+#define osRtxTimerCbSize sizeof(osRtxTimer_t)
+#define osRtxEventFlagsCbSize sizeof(osRtxEventFlags_t)
+#define osRtxMutexCbSize sizeof(osRtxMutex_t)
+#define osRtxSemaphoreCbSize sizeof(osRtxSemaphore_t)
+#define osRtxMemoryPoolCbSize sizeof(osRtxMemoryPool_t)
+#define osRtxMessageQueueCbSize sizeof(osRtxMessageQueue_t)
+
+/// Memory size in bytes for Memory Pool storage.
+/// \param block_count maximum number of memory blocks in memory pool.
+/// \param block_size memory block size in bytes.
+#define osRtxMemoryPoolMemSize(block_count, block_size) \
+ (4*(block_count)*(((block_size)+3)/4))
+
+/// Memory size in bytes for Message Queue storage.
+/// \param msg_count maximum number of messages in queue.
+/// \param msg_size maximum message size in bytes.
+#define osRtxMessageQueueMemSize(msg_count, msg_size) \
+ (4*(msg_count)*(3+(((msg_size)+3)/4)))
+
+
+// ==== OS External Functions ====
+
+// OS Error Codes
+#define osRtxErrorStackUnderflow 1U ///< Stack overflow, i.e. stack pointer below its lower memory limit for descending stacks.
+#define osRtxErrorISRQueueOverflow 2U ///< ISR Queue overflow detected when inserting object.
+#define osRtxErrorTimerQueueOverflow 3U ///< User Timer Callback Queue overflow detected for timer.
+#define osRtxErrorClibSpace 4U ///< Standard C/C++ library libspace not available: increase \c OS_THREAD_LIBSPACE_NUM.
+#define osRtxErrorClibMutex 5U ///< Standard C/C++ library mutex initialization failed.
+
+/// OS Error Callback function
+extern uint32_t osRtxErrorNotify (uint32_t code, void *object_id);
+
+/// OS Idle Thread
+extern void osRtxIdleThread (void *argument);
+
+/// OS Exception handlers
+extern void SVC_Handler (void);
+extern void PendSV_Handler (void);
+extern void SysTick_Handler (void);
+
+/// OS Trusted Firmware M Extension
+#ifdef RTX_TF_M_EXTENSION
+extern uint32_t osRtxTzGetModuleId (void);
+#endif
+
+
+// ==== OS External Configuration ====
+
+/// OS Configuration flags
+#define osRtxConfigPrivilegedMode (1UL<<0) ///< Threads in Privileged mode
+#define osRtxConfigStackCheck (1UL<<1) ///< Stack overrun checking
+#define osRtxConfigStackWatermark (1UL<<2) ///< Stack usage Watermark
+
+/// OS Configuration structure
+typedef struct {
+ uint32_t flags; ///< OS Configuration Flags
+ uint32_t tick_freq; ///< Kernel Tick Frequency
+ uint32_t robin_timeout; ///< Round Robin Timeout Tick
+ struct { ///< ISR Post Processing Queue
+ void **data; ///< Queue Data
+ uint16_t max; ///< Maximum Items
+ uint16_t padding;
+ } isr_queue;
+ struct { ///< Memory Pools (Variable Block Size)
+ void *stack_addr; ///< Stack Memory Address
+ uint32_t stack_size; ///< Stack Memory Size
+ void *mp_data_addr; ///< Memory Pool Memory Address
+ uint32_t mp_data_size; ///< Memory Pool Memory Size
+ void *mq_data_addr; ///< Message Queue Data Memory Address
+ uint32_t mq_data_size; ///< Message Queue Data Memory Size
+ void *common_addr; ///< Common Memory Address
+ uint32_t common_size; ///< Common Memory Size
+ } mem;
+ struct { ///< Memory Pools (Fixed Block Size)
+ osRtxMpInfo_t *stack; ///< Stack for Threads
+ osRtxMpInfo_t *thread; ///< Thread Control Blocks
+ osRtxMpInfo_t *timer; ///< Timer Control Blocks
+ osRtxMpInfo_t *event_flags; ///< Event Flags Control Blocks
+ osRtxMpInfo_t *mutex; ///< Mutex Control Blocks
+ osRtxMpInfo_t *semaphore; ///< Semaphore Control Blocks
+ osRtxMpInfo_t *memory_pool; ///< Memory Pool Control Blocks
+ osRtxMpInfo_t *message_queue; ///< Message Queue Control Blocks
+ } mpi;
+ uint32_t thread_stack_size; ///< Default Thread Stack Size
+ const
+ osThreadAttr_t *idle_thread_attr; ///< Idle Thread Attributes
+ const
+ osThreadAttr_t *timer_thread_attr; ///< Timer Thread Attributes
+ const
+ osMessageQueueAttr_t *timer_mq_attr; ///< Timer Message Queue Attributes
+ uint32_t timer_mq_mcnt; ///< Timer Message Queue maximum Messages
+} osRtxConfig_t;
+
+extern const osRtxConfig_t osRtxConfig; ///< OS Configuration
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // RTX_OS_H_
diff --git a/app_broker/CMSIS/RTOS2/RTX/Include/tz_context.h b/app_broker/CMSIS/RTOS2/RTX/Include/tz_context.h
new file mode 100644
index 0000000..cd6d8ab
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Include/tz_context.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015-2016 ARM Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * ----------------------------------------------------------------------------
+ *
+ * $Date: 21. September 2016
+ * $Revision: V1.0
+ *
+ * Project: TrustZone for ARMv8-M
+ * Title: Context Management for ARMv8-M TrustZone
+ *
+ * Version 1.0
+ * Initial Release
+ *---------------------------------------------------------------------------*/
+
+#ifndef TZ_CONTEXT_H
+#define TZ_CONTEXT_H
+
+#include <stdint.h>
+
+#ifndef TZ_MODULEID_T
+#define TZ_MODULEID_T
+/// \details Data type that identifies secure software modules called by a process.
+typedef uint32_t TZ_ModuleId_t;
+#endif
+
+/// \details TZ Memory ID identifies an allocated memory slot.
+typedef uint32_t TZ_MemoryId_t;
+
+/// Initialize secure context memory system
+/// \return execution status (1: success, 0: error)
+uint32_t TZ_InitContextSystem_S (void);
+
+/// Allocate context memory for calling secure software modules in TrustZone
+/// \param[in] module identifies software modules called from non-secure mode
+/// \return value != 0 id TrustZone memory slot identifier
+/// \return value 0 no memory available or internal error
+TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
+
+/// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
+/// \param[in] id TrustZone memory slot identifier
+/// \return execution status (1: success, 0: error)
+uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
+
+/// Load secure context (called on RTOS thread context switch)
+/// \param[in] id TrustZone memory slot identifier
+/// \return execution status (1: success, 0: error)
+uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
+
+/// Store secure context (called on RTOS thread context switch)
+/// \param[in] id TrustZone memory slot identifier
+/// \return execution status (1: success, 0: error)
+uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
+
+#endif // TZ_CONTEXT_H
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM0.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM0.lib
new file mode 100644
index 0000000..9ef5797
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM0.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM3.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM3.lib
new file mode 100644
index 0000000..fc46aa4
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM3.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM4F.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM4F.lib
new file mode 100644
index 0000000..0e12dc9
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_CM4F.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MB.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MB.lib
new file mode 100644
index 0000000..899642c
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MB.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MBN.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MBN.lib
new file mode 100644
index 0000000..318dc0d
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MBN.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MM.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MM.lib
new file mode 100644
index 0000000..ddb1042
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MM.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMF.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMF.lib
new file mode 100644
index 0000000..5a61f40
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMF.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMFN.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMFN.lib
new file mode 100644
index 0000000..de8c6cf
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMFN.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib
new file mode 100644
index 0000000..9e99e4c
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/ARM/RTX_V8MMN.lib
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM0.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM0.a
new file mode 100644
index 0000000..ac2f09c
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM0.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM3.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM3.a
new file mode 100644
index 0000000..5352de2
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM3.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM4F.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM4F.a
new file mode 100644
index 0000000..58aa906
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_CM4F.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MB.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MB.a
new file mode 100644
index 0000000..087da47
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MB.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MBN.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MBN.a
new file mode 100644
index 0000000..8907f98
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MBN.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MM.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MM.a
new file mode 100644
index 0000000..4281030
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MM.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMF.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMF.a
new file mode 100644
index 0000000..ed4de5e
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMF.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMFN.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMFN.a
new file mode 100644
index 0000000..6f9d158
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMFN.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMN.a b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMN.a
new file mode 100644
index 0000000..27b1f23
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/GCC/libRTX_V8MMN.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM0.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM0.a
new file mode 100644
index 0000000..804cc6d
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM0.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM3.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM3.a
new file mode 100644
index 0000000..18a826a
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM3.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM4F.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM4F.a
new file mode 100644
index 0000000..07c4096
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_CM4F.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V81MMN.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V81MMN.a
new file mode 100644
index 0000000..0496401
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V81MMN.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MB.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MB.a
new file mode 100644
index 0000000..d8b5db9
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MB.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MBN.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MBN.a
new file mode 100644
index 0000000..f1a68db
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MBN.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MM.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MM.a
new file mode 100644
index 0000000..7959b1d
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MM.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMF.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMF.a
new file mode 100644
index 0000000..c9d84b1
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMF.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMFN.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMFN.a
new file mode 100644
index 0000000..2d8f67d
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMFN.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMN.a b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMN.a
new file mode 100644
index 0000000..85a9c17
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Library/IAR/RTX_V8MMN.a
Binary files differ
diff --git a/app_broker/CMSIS/RTOS2/RTX/Source/rtx_lib.c b/app_broker/CMSIS/RTOS2/RTX/Source/rtx_lib.c
new file mode 100644
index 0000000..257b0c1
--- /dev/null
+++ b/app_broker/CMSIS/RTOS2/RTX/Source/rtx_lib.c
@@ -0,0 +1,822 @@
+/*
+ * Copyright (c) 2013-2019 Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Project: CMSIS-RTOS RTX
+ * Title: RTX Library Configuration
+ *
+ * -----------------------------------------------------------------------------
+ */
+
+#include "cmsis_compiler.h"
+#include "RTX_Config.h"
+#include "rtx_os.h"
+
+#ifdef RTE_Compiler_EventRecorder
+#include "EventRecorder.h"
+#include "EventRecorderConf.h"
+#endif
+#include "rtx_evr.h"
+
+
+// System Configuration
+// ====================
+
+// Dynamic Memory
+#if (OS_DYNAMIC_MEM_SIZE != 0)
+#if ((OS_DYNAMIC_MEM_SIZE % 8) != 0)
+#error "Invalid Dynamic Memory size!"
+#endif
+static uint64_t os_mem[OS_DYNAMIC_MEM_SIZE/8] \
+__attribute__((section(".bss.os")));
+#endif
+
+// Kernel Tick Frequency
+#if (OS_TICK_FREQ < 1)
+#error "Invalid Kernel Tick Frequency!"
+#endif
+
+// ISR FIFO Queue
+#if (OS_ISR_FIFO_QUEUE < 4)
+#error "Invalid ISR FIFO Queue size!"
+#endif
+static void *os_isr_queue[OS_ISR_FIFO_QUEUE] \
+__attribute__((section(".bss.os")));
+
+
+// Thread Configuration
+// ====================
+
+#if (((OS_STACK_SIZE % 8) != 0) || (OS_STACK_SIZE < 72))
+#error "Invalid default Thread Stack size!"
+#endif
+
+#if (((OS_IDLE_THREAD_STACK_SIZE % 8) != 0) || (OS_IDLE_THREAD_STACK_SIZE < 72))
+#error "Invalid Idle Thread Stack size!"
+#endif
+
+
+#if (OS_THREAD_OBJ_MEM != 0)
+
+#if (OS_THREAD_NUM == 0)
+#error "Invalid number of user Threads!"
+#endif
+
+#if ((OS_THREAD_USER_STACK_SIZE != 0) && ((OS_THREAD_USER_STACK_SIZE % 8) != 0))
+#error "Invalid total Stack size!"
+#endif
+
+// Thread Control Blocks
+static osRtxThread_t os_thread_cb[OS_THREAD_NUM] \
+__attribute__((section(".bss.os.thread.cb")));
+
+// Thread Default Stack
+#if (OS_THREAD_DEF_STACK_NUM != 0)
+static uint64_t os_thread_def_stack[OS_THREAD_DEF_STACK_NUM*(OS_STACK_SIZE/8)] \
+__attribute__((section(".bss.os.thread.stack")));
+#endif
+
+// Memory Pool for Thread Control Blocks
+static osRtxMpInfo_t os_mpi_thread \
+__attribute__((section(".data.os.thread.mpi"))) =
+{ (uint32_t)OS_THREAD_NUM, 0U, (uint32_t)osRtxThreadCbSize, &os_thread_cb[0], NULL, NULL };
+
+// Memory Pool for Thread Default Stack
+#if (OS_THREAD_DEF_STACK_NUM != 0)
+static osRtxMpInfo_t os_mpi_def_stack \
+__attribute__((section(".data.os.thread.mpi"))) =
+{ (uint32_t)OS_THREAD_DEF_STACK_NUM, 0U, (uint32_t)OS_STACK_SIZE, &os_thread_def_stack[0], NULL, NULL };
+#endif
+
+// Memory Pool for Thread Stack
+#if (OS_THREAD_USER_STACK_SIZE != 0)
+static uint64_t os_thread_stack[2 + OS_THREAD_NUM + (OS_THREAD_USER_STACK_SIZE/8)] \
+__attribute__((section(".bss.os.thread.stack")));
+#endif
+
+#endif // (OS_THREAD_OBJ_MEM != 0)
+
+
+// Stack overrun checking
+#if (OS_STACK_CHECK == 0)
+// Override library function
+extern void osRtxThreadStackCheck (void);
+ void osRtxThreadStackCheck (void) {}
+#endif
+
+
+// Idle Thread Control Block
+static osRtxThread_t os_idle_thread_cb \
+__attribute__((section(".bss.os.thread.cb")));
+
+// Idle Thread Stack
+static uint64_t os_idle_thread_stack[OS_IDLE_THREAD_STACK_SIZE/8] \
+__attribute__((section(".bss.os.thread.stack")));
+
+// Idle Thread Attributes
+static const osThreadAttr_t os_idle_thread_attr = {
+#if defined(OS_IDLE_THREAD_NAME)
+ OS_IDLE_THREAD_NAME,
+#else
+ NULL,
+#endif
+ osThreadDetached,
+ &os_idle_thread_cb,
+ (uint32_t)sizeof(os_idle_thread_cb),
+ &os_idle_thread_stack[0],
+ (uint32_t)sizeof(os_idle_thread_stack),
+ osPriorityIdle,
+#if defined(OS_IDLE_THREAD_TZ_MOD_ID)
+ (uint32_t)OS_IDLE_THREAD_TZ_MOD_ID,
+#else
+ 0U,
+#endif
+ 0U
+};
+
+
+// Timer Configuration
+// ===================
+
+#if (OS_TIMER_OBJ_MEM != 0)
+
+#if (OS_TIMER_NUM == 0)
+#error "Invalid number of Timer objects!"
+#endif
+
+// Timer Control Blocks
+static osRtxTimer_t os_timer_cb[OS_TIMER_NUM] \
+__attribute__((section(".bss.os.timer.cb")));
+
+// Memory Pool for Timer Control Blocks
+static osRtxMpInfo_t os_mpi_timer \
+__attribute__((section(".data.os.timer.mpi"))) =
+{ (uint32_t)OS_TIMER_NUM, 0U, (uint32_t)osRtxTimerCbSize, &os_timer_cb[0], NULL, NULL };
+
+#endif // (OS_TIMER_OBJ_MEM != 0)
+
+
+#if ((OS_TIMER_THREAD_STACK_SIZE != 0) && (OS_TIMER_CB_QUEUE != 0))
+
+#if (((OS_TIMER_THREAD_STACK_SIZE % 8) != 0) || (OS_TIMER_THREAD_STACK_SIZE < 96))
+#error "Invalid Timer Thread Stack size!"
+#endif
+
+// Timer Thread Control Block
+static osRtxThread_t os_timer_thread_cb \
+__attribute__((section(".bss.os.thread.cb")));
+
+// Timer Thread Stack
+static uint64_t os_timer_thread_stack[OS_TIMER_THREAD_STACK_SIZE/8] \
+__attribute__((section(".bss.os.thread.stack")));
+
+// Timer Thread Attributes
+static const osThreadAttr_t os_timer_thread_attr = {
+#if defined(OS_TIMER_THREAD_NAME)
+ OS_TIMER_THREAD_NAME,
+#else
+ NULL,
+#endif
+ osThreadDetached,
+ &os_timer_thread_cb,
+ (uint32_t)sizeof(os_timer_thread_cb),
+ &os_timer_thread_stack[0],
+ (uint32_t)sizeof(os_timer_thread_stack),
+ //lint -e{9030} -e{9034} "cast from signed to enum"
+ (osPriority_t)OS_TIMER_THREAD_PRIO,
+#if defined(OS_TIMER_THREAD_TZ_MOD_ID)
+ (uint32_t)OS_TIMER_THREAD_TZ_MOD_ID,
+#else
+ 0U,
+#endif
+ 0U
+};
+
+// Timer Message Queue Control Block
+static osRtxMessageQueue_t os_timer_mq_cb \
+__attribute__((section(".bss.os.msgqueue.cb")));
+
+// Timer Message Queue Data
+static uint32_t os_timer_mq_data[osRtxMessageQueueMemSize(OS_TIMER_CB_QUEUE,8)/4] \
+__attribute__((section(".bss.os.msgqueue.mem")));
+
+// Timer Message Queue Attributes
+static const osMessageQueueAttr_t os_timer_mq_attr = {
+ NULL,
+ 0U,
+ &os_timer_mq_cb,
+ (uint32_t)sizeof(os_timer_mq_cb),
+ &os_timer_mq_data[0],
+ (uint32_t)sizeof(os_timer_mq_data)
+};
+
+#else
+
+extern void osRtxTimerThread (void *argument);
+ void osRtxTimerThread (void *argument) { (void)argument; }
+
+#endif // ((OS_TIMER_THREAD_STACK_SIZE != 0) && (OS_TIMER_CB_QUEUE != 0))
+
+
+// Event Flags Configuration
+// =========================
+
+#if (OS_EVFLAGS_OBJ_MEM != 0)
+
+#if (OS_EVFLAGS_NUM == 0)
+#error "Invalid number of Event Flags objects!"
+#endif
+
+// Event Flags Control Blocks
+static osRtxEventFlags_t os_ef_cb[OS_EVFLAGS_NUM] \
+__attribute__((section(".bss.os.evflags.cb")));
+
+// Memory Pool for Event Flags Control Blocks
+static osRtxMpInfo_t os_mpi_ef \
+__attribute__((section(".data.os.evflags.mpi"))) =
+{ (uint32_t)OS_EVFLAGS_NUM, 0U, (uint32_t)osRtxEventFlagsCbSize, &os_ef_cb[0], NULL, NULL };
+
+#endif // (OS_EVFLAGS_OBJ_MEM != 0)
+
+
+// Mutex Configuration
+// ===================
+
+#if (OS_MUTEX_OBJ_MEM != 0)
+
+#if (OS_MUTEX_NUM == 0)
+#error "Invalid number of Mutex objects!"
+#endif
+
+// Mutex Control Blocks
+static osRtxMutex_t os_mutex_cb[OS_MUTEX_NUM] \
+__attribute__((section(".bss.os.mutex.cb")));
+
+// Memory Pool for Mutex Control Blocks
+static osRtxMpInfo_t os_mpi_mutex \
+__attribute__((section(".data.os.mutex.mpi"))) =
+{ (uint32_t)OS_MUTEX_NUM, 0U, (uint32_t)osRtxMutexCbSize, &os_mutex_cb[0], NULL, NULL };
+
+#endif // (OS_MUTEX_OBJ_MEM != 0)
+
+
+// Semaphore Configuration
+// =======================
+
+#if (OS_SEMAPHORE_OBJ_MEM != 0)
+
+#if (OS_SEMAPHORE_NUM == 0)
+#error "Invalid number of Semaphore objects!"
+#endif
+
+// Semaphore Control Blocks
+static osRtxSemaphore_t os_semaphore_cb[OS_SEMAPHORE_NUM] \
+__attribute__((section(".bss.os.semaphore.cb")));
+
+// Memory Pool for Semaphore Control Blocks
+static osRtxMpInfo_t os_mpi_semaphore \
+__attribute__((section(".data.os.semaphore.mpi"))) =
+{ (uint32_t)OS_SEMAPHORE_NUM, 0U, (uint32_t)osRtxSemaphoreCbSize, &os_semaphore_cb[0], NULL, NULL };
+
+#endif // (OS_SEMAPHORE_OBJ_MEM != 0)
+
+
+// Memory Pool Configuration
+// =========================
+
+#if (OS_MEMPOOL_OBJ_MEM != 0)
+
+#if (OS_MEMPOOL_NUM == 0)
+#error "Invalid number of Memory Pool objects!"
+#endif
+
+// Memory Pool Control Blocks
+static osRtxMemoryPool_t os_mp_cb[OS_MEMPOOL_NUM] \
+__attribute__((section(".bss.os.mempool.cb")));
+
+// Memory Pool for Memory Pool Control Blocks
+static osRtxMpInfo_t os_mpi_mp \
+__attribute__((section(".data.os.mempool.mpi"))) =
+{ (uint32_t)OS_MEMPOOL_NUM, 0U, (uint32_t)osRtxMemoryPoolCbSize, &os_mp_cb[0], NULL, NULL };
+
+// Memory Pool for Memory Pool Data Storage
+#if (OS_MEMPOOL_DATA_SIZE != 0)
+#if ((OS_MEMPOOL_DATA_SIZE % 8) != 0)
+#error "Invalid Data Memory size for Memory Pools!"
+#endif
+static uint64_t os_mp_data[2 + OS_MEMPOOL_NUM + (OS_MEMPOOL_DATA_SIZE/8)] \
+__attribute__((section(".bss.os.mempool.mem")));
+#endif
+
+#endif // (OS_MEMPOOL_OBJ_MEM != 0)
+
+
+// Message Queue Configuration
+// ===========================
+
+#if (OS_MSGQUEUE_OBJ_MEM != 0)
+
+#if (OS_MSGQUEUE_NUM == 0)
+#error "Invalid number of Message Queue objects!"
+#endif
+
+// Message Queue Control Blocks
+static osRtxMessageQueue_t os_mq_cb[OS_MSGQUEUE_NUM] \
+__attribute__((section(".bss.os.msgqueue.cb")));
+
+// Memory Pool for Message Queue Control Blocks
+static osRtxMpInfo_t os_mpi_mq \
+__attribute__((section(".data.os.msgqueue.mpi"))) =
+{ (uint32_t)OS_MSGQUEUE_NUM, 0U, (uint32_t)osRtxMessageQueueCbSize, &os_mq_cb[0], NULL, NULL };
+
+// Memory Pool for Message Queue Data Storage
+#if (OS_MSGQUEUE_DATA_SIZE != 0)
+#if ((OS_MSGQUEUE_DATA_SIZE % 8) != 0)
+#error "Invalid Data Memory size for Message Queues!"
+#endif
+static uint64_t os_mq_data[2 + OS_MSGQUEUE_NUM + (OS_MSGQUEUE_DATA_SIZE/8)] \
+__attribute__((section(".bss.os.msgqueue.mem")));
+#endif
+
+#endif // (OS_MSGQUEUE_OBJ_MEM != 0)
+
+
+// Event Recorder Configuration
+// ============================
+
+#if (defined(OS_EVR_INIT) && (OS_EVR_INIT != 0))
+
+// Initial Thread configuration covered also Thread Flags and Generic Wait
+#if defined(OS_EVR_THREAD_FILTER)
+#if !defined(OS_EVR_THFLAGS_FILTER)
+#define OS_EVR_THFLAGS_FILTER OS_EVR_THREAD_FILTER
+#endif
+#if !defined(OS_EVR_WAIT_FILTER)
+#define OS_EVR_WAIT_FILTER OS_EVR_THREAD_FILTER
+#endif
+#endif
+
+// Migrate initial filter configuration
+#if defined(OS_EVR_MEMORY_FILTER)
+#define OS_EVR_MEMORY_LEVEL (((OS_EVR_MEMORY_FILTER & 0x80U) != 0U) ? (OS_EVR_MEMORY_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_KERNEL_FILTER)
+#define OS_EVR_KERNEL_LEVEL (((OS_EVR_KERNEL_FILTER & 0x80U) != 0U) ? (OS_EVR_KERNEL_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_THREAD_FILTER)
+#define OS_EVR_THREAD_LEVEL (((OS_EVR_THREAD_FILTER & 0x80U) != 0U) ? (OS_EVR_THREAD_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_WAIT_FILTER)
+#define OS_EVR_WAIT_LEVEL (((OS_EVR_WAIT_FILTER & 0x80U) != 0U) ? (OS_EVR_WAIT_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_THFLAGS_FILTER)
+#define OS_EVR_THFLAGS_LEVEL (((OS_EVR_THFLAGS_FILTER & 0x80U) != 0U) ? (OS_EVR_THFLAGS_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_EVFLAGS_FILTER)
+#define OS_EVR_EVFLAGS_LEVEL (((OS_EVR_EVFLAGS_FILTER & 0x80U) != 0U) ? (OS_EVR_EVFLAGS_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_TIMER_FILTER)
+#define OS_EVR_TIMER_LEVEL (((OS_EVR_TIMER_FILTER & 0x80U) != 0U) ? (OS_EVR_TIMER_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_MUTEX_FILTER)
+#define OS_EVR_MUTEX_LEVEL (((OS_EVR_MUTEX_FILTER & 0x80U) != 0U) ? (OS_EVR_MUTEX_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_SEMAPHORE_FILTER)
+#define OS_EVR_SEMAPHORE_LEVEL (((OS_EVR_SEMAPHORE_FILTER & 0x80U) != 0U) ? (OS_EVR_SEMAPHORE_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_MEMPOOL_FILTER)
+#define OS_EVR_MEMPOOL_LEVEL (((OS_EVR_MEMPOOL_FILTER & 0x80U) != 0U) ? (OS_EVR_MEMPOOL_FILTER & 0x0FU) : 0U)
+#endif
+#if defined(OS_EVR_MSGQUEUE_FILTER)
+#define OS_EVR_MSGQUEUE_LEVEL (((OS_EVR_MSGQUEUE_FILTER & 0x80U) != 0U) ? (OS_EVR_MSGQUEUE_FILTER & 0x0FU) : 0U)
+#endif
+
+#if defined(RTE_Compiler_EventRecorder)
+
+// Event Recorder Initialize
+__STATIC_INLINE void evr_initialize (void) {
+
+ (void)EventRecorderInitialize(OS_EVR_LEVEL, (uint32_t)OS_EVR_START);
+
+ (void)EventRecorderEnable(OS_EVR_MEMORY_LEVEL, EvtRtxMemoryNo, EvtRtxMemoryNo);
+ (void)EventRecorderEnable(OS_EVR_KERNEL_LEVEL, EvtRtxKernelNo, EvtRtxKernelNo);
+ (void)EventRecorderEnable(OS_EVR_THREAD_LEVEL, EvtRtxThreadNo, EvtRtxThreadNo);
+ (void)EventRecorderEnable(OS_EVR_WAIT_LEVEL, EvtRtxWaitNo, EvtRtxWaitNo);
+ (void)EventRecorderEnable(OS_EVR_THFLAGS_LEVEL, EvtRtxThreadFlagsNo, EvtRtxThreadFlagsNo);
+ (void)EventRecorderEnable(OS_EVR_EVFLAGS_LEVEL, EvtRtxEventFlagsNo, EvtRtxEventFlagsNo);
+ (void)EventRecorderEnable(OS_EVR_TIMER_LEVEL, EvtRtxTimerNo, EvtRtxTimerNo);
+ (void)EventRecorderEnable(OS_EVR_MUTEX_LEVEL, EvtRtxMutexNo, EvtRtxMutexNo);
+ (void)EventRecorderEnable(OS_EVR_SEMAPHORE_LEVEL, EvtRtxSemaphoreNo, EvtRtxSemaphoreNo);
+ (void)EventRecorderEnable(OS_EVR_MEMPOOL_LEVEL, EvtRtxMemoryPoolNo, EvtRtxMemoryPoolNo);
+ (void)EventRecorderEnable(OS_EVR_MSGQUEUE_LEVEL, EvtRtxMessageQueueNo, EvtRtxMessageQueueNo);
+}
+
+#else
+#warning "Event Recorder cannot be initialized (Event Recorder component is not selected)!"
+#define evr_initialize()
+#endif
+
+#endif // (OS_EVR_INIT != 0)
+
+
+// OS Configuration
+// ================
+
+
+const osRtxConfig_t osRtxConfig \
+__USED \
+__attribute__((section(".rodata"))) =
+{
+ //lint -e{835} "Zero argument to operator"
+ 0U // Flags
+#if (OS_PRIVILEGE_MODE != 0)
+ | osRtxConfigPrivilegedMode
+#endif
+#if (OS_STACK_CHECK != 0)
+ | osRtxConfigStackCheck
+#endif
+#if (OS_STACK_WATERMARK != 0)
+ | osRtxConfigStackWatermark
+#endif
+ ,
+ (uint32_t)OS_TICK_FREQ,
+#if (OS_ROBIN_ENABLE != 0)
+ (uint32_t)OS_ROBIN_TIMEOUT,
+#else
+ 0U,
+#endif
+ { &os_isr_queue[0], (uint16_t)(sizeof(os_isr_queue)/sizeof(void *)), 0U },
+ {
+ // Memory Pools (Variable Block Size)
+#if ((OS_THREAD_OBJ_MEM != 0) && (OS_THREAD_USER_STACK_SIZE != 0))
+ &os_thread_stack[0], sizeof(os_thread_stack),
+#else
+ NULL, 0U,
+#endif
+#if ((OS_MEMPOOL_OBJ_MEM != 0) && (OS_MEMPOOL_DATA_SIZE != 0))
+ &os_mp_data[0], sizeof(os_mp_data),
+#else
+ NULL, 0U,
+#endif
+#if ((OS_MSGQUEUE_OBJ_MEM != 0) && (OS_MSGQUEUE_DATA_SIZE != 0))
+ &os_mq_data[0], sizeof(os_mq_data),
+#else
+ NULL, 0U,
+#endif
+#if (OS_DYNAMIC_MEM_SIZE != 0)
+ &os_mem[0], (uint32_t)OS_DYNAMIC_MEM_SIZE,
+#else
+ NULL, 0U
+#endif
+ },
+ {
+ // Memory Pools (Fixed Block Size)
+#if (OS_THREAD_OBJ_MEM != 0)
+#if (OS_THREAD_DEF_STACK_NUM != 0)
+ &os_mpi_def_stack,
+#else
+ NULL,
+#endif
+ &os_mpi_thread,
+#else
+ NULL,
+ NULL,
+#endif
+#if (OS_TIMER_OBJ_MEM != 0)
+ &os_mpi_timer,
+#else
+ NULL,
+#endif
+#if (OS_EVFLAGS_OBJ_MEM != 0)
+ &os_mpi_ef,
+#else
+ NULL,
+#endif
+#if (OS_MUTEX_OBJ_MEM != 0)
+ &os_mpi_mutex,
+#else
+ NULL,
+#endif
+#if (OS_SEMAPHORE_OBJ_MEM != 0)
+ &os_mpi_semaphore,
+#else
+ NULL,
+#endif
+#if (OS_MEMPOOL_OBJ_MEM != 0)
+ &os_mpi_mp,
+#else
+ NULL,
+#endif
+#if (OS_MSGQUEUE_OBJ_MEM != 0)
+ &os_mpi_mq,
+#else
+ NULL,
+#endif
+ },
+ (uint32_t)OS_STACK_SIZE,
+ &os_idle_thread_attr,
+#if ((OS_TIMER_THREAD_STACK_SIZE != 0) && (OS_TIMER_CB_QUEUE != 0))
+ &os_timer_thread_attr,
+ &os_timer_mq_attr,
+ (uint32_t)OS_TIMER_CB_QUEUE
+#else
+ NULL,
+ NULL,
+ 0U
+#endif
+};
+
+
+// Non weak reference to library irq module
+//lint -esym(526,irqRtxLib) "Defined by Exception handlers"
+//lint -esym(714,irqRtxLibRef) "Non weak reference"
+//lint -esym(765,irqRtxLibRef) "Global scope"
+extern uint8_t irqRtxLib;
+extern const uint8_t *irqRtxLibRef;
+ const uint8_t *irqRtxLibRef = &irqRtxLib;
+
+// Default User SVC Table
+//lint -esym(714,osRtxUserSVC) "Referenced by Exception handlers"
+//lint -esym(765,osRtxUserSVC) "Global scope"
+//lint -e{9067} "extern array declared without size"
+extern void * const osRtxUserSVC[];
+__WEAK void * const osRtxUserSVC[1] = { (void *)0 };
+
+
+// OS Sections
+// ===========
+
+#if defined(__CC_ARM)
+__asm void os_cb_sections_wrapper (void) {
+ EXTERN ||.bss.os.thread.cb$$Base|| [WEAK]
+ EXTERN ||.bss.os.thread.cb$$Limit|| [WEAK]
+ EXTERN ||.bss.os.timer.cb$$Base|| [WEAK]
+ EXTERN ||.bss.os.timer.cb$$Limit|| [WEAK]
+ EXTERN ||.bss.os.evflags.cb$$Base|| [WEAK]
+ EXTERN ||.bss.os.evflags.cb$$Limit|| [WEAK]
+ EXTERN ||.bss.os.mutex.cb$$Base|| [WEAK]
+ EXTERN ||.bss.os.mutex.cb$$Limit|| [WEAK]
+ EXTERN ||.bss.os.semaphore.cb$$Base|| [WEAK]
+ EXTERN ||.bss.os.semaphore.cb$$Limit|| [WEAK]
+ EXTERN ||.bss.os.mempool.cb$$Base|| [WEAK]
+ EXTERN ||.bss.os.mempool.cb$$Limit|| [WEAK]
+ EXTERN ||.bss.os.msgqueue.cb$$Base|| [WEAK]
+ EXTERN ||.bss.os.msgqueue.cb$$Limit|| [WEAK]
+
+ AREA ||.rodata||, DATA, READONLY
+ EXPORT os_cb_sections
+os_cb_sections
+ DCD ||.bss.os.thread.cb$$Base||
+ DCD ||.bss.os.thread.cb$$Limit||
+ DCD ||.bss.os.timer.cb$$Base||
+ DCD ||.bss.os.timer.cb$$Limit||
+ DCD ||.bss.os.evflags.cb$$Base||
+ DCD ||.bss.os.evflags.cb$$Limit||
+ DCD ||.bss.os.mutex.cb$$Base||
+ DCD ||.bss.os.mutex.cb$$Limit||
+ DCD ||.bss.os.semaphore.cb$$Base||
+ DCD ||.bss.os.semaphore.cb$$Limit||
+ DCD ||.bss.os.mempool.cb$$Base||
+ DCD ||.bss.os.mempool.cb$$Limit||
+ DCD ||.bss.os.msgqueue.cb$$Base||
+ DCD ||.bss.os.msgqueue.cb$$Limit||
+
+ AREA ||.emb_text||, CODE
+};
+#endif
+
+#if (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
+//lint -e{19} "Linker symbols"
+__asm (
+ ".weakref __os_thread_cb_start__, .bss.os.thread.cb$$Base\n\t"
+ ".weakref __os_thread_cb_end__, .bss.os.thread.cb$$Limit\n\t"
+ ".weakref __os_timer_cb_start__, .bss.os.timer.cb$$Base\n\t"
+ ".weakref __os_timer_cb_end__, .bss.os.timer.cb$$Limit\n\t"
+ ".weakref __os_evflags_cb_start__, .bss.os.evflags.cb$$Base\n\t"
+ ".weakref __os_evflags_cb_end__, .bss.os.evflags.cb$$Limit\n\t"
+ ".weakref __os_mutex_cb_start__, .bss.os.mutex.cb$$Base\n\t"
+ ".weakref __os_mutex_cb_end__, .bss.os.mutex.cb$$Limit\n\t"
+ ".weakref __os_semaphore_cb_start__, .bss.os.semaphore.cb$$Base\n\t"
+ ".weakref __os_semaphore_cb_end__, .bss.os.semaphore.cb$$Limit\n\t"
+ ".weakref __os_mempool_cb_start__, .bss.os.mempool.cb$$Base\n\t"
+ ".weakref __os_mempool_cb_end__, .bss.os.mempool.cb$$Limit\n\t"
+ ".weakref __os_msgqueue_cb_start__, .bss.os.msgqueue.cb$$Base\n\t"
+ ".weakref __os_msgqueue_cb_end__, .bss.os.msgqueue.cb$$Limit\n\t"
+);
+#endif
+
+#if (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || \
+ (defined(__GNUC__) && !defined(__CC_ARM))
+
+extern __attribute__((weak)) uint32_t __os_thread_cb_start__; //lint -esym(526,__os_thread_cb_start__)
+extern __attribute__((weak)) uint32_t __os_thread_cb_end__; //lint -esym(526,__os_thread_cb_end__)
+extern __attribute__((weak)) uint32_t __os_timer_cb_start__; //lint -esym(526,__os_timer_cb_start__)
+extern __attribute__((weak)) uint32_t __os_timer_cb_end__; //lint -esym(526,__os_timer_cb_end__)
+extern __attribute__((weak)) uint32_t __os_evflags_cb_start__; //lint -esym(526,__os_evflags_cb_start__)
+extern __attribute__((weak)) uint32_t __os_evflags_cb_end__; //lint -esym(526,__os_evflags_cb_end__)
+extern __attribute__((weak)) uint32_t __os_mutex_cb_start__; //lint -esym(526,__os_mutex_cb_start__)
+extern __attribute__((weak)) uint32_t __os_mutex_cb_end__; //lint -esym(526,__os_mutex_cb_end__)
+extern __attribute__((weak)) uint32_t __os_semaphore_cb_start__; //lint -esym(526,__os_semaphore_cb_start__)
+extern __attribute__((weak)) uint32_t __os_semaphore_cb_end__; //lint -esym(526,__os_semaphore_cb_end__)
+extern __attribute__((weak)) uint32_t __os_mempool_cb_start__; //lint -esym(526,__os_mempool_cb_start__)
+extern __attribute__((weak)) uint32_t __os_mempool_cb_end__; //lint -esym(526,__os_mempool_cb_end__)
+extern __attribute__((weak)) uint32_t __os_msgqueue_cb_start__; //lint -esym(526,__os_msgqueue_cb_start__)
+extern __attribute__((weak)) uint32_t __os_msgqueue_cb_end__; //lint -esym(526,__os_msgqueue_cb_end__)
+
+//lint -e{19} "Global symbol"
+__asm (".global os_cb_sections");
+
+//lint -e{9067} "extern array declared without size"
+extern const uint32_t os_cb_sections[];
+
+//lint -esym(714,os_cb_sections) "Referenced by debugger"
+//lint -esym(765,os_cb_sections) "Global scope"
+//lint -e{923} -e{9078} "cast from pointer to unsigned int"
+const uint32_t os_cb_sections[] \
+__attribute__((section(".rodata"))) =
+{
+ (uint32_t)&__os_thread_cb_start__,
+ (uint32_t)&__os_thread_cb_end__,
+ (uint32_t)&__os_timer_cb_start__,
+ (uint32_t)&__os_timer_cb_end__,
+ (uint32_t)&__os_evflags_cb_start__,
+ (uint32_t)&__os_evflags_cb_end__,
+ (uint32_t)&__os_mutex_cb_start__,
+ (uint32_t)&__os_mutex_cb_end__,
+ (uint32_t)&__os_semaphore_cb_start__,
+ (uint32_t)&__os_semaphore_cb_end__,
+ (uint32_t)&__os_mempool_cb_start__,
+ (uint32_t)&__os_mempool_cb_end__,
+ (uint32_t)&__os_msgqueue_cb_start__,
+ (uint32_t)&__os_msgqueue_cb_end__
+};
+
+#endif
+
+
+// OS Initialization
+// =================
+
+#if defined(__CC_ARM) || \
+ (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
+
+#ifndef __MICROLIB
+//lint -esym(714,_platform_post_stackheap_init) "Referenced by C library"
+//lint -esym(765,_platform_post_stackheap_init) "Global scope"
+extern void _platform_post_stackheap_init (void);
+__WEAK void _platform_post_stackheap_init (void) {
+ (void)osKernelInitialize();
+}
+#endif
+
+#elif defined(__GNUC__)
+
+extern void software_init_hook (void);
+__WEAK void software_init_hook (void) {
+ (void)osKernelInitialize();
+}
+
+#endif
+
+
+// OS Hooks
+// ========
+
+// RTOS Kernel Pre-Initialization Hook
+#if (defined(OS_EVR_INIT) && (OS_EVR_INIT != 0))
+void osRtxKernelPreInit (void);
+void osRtxKernelPreInit (void) {
+ if (osKernelGetState() == osKernelInactive) {
+ evr_initialize();
+ }
+}
+#endif
+
+
+// C/C++ Standard Library Multithreading Interface
+// ===============================================
+
+#if ( !defined(RTX_NO_MULTITHREAD_CLIB) && \
+ ( defined(__CC_ARM) || \
+ (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))) && \
+ !defined(__MICROLIB))
+
+#define LIBSPACE_SIZE 96
+
+//lint -esym(714,__user_perthread_libspace,_mutex_*) "Referenced by C library"
+//lint -esym(765,__user_perthread_libspace,_mutex_*) "Global scope"
+//lint -esym(9003, os_libspace*) "variables 'os_libspace*' defined at module scope"
+
+// Memory for libspace
+static uint32_t os_libspace[OS_THREAD_LIBSPACE_NUM+1][LIBSPACE_SIZE/4] \
+__attribute__((section(".bss.os.libspace")));
+
+// Thread IDs for libspace
+static osThreadId_t os_libspace_id[OS_THREAD_LIBSPACE_NUM] \
+__attribute__((section(".bss.os.libspace")));
+
+// Check if Kernel has been started
+static uint32_t os_kernel_is_active (void) {
+ static uint8_t os_kernel_active = 0U;
+
+ if (os_kernel_active == 0U) {
+ if (osKernelGetState() > osKernelReady) {
+ os_kernel_active = 1U;
+ }
+ }
+ return (uint32_t)os_kernel_active;
+}
+
+// Provide libspace for current thread
+void *__user_perthread_libspace (void);
+void *__user_perthread_libspace (void) {
+ osThreadId_t id;
+ uint32_t n;
+
+ if (os_kernel_is_active() != 0U) {
+ id = osThreadGetId();
+ for (n = 0U; n < (uint32_t)OS_THREAD_LIBSPACE_NUM; n++) {
+ if (os_libspace_id[n] == NULL) {
+ os_libspace_id[n] = id;
+ }
+ if (os_libspace_id[n] == id) {
+ break;
+ }
+ }
+ if (n == (uint32_t)OS_THREAD_LIBSPACE_NUM) {
+ (void)osRtxErrorNotify(osRtxErrorClibSpace, id);
+ }
+ } else {
+ n = OS_THREAD_LIBSPACE_NUM;
+ }
+
+ //lint -e{9087} "cast between pointers to different object types"
+ return (void *)&os_libspace[n][0];
+}
+
+// Mutex identifier
+typedef void *mutex;
+
+//lint -save "Function prototypes defined in C library"
+//lint -e970 "Use of 'int' outside of a typedef"
+//lint -e818 "Pointer 'm' could be declared as pointing to const"
+
+// Initialize mutex
+__USED
+int _mutex_initialize(mutex *m);
+int _mutex_initialize(mutex *m) {
+ int result;
+
+ *m = osMutexNew(NULL);
+ if (*m != NULL) {
+ result = 1;
+ } else {
+ result = 0;
+ (void)osRtxErrorNotify(osRtxErrorClibMutex, m);
+ }
+ return result;
+}
+
+// Acquire mutex
+__USED
+void _mutex_acquire(mutex *m);
+void _mutex_acquire(mutex *m) {
+ if (os_kernel_is_active() != 0U) {
+ (void)osMutexAcquire(*m, osWaitForever);
+ }
+}
+
+// Release mutex
+__USED
+void _mutex_release(mutex *m);
+void _mutex_release(mutex *m) {
+ if (os_kernel_is_active() != 0U) {
+ (void)osMutexRelease(*m);
+ }
+}
+
+// Free mutex
+__USED
+void _mutex_free(mutex *m);
+void _mutex_free(mutex *m) {
+ (void)osMutexDelete(*m);
+}
+
+//lint -restore
+
+#endif
diff --git a/app_broker/CMakeLists.txt b/app_broker/CMakeLists.txt
new file mode 100644
index 0000000..2a8a6eb
--- /dev/null
+++ b/app_broker/CMakeLists.txt
@@ -0,0 +1,46 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2023, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+#
+# This CMake script used in a split build only. In the legacy 'sinlge' build
+# this file is ignoed. Please don't be confused.
+#
+cmake_minimum_required(VERSION 3.15)
+
+# This is important to add this SPE subdirectory at first as it
+# brings configuration from TF-M build
+add_subdirectory(${CONFIG_SPE_PATH} ${CMAKE_BINARY_DIR}/spe)
+
+add_subdirectory(log)
+add_subdirectory(CMSIS)
+add_subdirectory(os_wrapper)
+
+add_library(tfm_test_broker STATIC
+ main_ns.c
+)
+
+target_include_directories(tfm_test_broker PUBLIC .)
+
+target_link_libraries(tfm_test_broker
+ PUBLIC
+ tfm_api_ns
+ tfm_log
+ os_wrapper
+)
+
+add_subdirectory(nsid_manager)
+target_link_libraries(tfm_test_broker PUBLIC tfm_nsid_manager)
+
+if (TFM_PARTITION_NS_AGENT_MAILBOX)
+ add_subdirectory(multi_core)
+ target_link_libraries(tfm_test_broker PUBLIC ns_multi_core)
+endif()
+
+# platform_region_defs needed by PS tests
+add_library(platform_region_defs INTERFACE)
+
+
+
diff --git a/app_broker/log/CMakeLists.txt b/app_broker/log/CMakeLists.txt
new file mode 100644
index 0000000..3612435
--- /dev/null
+++ b/app_broker/log/CMakeLists.txt
@@ -0,0 +1,24 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020-2022, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+############################# Ns Log ###########################################
+add_library(tfm_log STATIC)
+
+target_sources(tfm_log
+ PRIVATE
+ tfm_log_raw.c
+)
+
+target_include_directories(tfm_log
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+target_link_libraries(tfm_log
+ PUBLIC
+ platform_ns
+)
diff --git a/app_broker/log/tfm_log.h b/app_broker/log/tfm_log.h
new file mode 100644
index 0000000..5563434
--- /dev/null
+++ b/app_broker/log/tfm_log.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_LOG_H__
+#define __TFM_LOG_H__
+
+#include "tfm_log_raw.h"
+
+/* Functions and macros in this file is for 'thread mode' usage. */
+
+#define LOG_MSG(...) tfm_log_printf(__VA_ARGS__)
+
+#endif /* __TFM_LOG_H__ */
diff --git a/app_broker/log/tfm_log_raw.c b/app_broker/log/tfm_log_raw.c
new file mode 100644
index 0000000..86cf1c3
--- /dev/null
+++ b/app_broker/log/tfm_log_raw.c
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include "uart_stdout.h"
+
+#define PRINT_BUFF_SIZE 32
+#define NUM_BUFF_SIZE 12
+
+struct formatted_buffer_t {
+ size_t pos;
+ uint8_t buf[PRINT_BUFF_SIZE];
+};
+
+const char hex_digits_lo[] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+const char hex_digits_up[] = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
+
+static void _tfm_flush_formatted_buffer(struct formatted_buffer_t *pb,
+ uint8_t data)
+{
+ pb->buf[pb->pos++] = data;
+ if (pb->pos >= PRINT_BUFF_SIZE) {
+ pb->pos = 0;
+ /* uart flush and print here. */
+ stdio_output_string(pb->buf, PRINT_BUFF_SIZE);
+ }
+}
+
+static int _tfm_string_output(struct formatted_buffer_t *pb,
+ const char *str)
+{
+ int count = 0;
+
+ while (*str) {
+ _tfm_flush_formatted_buffer(pb, *str++);
+ count++;
+ }
+
+ return count;
+}
+
+static int _tfm_dec_num_output(struct formatted_buffer_t *pb,
+ int32_t num, uint8_t sign)
+{
+ int count = 0;
+ uint8_t num_buff[NUM_BUFF_SIZE] = {0};
+ uint32_t number = (uint32_t)num;
+ uint32_t k = 0;
+
+ if (sign == 'd' && num < 0) {
+ _tfm_flush_formatted_buffer(pb, '-');
+ count++;
+ number = -num;
+ }
+
+ do {
+ num_buff[k++] = '0' + number % 10;
+ number /= 10;
+ } while (number);
+
+ while (k) {
+ _tfm_flush_formatted_buffer(pb, num_buff[--k]);
+ count++;
+ }
+
+ return count;
+}
+
+static int _tfm_hex_num_output(struct formatted_buffer_t *pb, uint32_t num,
+ const char *hex_digits)
+{
+ int count = 0;
+ uint8_t num_buff[NUM_BUFF_SIZE] = {0};
+ uint32_t k = 0;
+
+ do {
+ num_buff[k++] = hex_digits[num & 0x0f];
+ num >>= 4;
+ } while (num);
+
+ while (k) {
+ _tfm_flush_formatted_buffer(pb, num_buff[--k]);
+ count++;
+ }
+
+ return count;
+}
+
+static int _tfm_log_vprintf(const char *fmt, va_list ap)
+{
+ int count = 0;
+ struct formatted_buffer_t outputbuf;
+
+ outputbuf.pos = 0;
+
+ while (*fmt) {
+ if (*fmt == '%') {
+ switch (*(++fmt)) {
+ case 'd':
+ case 'i':
+ count += _tfm_dec_num_output(&outputbuf,
+ va_arg(ap, int32_t), 'd');
+ break;
+ case 'u':
+ count += _tfm_dec_num_output(&outputbuf,
+ va_arg(ap, int32_t), 'u');
+ break;
+ case 'x':
+ count += _tfm_hex_num_output(&outputbuf, va_arg(ap, uint32_t),
+ hex_digits_lo);
+ break;
+ case 'X':
+ count += _tfm_hex_num_output(&outputbuf, va_arg(ap, uint32_t),
+ hex_digits_up);
+ break;
+ case 'p':
+ count += _tfm_string_output(&outputbuf, "0x");
+ count += _tfm_hex_num_output(&outputbuf, va_arg(ap, uint32_t),
+ hex_digits_lo);
+ break;
+ case 's':
+ count += _tfm_string_output(&outputbuf, va_arg(ap, char*));
+ break;
+ case 'c':
+ _tfm_flush_formatted_buffer(&outputbuf,
+ (uint8_t)va_arg(ap, int32_t));
+ count++;
+ break;
+ case '%':
+ _tfm_flush_formatted_buffer(&outputbuf, '%');
+ count++;
+ break;
+ default:
+ count += _tfm_string_output(&outputbuf, "[Unsupported Tag]");
+ continue;
+ }
+ fmt++;
+ } else {
+ _tfm_flush_formatted_buffer(&outputbuf, *fmt++);
+ count++;
+ }
+ }
+
+ /* End of printf, flush buf */
+ if (outputbuf.pos) {
+ count += stdio_output_string(outputbuf.buf, outputbuf.pos);
+ }
+
+ return count;
+}
+
+int tfm_log_printf(const char *fmt, ...)
+{
+ int count = 0;
+ va_list ap;
+
+ va_start(ap, fmt);
+ count = _tfm_log_vprintf(fmt, ap);
+ va_end(ap);
+
+ return count;
+}
diff --git a/app_broker/log/tfm_log_raw.h b/app_broker/log/tfm_log_raw.h
new file mode 100644
index 0000000..7a5a942
--- /dev/null
+++ b/app_broker/log/tfm_log_raw.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_LOG_RAW_H__
+#define __TFM_LOG_RAW_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Prints log messages
+ *
+ * \param[in] fmt Formatted string
+ * \param[in] ... Viriable length argument
+ *
+ * \return Number of chars printed
+ *
+ * \note This function has the similar input argument format as
+ * the 'printf' function. But it supports only some basic
+ * formats like 'sdicpuxX' and '%'. It will output
+ * "[Unsupported Tag]" when none of the above formats match
+ *
+ * \details The following output formats are supported.
+ * %s - string
+ * %d - decimal signed integer (same for %i)
+ * %u - decimal unsigned integer
+ * %x - hex in lowercase
+ * %X - hex in uppercase
+ * %p - hex address of a pointer in lowercase
+ * %c - character
+ * %% - the '%' symbol
+ */
+int tfm_log_printf(const char *fmt, ...);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_LOG_RAW_H__ */
diff --git a/app_broker/main_ns.c b/app_broker/main_ns.c
new file mode 100644
index 0000000..c072896
--- /dev/null
+++ b/app_broker/main_ns.c
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
+ * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "cmsis_os2.h"
+#include "cmsis_compiler.h"
+#include "tfm_ns_interface.h"
+#include "tfm_nsid_manager.h"
+#include "test_app.h"
+#include "tfm_plat_ns.h"
+#include "Driver_USART.h"
+#include "device_cfg.h"
+#ifdef TFM_PARTITION_NS_AGENT_MAILBOX
+#include "tfm_multi_core_api.h"
+#include "tfm_ns_mailbox.h"
+#endif
+#include "tfm_log.h"
+#include "uart_stdout.h"
+#if (CONFIG_TFM_FLOAT_ABI >= 1)
+#include "cmsis.h"
+#endif
+#ifdef CONFIG_TFM_ENALBE_PROFILING
+#include "tfm_ns_profiling.h"
+#endif
+
+/**
+ * \brief Modified table template for user defined SVC functions
+ *
+ * \details RTX has a weak definition of osRtxUserSVC, which
+ * is overridden here
+ */
+#if defined(__ARMCC_VERSION)
+#if (__ARMCC_VERSION == 6110004)
+/* Workaround needed for a bug in Armclang 6.11, more details at:
+ * http://www.keil.com/support/docs/4089.htm
+ */
+__attribute__((section(".gnu.linkonce")))
+#endif
+
+/* Avoids the semihosting issue */
+#if (__ARMCC_VERSION >= 6010050)
+__asm(" .global __ARM_use_no_argv\n");
+#endif
+#endif
+
+#ifdef CONFIG_TFM_ENALBE_PROFILING
+
+#if TFM_NS_REG_TEST || PSA_API_TEST_NS
+#error "TF-M NS profiling shall not run together with NS regression tests"
+#endif
+/**
+ * \brief List of Profiling thread attributes
+ */
+const osThreadAttr_t thread_attr = {
+ .name = "profiling_thread",
+ .stack_size = 4096U,
+};
+osThreadFunc_t thread_func = tfm_ns_profiling;
+#else
+/**
+ * \brief List of RTOS thread attributes
+ */
+static const osThreadAttr_t thread_attr = {
+ .name = "test_thread",
+ .stack_size = 4096U,
+ .tz_module = ((TZ_ModuleId_t)TFM_DEFAULT_NSID)
+};
+/**
+ * \brief Static globals to hold RTOS related quantities,
+ * main thread
+ */
+static osThreadFunc_t thread_func = test_app;
+#endif
+
+#ifdef TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD
+static osThreadFunc_t mailbox_thread_func = tfm_ns_mailbox_thread_runner;
+static const osThreadAttr_t mailbox_thread_attr = {
+ .name = "mailbox_thread",
+ .stack_size = 1024U
+};
+#endif
+
+#ifdef TFM_PARTITION_NS_AGENT_MAILBOX
+static struct ns_mailbox_queue_t ns_mailbox_queue;
+
+static void tfm_ns_multi_core_boot(void)
+{
+ int32_t ret;
+
+ LOG_MSG("Non-secure code running on non-secure core.\r\n");
+
+ if (tfm_ns_wait_for_s_cpu_ready()) {
+ LOG_MSG("Error sync'ing with secure core.\r\n");
+
+ /* Avoid undefined behavior after multi-core sync-up failed */
+ for (;;) {
+ }
+ }
+
+ ret = tfm_ns_mailbox_init(&ns_mailbox_queue);
+ if (ret != MAILBOX_SUCCESS) {
+ LOG_MSG("Non-secure mailbox initialization failed.\r\n");
+
+ /* Avoid undefined behavior after NS mailbox initialization failed */
+ for (;;) {
+ }
+ }
+}
+#endif /* TFM_PARTITION_NS_AGENT_MAILBOX */
+
+#ifdef CONFIG_TFM_USE_TRUSTZONE
+extern uint32_t tfm_ns_interface_init(void);
+#endif
+
+/**
+ * \brief Platform peripherals and devices initialization.
+ * Can be overridden for platform specific initialization.
+ *
+ * \return ARM_DRIVER_OK if the initialization succeeds
+ */
+__WEAK int32_t tfm_ns_platform_init(void)
+{
+ stdio_init();
+
+ return ARM_DRIVER_OK;
+}
+
+/**
+ * \brief Platform peripherals and devices de-initialization.
+ * Can be overridden for platform specific initialization.
+ *
+ * \return ARM_DRIVER_OK if the de-initialization succeeds
+ */
+__WEAK int32_t tfm_ns_platform_uninit(void)
+{
+ stdio_uninit();
+
+ return ARM_DRIVER_OK;
+}
+
+
+__WEAK int32_t tfm_ns_cp_init(void)
+{
+#if (CONFIG_TFM_FLOAT_ABI >= 1)
+#ifdef __GNUC__
+ /* Enable NSPE privileged and unprivilged access to the FP Extension */
+ SCB->CPACR |= (3U << 10U*2U) /* enable CP10 full access */
+ | (3U << 11U*2U); /* enable CP11 full access */
+#endif
+#endif
+ return ARM_DRIVER_OK;
+}
+
+/**
+ * \brief main() function
+ */
+#ifndef __GNUC__
+__attribute__((noreturn))
+#endif
+int main(void)
+{
+ if (tfm_ns_platform_init() != ARM_DRIVER_OK) {
+ /* Avoid undefined behavior if platform init failed */
+ while(1);
+ }
+
+ if (tfm_ns_cp_init() != ARM_DRIVER_OK) {
+ /* Avoid undefined behavior if co-porcessor init failed */
+ while(1);
+ }
+
+ (void) osKernelInitialize();
+
+#ifdef TFM_PARTITION_NS_AGENT_MAILBOX
+ tfm_ns_multi_core_boot();
+#endif
+
+#ifdef CONFIG_TFM_USE_TRUSTZONE
+ /* Initialize the TFM NS interface */
+ tfm_ns_interface_init();
+#endif
+
+#ifdef TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD
+ (void) osThreadNew(mailbox_thread_func, NULL, &mailbox_thread_attr);
+#endif
+
+ (void) osThreadNew(thread_func, NULL, &thread_attr);
+
+ LOG_MSG("Non-Secure system starting...\r\n");
+ (void) osKernelStart();
+
+ /* Reached only in case of error */
+ for (;;) {
+ }
+}
diff --git a/app_broker/multi_core/CMakeLists.txt b/app_broker/multi_core/CMakeLists.txt
new file mode 100644
index 0000000..5780624
--- /dev/null
+++ b/app_broker/multi_core/CMakeLists.txt
@@ -0,0 +1,28 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2023, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+#
+# This CMake script used in a split build only. In the legacy 'sinlge' build
+# this file is ignoed. Please don't be confused.
+#
+cmake_minimum_required(VERSION 3.15)
+
+add_library(ns_multi_core STATIC
+ PRIVATE
+ tfm_multi_core_ns_api.c
+ tfm_multi_core_psa_ns_api.c
+ $<$<NOT:$<BOOL:${TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD}>>:tfm_ns_mailbox.c>
+ $<$<AND:$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>,$<BOOL:${TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD}>>:tfm_ns_mailbox_thread.c>
+ # NS RTOS specific implementation of NS mailbox
+ $<$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>:tfm_ns_mailbox_rtos_api.c>
+ $<$<BOOL:${TEST_NS_MULTI_CORE}>:tfm_ns_mailbox_test.c>
+)
+
+target_compile_definitions(ns_multi_core
+ PUBLIC
+ $<$<BOOL:${TFM_PARTITION_NS_AGENT_MAILBOX}>:TFM_PARTITION_NS_AGENT_MAILBOX>
+ $<$<AND:$<BOOL:${TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD}>,$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>>:TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD>
+)
diff --git a/app_broker/multi_core/tfm_ns_mailbox_rtos_api.c b/app_broker/multi_core/tfm_ns_mailbox_rtos_api.c
new file mode 100644
index 0000000..32fbedf
--- /dev/null
+++ b/app_broker/multi_core/tfm_ns_mailbox_rtos_api.c
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/*
+ * This file is a reference implementation of Non-secure mailbox RTOS API.
+ * This reference implementation is based on TF-M ROTS wrapper API.
+ * It can be replaced by RTOS specific implementation.
+ */
+
+#include "cmsis_compiler.h"
+
+#ifdef TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD
+#include "os_wrapper/msg_queue.h"
+#else
+#include "os_wrapper/semaphore.h"
+#endif
+#include "os_wrapper/thread.h"
+
+#include "tfm_ns_mailbox.h"
+
+/*
+ * Thread flag to manage wait/wake mechanism in mailbox.、
+ * Thread flag can be RTOS specific.
+ * The following example definition also covers the rule of CMSIS-RTOS2, which
+ * requires the MSB of thread flags must be 0b0.
+ */
+#define MAILBOX_THREAD_FLAG 0x5FCA0000
+
+#ifndef TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD
+#define MAX_SEMAPHORE_COUNT NUM_MAILBOX_QUEUE_SLOT
+
+static void *ns_lock_handle = NULL;
+#endif
+
+const void *tfm_ns_mailbox_os_get_task_handle(void)
+{
+ return os_wrapper_thread_get_handle();
+}
+
+void tfm_ns_mailbox_os_wait_reply(void)
+{
+ os_wrapper_thread_wait_flag(MAILBOX_THREAD_FLAG, OS_WRAPPER_WAIT_FOREVER);
+}
+
+void tfm_ns_mailbox_os_wake_task_isr(const void *task_handle)
+{
+ os_wrapper_thread_set_flag_isr((void *)task_handle, MAILBOX_THREAD_FLAG);
+}
+
+/*
+ * When NSPE mailbox only covers a single non-secure core, spinlock only
+ * requires to disable IRQ.
+ */
+void tfm_ns_mailbox_os_spin_lock(void)
+{
+ __disable_irq();
+}
+
+/*
+ * It is assumed that IRQ is always enabled when spinlock is acquired.
+ * Otherwise, the waiting thread won't be woken up.
+ */
+void tfm_ns_mailbox_os_spin_unlock(void)
+{
+ __enable_irq();
+}
+
+#ifdef TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD
+void *tfm_ns_mailbox_os_mq_create(size_t msg_size, uint8_t msg_count)
+{
+ return os_wrapper_msg_queue_create(msg_size, msg_count);
+}
+
+int32_t tfm_ns_mailbox_os_mq_send(void *mq_handle, const void *msg_ptr)
+{
+ int32_t ret;
+
+ if (!mq_handle || !msg_ptr) {
+ return MAILBOX_INVAL_PARAMS;
+ }
+
+ while (1) {
+ ret = os_wrapper_msg_queue_send(mq_handle, msg_ptr);
+ if (ret == OS_WRAPPER_SUCCESS) {
+ return MAILBOX_SUCCESS;
+ }
+ }
+
+ return MAILBOX_GENERIC_ERROR;
+}
+
+int32_t tfm_ns_mailbox_os_mq_receive(void *mq_handle, void *msg_ptr)
+{
+ int32_t ret;
+
+ if (!mq_handle || !msg_ptr) {
+ return MAILBOX_INVAL_PARAMS;
+ }
+
+ while (1) {
+ ret = os_wrapper_msg_queue_receive(mq_handle, msg_ptr);
+ if (ret == OS_WRAPPER_SUCCESS) {
+ return MAILBOX_SUCCESS;
+ }
+ }
+
+ return MAILBOX_GENERIC_ERROR;
+}
+#else /* TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD */
+int32_t tfm_ns_mailbox_os_lock_init(void)
+{
+ ns_lock_handle = os_wrapper_semaphore_create(MAX_SEMAPHORE_COUNT,
+ MAX_SEMAPHORE_COUNT,
+ NULL);
+ if (!ns_lock_handle) {
+ return MAILBOX_GENERIC_ERROR;
+ }
+
+ return MAILBOX_SUCCESS;
+}
+
+int32_t tfm_ns_mailbox_os_lock_acquire(void)
+{
+ return os_wrapper_semaphore_acquire(ns_lock_handle,
+ OS_WRAPPER_WAIT_FOREVER);
+}
+
+int32_t tfm_ns_mailbox_os_lock_release(void)
+{
+ return os_wrapper_semaphore_release(ns_lock_handle);
+}
+#endif /* TFM_MULTI_CORE_NS_OS_MAILBOX_THREAD */
diff --git a/app_broker/multi_core/tfm_ns_mailbox_test.c b/app_broker/multi_core/tfm_ns_mailbox_test.c
new file mode 100644
index 0000000..f3a9d50
--- /dev/null
+++ b/app_broker/multi_core/tfm_ns_mailbox_test.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "tfm_ns_mailbox.h"
+#include "tfm_ns_mailbox_test.h"
+
+static struct ns_mailbox_queue_t *stats_queue_ptr = NULL;
+
+void tfm_ns_mailbox_tx_stats_init(struct ns_mailbox_queue_t *ns_queue)
+{
+ if (!ns_queue) {
+ return;
+ }
+
+ ns_queue->nr_tx = 0;
+ ns_queue->nr_used_slots = 0;
+
+ stats_queue_ptr = ns_queue;
+}
+
+int32_t tfm_ns_mailbox_tx_stats_reinit(void)
+{
+ if (!stats_queue_ptr) {
+ return MAILBOX_INVAL_PARAMS;
+ }
+
+ stats_queue_ptr->nr_tx = 0;
+ stats_queue_ptr->nr_used_slots = 0;
+
+ return MAILBOX_SUCCESS;
+}
+
+void tfm_ns_mailbox_tx_stats_update(void)
+{
+ mailbox_queue_status_t empty_status;
+ uint8_t idx, nr_empty = 0;
+
+ if (!stats_queue_ptr) {
+ return;
+ }
+
+ tfm_ns_mailbox_os_spin_lock();
+ /* Count the number of used slots when this tx arrives */
+ empty_status = stats_queue_ptr->empty_slots;
+ tfm_ns_mailbox_os_spin_unlock();
+
+ if (empty_status) {
+ for (idx = 0; idx < NUM_MAILBOX_QUEUE_SLOT; idx++) {
+ if (empty_status & (0x1UL << idx)) {
+ nr_empty++;
+ }
+ }
+ }
+
+ tfm_ns_mailbox_os_spin_lock();
+ stats_queue_ptr->nr_used_slots += (NUM_MAILBOX_QUEUE_SLOT - nr_empty);
+ stats_queue_ptr->nr_tx++;
+ tfm_ns_mailbox_os_spin_unlock();
+}
+
+void tfm_ns_mailbox_stats_avg_slot(struct ns_mailbox_stats_res_t *stats_res)
+{
+ uint32_t nr_used_slots, nr_tx;
+
+ if (!stats_queue_ptr || !stats_res) {
+ return;
+ }
+
+ nr_used_slots = stats_queue_ptr->nr_used_slots;
+ nr_tx = stats_queue_ptr->nr_tx;
+
+ stats_res->avg_nr_slots = nr_used_slots / nr_tx;
+ nr_used_slots %= nr_tx;
+ stats_res->avg_nr_slots_tenths = nr_used_slots * 10 / nr_tx;
+}
diff --git a/app_broker/nsid_manager/CMakeLists.txt b/app_broker/nsid_manager/CMakeLists.txt
new file mode 100644
index 0000000..24c5d9e
--- /dev/null
+++ b/app_broker/nsid_manager/CMakeLists.txt
@@ -0,0 +1,34 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2023, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_minimum_required(VERSION 3.15)
+
+add_library(tfm_nsid_manager STATIC)
+
+target_include_directories(tfm_nsid_manager PUBLIC .)
+
+target_link_libraries(tfm_nsid_manager PRIVATE RTX_OS)
+
+if(TFM_NS_MANAGE_NSID)
+ target_sources(tfm_nsid_manager
+ PUBLIC
+ tfm_nsid_manager.c
+ tfm_nsid_map_table.c
+ tz_shim_layer.c
+ )
+
+ target_compile_definitions(tfm_nsid_manager
+ PUBLIC
+ TFM_NS_MANAGE_NSID
+ $<$<BOOL:${TEST_NS_MANAGE_NSID}>:TEST_NS_MANAGE_NSID>
+ )
+else()
+ target_sources(tfm_nsid_manager
+ PUBLIC
+ tz_stub.c
+ )
+endif()
diff --git a/app_broker/nsid_manager/tfm_nsid_manager.c b/app_broker/nsid_manager/tfm_nsid_manager.c
new file mode 100755
index 0000000..00b38f3
--- /dev/null
+++ b/app_broker/nsid_manager/tfm_nsid_manager.c
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "tfm_ns_client_ext.h"
+#include "tfm_nsid_manager.h"
+
+/* Max number of threads could be customised by RTOS */
+#ifndef THREAD_NUM_MAX
+#define THREAD_NUM_MAX 10
+#endif
+
+/* Map table of token and NSIDs */
+struct nsid_token_pair {
+ uint32_t token;
+ int32_t nsid;
+};
+
+static struct nsid_token_pair test_ns_token_table[THREAD_NUM_MAX];
+
+uint8_t nsid_mgr_init(void)
+{
+ uint32_t i;
+
+ for (i = 0; i < THREAD_NUM_MAX; i++) {
+ test_ns_token_table[i].token = TFM_NS_CLIENT_INVALID_TOKEN;
+ test_ns_token_table[i].nsid = TFM_INVALID_NSID_MIN;
+ }
+
+ return NSID_MGR_ERR_SUCCESS;
+}
+
+uint8_t nsid_mgr_add_entry(int32_t nsid, uint32_t token)
+{
+ uint32_t i;
+
+ if (nsid >= TFM_INVALID_NSID_MIN) {
+ return NSID_MGR_ERR_INVALID_NSID;
+ }
+
+ if (token == TFM_NS_CLIENT_INVALID_TOKEN) {
+ return NSID_MGR_ERR_INVALID_TOKEN;
+ }
+
+ for (i = 0; i < THREAD_NUM_MAX; i++) {
+ if (test_ns_token_table[i].token == TFM_NS_CLIENT_INVALID_TOKEN) {
+ test_ns_token_table[i].token = token;
+ test_ns_token_table[i].nsid = nsid;
+ return NSID_MGR_ERR_SUCCESS;
+ }
+ }
+
+ /* No free entry for new token, return error */
+ return NSID_MGR_ERR_NO_FREE_ENTRY;
+}
+
+uint8_t nsid_mgr_remove_entry(uint32_t token)
+{
+ uint32_t i;
+
+ if (token == TFM_NS_CLIENT_INVALID_TOKEN) {
+ return NSID_MGR_ERR_INVALID_TOKEN;
+ }
+
+ for (i = 0; i < THREAD_NUM_MAX; i++) {
+ if (test_ns_token_table[i].token == token) {
+ test_ns_token_table[i].token = TFM_NS_CLIENT_INVALID_TOKEN;
+ test_ns_token_table[i].nsid = TFM_INVALID_NSID_MIN;
+ return NSID_MGR_ERR_SUCCESS;
+ }
+ }
+
+ /* Token not found in the table, return error */
+ return NSID_MGR_ERR_INVALID_TOKEN;
+}
+
+int32_t nsid_mgr_query_nsid(uint32_t token)
+{
+ uint32_t i;
+
+ /* Return invalid NSID if token is invalid */
+ if (token == TFM_NS_CLIENT_INVALID_TOKEN) {
+ return TFM_INVALID_NSID_MIN;
+ }
+
+ for (i = 0; i < THREAD_NUM_MAX; i++) {
+ if (test_ns_token_table[i].token == token) {
+ return test_ns_token_table[i].nsid;
+ }
+ }
+
+ /* Token not found in the table, return invalid NSID */
+ return TFM_INVALID_NSID_MIN;
+}
diff --git a/app_broker/nsid_manager/tfm_nsid_manager.h b/app_broker/nsid_manager/tfm_nsid_manager.h
new file mode 100755
index 0000000..b42311a
--- /dev/null
+++ b/app_broker/nsid_manager/tfm_nsid_manager.h
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/*
+ * This is a simple implementaton for reference to manage NSID from NS side.
+ * Developers can design the management according to RTOS and usage scenarios.
+ */
+
+#ifndef __TFM_NSID_MANAGER_H__
+#define __TFM_NSID_MANAGER_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+#endif
+
+#define TFM_DEFAULT_GID 0x00
+#define TFM_DEFAULT_NSID ((int32_t)-1)
+/* Non-secure client ID needs to be negative */
+#define TFM_INVALID_NSID_MIN ((int32_t)0)
+
+/* NSID Manager Error Code */
+#define NSID_MGR_ERR_SUCCESS 0x00
+#define NSID_MGR_ERR_INVALID_NSID 0x01
+#define NSID_MGR_ERR_INVALID_TOKEN 0x02
+#define NSID_MGR_ERR_NO_FREE_ENTRY 0x03
+
+/*
+ * Current active NSID token needs to be manually save and reload
+ * before and after calling NS client ext directly from SVC in NSID test suite.
+ */
+#ifdef TEST_NS_MANAGE_NSID
+extern uint32_t current_active_token;
+#endif
+
+/*
+ * Initialize the table to map token and nsid.
+ * This function should be called before any other NSID manager APIs.
+ */
+uint8_t nsid_mgr_init(void);
+
+/*
+ * Add a new nsid-token map entry to the table.
+ * This function should be called once a new token
+ * has been successfully assigned by ns_client_ext.
+ */
+uint8_t nsid_mgr_add_entry(int32_t nsid, uint32_t token);
+
+/*
+ * Delete a nsid-token map entry from the table.
+ * This function should be called once an existing token
+ * has been successfully released by ns_client_ext.
+ */
+uint8_t nsid_mgr_remove_entry(uint32_t token);
+
+/*
+ * Query NSID from the map table with token.
+ * This function is to get NSID assigned by RTOS with token of a NS thread.
+ */
+int32_t nsid_mgr_query_nsid(uint32_t token);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_NSID_MANAGER_H__ */
diff --git a/app_broker/nsid_manager/tfm_nsid_map_table.c b/app_broker/nsid_manager/tfm_nsid_map_table.c
new file mode 100755
index 0000000..5499ccc
--- /dev/null
+++ b/app_broker/nsid_manager/tfm_nsid_map_table.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/*
+ * This is a simple implementaton for reference to assign NSID from NS side.
+ * NSIDs of specific threads are statically pre-assigned.
+ * Other threads use default NSID value -1.
+ *
+ * Developers can design the assignment according to RTOS and usage scenarios.
+ * The assignment can be static or dynamic.
+ */
+
+#include <stdlib.h>
+#include "tfm_nsid_manager.h"
+#include "tfm_nsid_map_table.h"
+
+/* Translation table pair between OS threads and NSIDs */
+struct thread_test_nsid_pair {
+ const char *t_name; /* Task/Thread name */
+ int32_t nsid; /* NSID */
+};
+
+/* -1 is reserved for NSID as a default value */
+static const struct thread_test_nsid_pair test_ns_nsid_table[] =
+{
+ {"Thread_A", -2},
+ {"Thread_B", -3},
+ {"Thread_C", -4},
+ {"Thread_D", -5},
+ {"seq_task", -6},
+ {"mid_task", -7},
+ {"pri_task", -8},
+#ifdef PSA_API_TEST_NS
+ {"psa_api_test", -9}
+#endif
+};
+
+/*
+ * Workaround: strcmp func in string.h would come into a runtime error
+ * on AN521 with ARMCLANG compiler.
+ */
+static int str_cmp(const char* str_a, const char* str_b)
+{
+ int result = 0;
+ uint32_t i = 0;
+
+ while ((str_a[i] != '\0') || (str_b[i] != '\0')) {
+ if (str_a[i] != str_b[i]) {
+ result = 1;
+ break;
+ }
+ i++;
+ }
+
+ return result;
+}
+
+int32_t nsid_mgr_get_thread_nsid(const char* t_name)
+{
+ uint32_t i;
+
+ if (t_name == NULL) {
+ return TFM_DEFAULT_NSID;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(test_ns_nsid_table); i++) {
+ if (str_cmp(test_ns_nsid_table[i].t_name, t_name) == 0) {
+ return test_ns_nsid_table[i].nsid;
+ }
+ }
+
+ /* Thread name not specified in the table, return default NSID */
+ return TFM_DEFAULT_NSID;
+}
diff --git a/app_broker/nsid_manager/tfm_nsid_map_table.h b/app_broker/nsid_manager/tfm_nsid_map_table.h
new file mode 100644
index 0000000..98acdf5
--- /dev/null
+++ b/app_broker/nsid_manager/tfm_nsid_map_table.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_NSID_MAP_TABLE_H__
+#define __TFM_NSID_MAP_TABLE_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Get NSID with the name of thread */
+int32_t nsid_mgr_get_thread_nsid(const char* t_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_NSID_MAP_TABLE_H__ */
diff --git a/app_broker/nsid_manager/tz_shim_layer.c b/app_broker/nsid_manager/tz_shim_layer.c
new file mode 100755
index 0000000..74a12ec
--- /dev/null
+++ b/app_broker/nsid_manager/tz_shim_layer.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/*
+ * This is a simple example implementaton for reference
+ * to make TZ APIs co-work with TF-M NSCE module.
+ *
+ * Developers can implement according to different RTOS and usage scenarios.
+ */
+
+#include "tz_context.h"
+
+#include "tfm_ns_client_ext.h"
+#include "tfm_nsid_manager.h"
+
+#ifdef TFM_NS_MANAGE_NSID
+#define NSID_MGR_THREAD_ID_MAX 0xFF
+#define NSID_MGR_GROUP_ID_DEFAULT 0X00
+/*
+ * 0 is reserved for thread ID in NSID manager to avoid token being set as 0.
+ * TZ_MemoryID_t is used to record the token value.
+ * Scheduler of the RTOS would be disabled if TZ_MemoryID_t is 0.
+ */
+static uint8_t nsid_mgr_thread_id = 1;
+#endif
+
+#ifdef TEST_NS_MANAGE_NSID
+uint32_t current_active_token;
+#endif
+
+/*
+ * TF-M shim layer of the CMSIS TZ RTOS thread context management API
+ */
+
+/*
+ * Initialize token-nsid map table in tfm nsid manager
+ * Return execution status (1: success, 0: error)
+ */
+uint32_t TZ_InitContextSystem_S(void)
+{
+#ifdef TFM_NS_MANAGE_NSID
+ /* Initialize the ns client ext */
+ if (tfm_nsce_init(0) == 0) {
+ return 0U; /* Error */
+ }
+
+ /* Initialize the nsid manager */
+ if (nsid_mgr_init() == NSID_MGR_ERR_SUCCESS) {
+#ifdef TEST_NS_MANAGE_NSID
+ current_active_token = TFM_NS_CLIENT_INVALID_TOKEN;
+#endif
+ return 1U; /* Success */
+ } else {
+ return 0U; /* Error */
+ }
+#else /* TFM_NS_MANAGE_NSID */
+ return 1U; /* Success */
+#endif /* TFM_NS_MANAGE_NSID */
+}
+
+/*
+ * Allocate context memory from Secure side
+ * Param: TZ_ModuleId_t (NSID if TFM_NS_MANAGE_NSID is enabled)
+ * Return token if TFM_NS_MANAGE_NSID is enabled
+ * Return 0 if no memory available or internal error
+ */
+TZ_MemoryId_t TZ_AllocModuleContext_S(TZ_ModuleId_t module)
+{
+#ifdef TFM_NS_MANAGE_NSID
+ int32_t nsid;
+ uint32_t token;
+
+ /* TZ_ModuleID_t is used to record NSID */
+ nsid = (int32_t)module;
+
+ /* New thread ID not available, return error */
+ if (nsid_mgr_thread_id >= NSID_MGR_THREAD_ID_MAX) {
+ return 0U; /* Error */
+ }
+
+ token = tfm_nsce_acquire_ctx(NSID_MGR_GROUP_ID_DEFAULT, nsid_mgr_thread_id++);
+
+ if (nsid_mgr_add_entry(nsid, token) == NSID_MGR_ERR_SUCCESS) {
+ return token; /* Success: return token as TZ_MemoryId_t */
+ } else {
+ return 0U; /* Error */
+ }
+#else /* TFM_NS_MANAGE_NSID */
+ return 1U; /* Success */
+#endif /* TFM_NS_MANAGE_NSID */
+}
+
+/*
+ * Free context memory that was previously allocated with TZ_AllocModuleContext_S
+ * Param: TZ_MemoryId_t (token if TFM_NS_MANAGE_NSID is enabled)
+ * Return execution status (1: success, 0: error)
+ */
+uint32_t TZ_FreeModuleContext_S(TZ_MemoryId_t id)
+{
+#ifdef TFM_NS_MANAGE_NSID
+ uint32_t token;
+
+ /* TZ_MemoryId_t is used to record token */
+ token = (uint32_t)id;
+
+ if (nsid_mgr_remove_entry(token) != NSID_MGR_ERR_SUCCESS) {
+ return 0U; /* Error */
+ }
+
+ if (tfm_nsce_release_ctx(token) == TFM_NS_CLIENT_ERR_SUCCESS) {
+#ifdef TEST_NS_MANAGE_NSID
+ if (current_active_token != TFM_NS_CLIENT_INVALID_TOKEN) {
+ current_active_token = TFM_NS_CLIENT_INVALID_TOKEN;
+ }
+#endif
+ return 1U; /* Success */
+ } else {
+ return 0U; /* Error */
+ }
+#else /* TFM_NS_MANAGE_NSID */
+ return 1U; /* Success */
+#endif /* TFM_NS_MANAGE_NSID */
+}
+
+/*
+ * Load secure context (called on RTOS thread context switch)
+ * Param: TZ_MemoryId_t (token if TFM_NS_MANAGE_NSID is enabled)
+ * Return execution status (1: success, 0: error)
+ */
+uint32_t TZ_LoadContext_S(TZ_MemoryId_t id)
+{
+#ifdef TFM_NS_MANAGE_NSID
+ int32_t nsid;
+ uint32_t token;
+
+ /* TZ_MemoryId_t is used to record token */
+ token = (uint32_t)id;
+
+ nsid = nsid_mgr_query_nsid(token);
+
+ if (nsid >= TFM_INVALID_NSID_MIN) {
+ return 0U; /* Error */
+ }
+
+ if (tfm_nsce_load_ctx(token, nsid) == TFM_NS_CLIENT_ERR_SUCCESS) {
+#ifdef TEST_NS_MANAGE_NSID
+ current_active_token = token;
+#endif
+ return 1U; /* Success */
+ } else {
+ return 0U; /* Error */
+ }
+#else /* TFM_NS_MANAGE_NSID */
+ return 1U; /* Success */
+#endif /* TFM_NS_MANAGE_NSID */
+}
+
+/*
+ * Store secure context (called on RTOS thread context switch)
+ * Param: TZ_MemoryId_t (token if TFM_NS_MANAGE_NSID is enabled)
+ * Return execution status (1: success, 0: error)
+ */
+uint32_t TZ_StoreContext_S(TZ_MemoryId_t id)
+{
+#ifdef TFM_NS_MANAGE_NSID
+ uint32_t token;
+
+ /* TZ_MemoryId_t is used to record token */
+ token = (uint32_t)id;
+
+ if (tfm_nsce_save_ctx(token) == TFM_NS_CLIENT_ERR_SUCCESS) {
+#ifdef TEST_NS_MANAGE_NSID
+ if (current_active_token != TFM_NS_CLIENT_INVALID_TOKEN) {
+ current_active_token = TFM_NS_CLIENT_INVALID_TOKEN;
+ }
+#endif
+ return 1U; /* Success */
+ } else {
+ return 0U; /* Error */
+ }
+#else /* TFM_NS_MANAGE_NSID */
+ return 1U; /* Success */
+#endif /* TFM_NS_MANAGE_NSID */
+}
diff --git a/app_broker/nsid_manager/tz_stub.c b/app_broker/nsid_manager/tz_stub.c
new file mode 100644
index 0000000..306112d
--- /dev/null
+++ b/app_broker/nsid_manager/tz_stub.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2023, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/*
+ * This is a stub functoins for TF-M shim layer of TZ APIs
+ *
+ */
+
+#include "tz_context.h"
+/*
+ * TF-M shim layer of the CMSIS TZ RTOS thread context management API
+ */
+
+/*
+ * Initialize token-nsid map table in tfm nsid manager
+ * Return execution status (1: success, 0: error)
+ */
+uint32_t TZ_InitContextSystem_S(void)
+{
+ return 1U; /* Success */
+}
+
+/*
+ * Allocate context memory from Secure side
+ * Param: TZ_ModuleId_t (NSID if TFM_NS_MANAGE_NSID is enabled)
+ * Return token if TFM_NS_MANAGE_NSID is enabled
+ * Return 0 if no memory available or internal error
+ */
+TZ_MemoryId_t TZ_AllocModuleContext_S(TZ_ModuleId_t module)
+{
+ return 1U; /* Success */
+}
+
+/*
+ * Free context memory that was previously allocated with TZ_AllocModuleContext_S
+ * Param: TZ_MemoryId_t (token if TFM_NS_MANAGE_NSID is enabled)
+ * Return execution status (1: success, 0: error)
+ */
+uint32_t TZ_FreeModuleContext_S(TZ_MemoryId_t id)
+{
+ return 1U; /* Success */
+}
+
+/*
+ * Load secure context (called on RTOS thread context switch)
+ * Param: TZ_MemoryId_t (token if TFM_NS_MANAGE_NSID is enabled)
+ * Return execution status (1: success, 0: error)
+ */
+uint32_t TZ_LoadContext_S(TZ_MemoryId_t id)
+{
+ return 1U; /* Success */
+}
+
+/*
+ * Store secure context (called on RTOS thread context switch)
+ * Param: TZ_MemoryId_t (token if TFM_NS_MANAGE_NSID is enabled)
+ * Return execution status (1: success, 0: error)
+ */
+uint32_t TZ_StoreContext_S(TZ_MemoryId_t id)
+{
+ return 1U; /* Success */
+}
diff --git a/app_broker/os_wrapper/CMakeLists.txt b/app_broker/os_wrapper/CMakeLists.txt
new file mode 100644
index 0000000..d7f043e
--- /dev/null
+++ b/app_broker/os_wrapper/CMakeLists.txt
@@ -0,0 +1,25 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020-2023, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_minimum_required(VERSION 3.13)
+
+add_library(os_wrapper STATIC)
+
+target_sources(os_wrapper
+ PUBLIC
+ os_wrapper_cmsis_rtos_v2.c
+)
+
+target_include_directories(os_wrapper PUBLIC .)
+
+target_link_libraries(os_wrapper
+ PRIVATE
+ psa_interface
+ PUBLIC
+ tfm_nsid_manager
+ RTX_OS
+)
diff --git a/app_broker/os_wrapper/delay.h b/app_broker/os_wrapper/delay.h
new file mode 100644
index 0000000..7e73459
--- /dev/null
+++ b/app_broker/os_wrapper/delay.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2022, Arm Limited. All rights reserved.
+ * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
+ * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __OS_WRAPPER_DELAY_H__
+#define __OS_WRAPPER_DELAY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "os_wrapper/common.h"
+
+/**
+ * \brief Waits for a time period specified in kernel ticks.
+ *
+ * \return \ref OS_WRAPPER_SUCCESS if the time delay is executed, or
+ * \ref OS_WRAPPER_ERROR in case of error
+ */
+int32_t os_wrapper_delay(uint32_t ticks);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_WRAPPER_DELAY_H__ */
diff --git a/app_broker/os_wrapper/msg_queue.h b/app_broker/os_wrapper/msg_queue.h
new file mode 100644
index 0000000..4c9e362
--- /dev/null
+++ b/app_broker/os_wrapper/msg_queue.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2020-2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
+ * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __OS_WRAPPER_MSG_QUEUE_H__
+#define __OS_WRAPPER_MSG_QUEUE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stddef.h>
+
+#include "os_wrapper/common.h"
+
+/**
+ * \brief Create and initialize a message queue
+ *
+ * \param[in] msg_size The maximum message size in bytes
+ * \param[in] msg_count The maximum number of messages in queue
+ *
+ * \return Returns handle of the message queue created, or NULL in case of error
+ */
+void *os_wrapper_msg_queue_create(size_t msg_size, uint8_t msg_count);
+
+/**
+ * \brief Send a message via message queue
+ *
+ * \param[in] mq_handle The handle of message queue
+ * \param[in] msg_ptr The pointer to the message to be sent
+ *
+ * \return \ref OS_WRAPPER_SUCCESS if the message is successfully sent, or
+ * \ref OS_WRAPPER_ERROR in case of error
+ *
+ * \note The message size must be the same as the value set in
+ * \ref os_wrapper_msg_queue_create.
+ *
+ * \note Time out value is not specified here. Whether the function is blocked
+ * or returns instantly depends on the actual implementation and usage
+ * scenario.
+ */
+int32_t os_wrapper_msg_queue_send(void *mq_handle,
+ const void *msg_ptr);
+
+/**
+ * \brief Receive a message from message queue
+ *
+ * \param[in] mq_handle The handle of message queue
+ * \param[in] msg_ptr The pointer to buffer for message to be received
+ *
+ * \return \ref OS_WRAPPER_SUCCESS if the message is successfully received, or
+ * \ref OS_WRAPPER_ERROR in case of error
+ *
+ * \note The message size is the same as the value set in
+ * \ref os_wrapper_msg_queue_create.
+ *
+ * \note The function should be blocked until a message is received from message
+ * queue, unless an error occurs.
+ */
+int32_t os_wrapper_msg_queue_receive(void *mq_handle,
+ void *msg_ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_WRAPPER_MSG_QUEUE_H__ */
diff --git a/app_broker/os_wrapper/os_wrapper_cmsis_rtos_v2.c b/app_broker/os_wrapper/os_wrapper_cmsis_rtos_v2.c
new file mode 100755
index 0000000..005554d
--- /dev/null
+++ b/app_broker/os_wrapper/os_wrapper_cmsis_rtos_v2.c
@@ -0,0 +1,275 @@
+/*
+ * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "thread.h"
+#include "os_wrapper/mutex.h"
+#include "semaphore.h"
+#include "delay.h"
+
+#include "cmsis_os2.h"
+
+#include "tfm_nsid_manager.h"
+#ifdef TFM_NS_MANAGE_NSID
+#include "tfm_nsid_map_table.h"
+#endif
+
+/* This is an example OS abstraction layer for CMSIS-RTOSv2 */
+
+void *os_wrapper_thread_new(const char *name, int32_t stack_size,
+ os_wrapper_thread_func func, void *arg,
+ uint32_t priority)
+{
+ osThreadAttr_t task_attribs = {
+ .tz_module = ((TZ_ModuleId_t)TFM_DEFAULT_NSID)
+ };
+
+ /* By default, the thread starts as osThreadDetached */
+ if (stack_size != OS_WRAPPER_DEFAULT_STACK_SIZE) {
+ task_attribs.stack_size = stack_size;
+ }
+ task_attribs.name = name;
+ task_attribs.priority = (osPriority_t) priority;
+
+#ifdef TFM_NS_MANAGE_NSID
+ task_attribs.tz_module = (TZ_ModuleId_t)nsid_mgr_get_thread_nsid(name);
+#endif
+
+ return (void *)osThreadNew(func, arg, &task_attribs);
+}
+
+void *os_wrapper_semaphore_create(uint32_t max_count, uint32_t initial_count,
+ const char *name)
+{
+ osSemaphoreAttr_t sema_attrib = {0};
+
+ sema_attrib.name = name;
+
+ return (void *)osSemaphoreNew(max_count, initial_count, &sema_attrib);
+}
+
+uint32_t os_wrapper_semaphore_acquire(void *handle, uint32_t timeout)
+{
+ osStatus_t status;
+
+ status = osSemaphoreAcquire((osSemaphoreId_t)handle,
+ (timeout == OS_WRAPPER_WAIT_FOREVER) ?
+ osWaitForever : timeout);
+ if (status != osOK) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+uint32_t os_wrapper_semaphore_release(void *handle)
+{
+ osStatus_t status;
+
+ status = osSemaphoreRelease((osSemaphoreId_t)handle);
+ if (status != osOK) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+uint32_t os_wrapper_semaphore_delete(void *handle)
+{
+ osStatus_t status;
+
+ status = osSemaphoreDelete((osSemaphoreId_t)handle);
+ if (status != osOK) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+void *os_wrapper_mutex_create(void)
+{
+ const osMutexAttr_t attr = {
+ .name = NULL,
+ .attr_bits = osMutexPrioInherit, /* Priority inheritance is recommended
+ * to enable if it is supported.
+ * For recursive mutex and the ability
+ * of auto release when owner being
+ * terminated is not required.
+ */
+ .cb_mem = NULL,
+ .cb_size = 0U
+ };
+
+ return (void *)osMutexNew(&attr);
+}
+
+uint32_t os_wrapper_mutex_acquire(void *handle, uint32_t timeout)
+{
+ osStatus_t status = osOK;
+
+ if (!handle) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ status = osMutexAcquire((osMutexId_t)handle,
+ (timeout == OS_WRAPPER_WAIT_FOREVER) ?
+ osWaitForever : timeout);
+ if (status != osOK) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+uint32_t os_wrapper_mutex_release(void *handle)
+{
+ osStatus_t status = osOK;
+
+ if (!handle) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ status = osMutexRelease((osMutexId_t)handle);
+ if (status != osOK) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+uint32_t os_wrapper_mutex_delete(void *handle)
+{
+ osStatus_t status = osOK;
+
+ if (!handle) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ status = osMutexDelete((osMutexId_t)handle);
+ if (status != osOK) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+void *os_wrapper_thread_get_handle(void)
+{
+ return (void *)osThreadGetId();
+}
+
+uint32_t os_wrapper_thread_get_priority(void *handle, uint32_t *priority)
+{
+ osPriority_t prio;
+
+ prio = osThreadGetPriority((osThreadId_t)handle);
+ if (prio == osPriorityError) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ *priority = (uint32_t)prio;
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+void os_wrapper_thread_exit(void)
+{
+ osThreadExit();
+}
+
+uint32_t os_wrapper_thread_set_flag(void *handle, uint32_t flags)
+{
+ uint32_t ret;
+
+ ret = osThreadFlagsSet((osThreadId_t)handle, flags);
+ if (ret & osFlagsError) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+/*
+ * According to the description of CMSIS-RTOS v2 Thread Flags,
+ * osThreadFlagsSet() can be called inside Interrupt Service Routine.
+ */
+uint32_t os_wrapper_thread_set_flag_isr(void *handle, uint32_t flags)
+{
+ uint32_t ret;
+
+ ret = osThreadFlagsSet((osThreadId_t)handle, flags);
+ if (ret & osFlagsError) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+uint32_t os_wrapper_thread_wait_flag(uint32_t flags, uint32_t timeout)
+{
+ uint32_t ret;
+
+ ret = osThreadFlagsWait(flags, osFlagsWaitAll,
+ (timeout == OS_WRAPPER_WAIT_FOREVER) ?
+ osWaitForever : timeout);
+ if (ret & osFlagsError) {
+ return OS_WRAPPER_ERROR;
+ }
+
+ return OS_WRAPPER_SUCCESS;
+}
+
+uint32_t os_wrapper_get_tick(void)
+{
+ return osKernelGetTickCount();
+}
+
+void *os_wrapper_msg_queue_create(size_t msg_size, uint8_t msg_count)
+{
+ osMessageQueueId_t mq_id;
+
+ mq_id = osMessageQueueNew(msg_count, msg_size, NULL);
+
+ return (void *)mq_id;
+}
+
+int32_t os_wrapper_msg_queue_send(void *mq_handle,
+ const void *msg_ptr)
+{
+ osStatus_t status;
+
+ status = osMessageQueuePut(mq_handle, msg_ptr, 0, 0);
+ if (status == osOK) {
+ return OS_WRAPPER_SUCCESS;
+ }
+
+ return OS_WRAPPER_ERROR;
+}
+
+int32_t os_wrapper_msg_queue_receive(void *mq_handle,
+ void *msg_ptr)
+{
+ osStatus_t status;
+
+ status = osMessageQueueGet(mq_handle, msg_ptr, NULL, osWaitForever);
+ if (status == osOK) {
+ return OS_WRAPPER_SUCCESS;
+ }
+
+ return OS_WRAPPER_ERROR;
+}
+
+int32_t os_wrapper_delay(uint32_t ticks)
+{
+ osStatus_t status;
+
+ status = osDelay(ticks);
+ if (status == osOK) {
+ return OS_WRAPPER_SUCCESS;
+ }
+
+ return OS_WRAPPER_ERROR;
+}
diff --git a/app_broker/os_wrapper/semaphore.h b/app_broker/os_wrapper/semaphore.h
new file mode 100644
index 0000000..ce5aa04
--- /dev/null
+++ b/app_broker/os_wrapper/semaphore.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
+ * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __OS_WRAPPER_SEMAPHORE_H__
+#define __OS_WRAPPER_SEMAPHORE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "os_wrapper/common.h"
+
+/**
+ * \brief Creates a new semaphore
+ *
+ * \param[in] max_count Highest count of the semaphore
+ * \param[in] initial_count Starting count of the available semaphore
+ * \param[in] name Name of the semaphore
+ *
+ * \return Returns handle of the semaphore created, or NULL in case of error
+ */
+void *os_wrapper_semaphore_create(uint32_t max_count, uint32_t initial_count,
+ const char *name);
+
+/**
+ * \brief Acquires the semaphore
+ *
+ * \param[in] hanlde Semaphore handle
+ * \param[in] timeout Timeout value
+ *
+ * \return \ref OS_WRAPPER_SUCCESS in case of successful acquision, or
+ * \ref OS_WRAPPER_ERROR in case of error
+ */
+uint32_t os_wrapper_semaphore_acquire(void *handle, uint32_t timeout);
+
+/**
+ * \brief Releases the semaphore
+ *
+ * \param[in] hanlde Semaphore handle
+ *
+ * \return \ref OS_WRAPPER_SUCCESS in case of successful release, or
+ * \ref OS_WRAPPER_ERROR in case of error
+ */
+uint32_t os_wrapper_semaphore_release(void *handle);
+
+/**
+ * \brief Deletes the semaphore
+ *
+ * \param[in] handle Semaphore handle
+ *
+ * \return \ref OS_WRAPPER_SUCCESS in case of successful release, or
+ * \ref OS_WRAPPER_ERROR in case of error
+ */
+uint32_t os_wrapper_semaphore_delete(void *handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_WRAPPER_SEMAPHORE_H__ */
diff --git a/app_broker/os_wrapper/thread.h b/app_broker/os_wrapper/thread.h
new file mode 100644
index 0000000..83633a6
--- /dev/null
+++ b/app_broker/os_wrapper/thread.h
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
+ * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __OS_WRAPPER_THREAD_H__
+#define __OS_WRAPPER_THREAD_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "os_wrapper/common.h"
+
+/* prototype for the thread entry function */
+typedef void (*os_wrapper_thread_func) (void *argument);
+
+/**
+ * \brief Creates a new thread
+ *
+ * \param[in] name Name of the thread
+ * \param[in] stack_size Size of stack to be allocated for this thread. It can
+ * be \ref OS_WRAPPER_DEFAULT_STACK_SIZE to use the
+ * default value provided by the underlying RTOS
+ * \param[in] func Pointer to the function invoked by thread
+ * \param[in] arg Argument to pass to the function invoked by thread
+ * \param[in] priority Initial thread priority
+ *
+ * \return Returns the thread handle created, or NULL in case of error
+ */
+void *os_wrapper_thread_new(const char *name, int32_t stack_size,
+ os_wrapper_thread_func func, void *arg,
+ uint32_t priority);
+/**
+ * \brief Gets current thread handle
+ *
+ * \return Returns the thread handle, or NULL in case of error
+ */
+void *os_wrapper_thread_get_handle(void);
+
+/**
+ * \brief Gets thread priority
+ *
+ * \param[in] handle Thread handle
+ * \param[out] priority The priority of the thread
+ *
+ * \return Returns \ref OS_WRAPPER_SUCCESS on success, or \ref OS_WRAPPER_ERROR
+ * in case of error
+ */
+uint32_t os_wrapper_thread_get_priority(void *handle, uint32_t *priority);
+
+/**
+ * \brief Exits the calling thread
+ */
+void os_wrapper_thread_exit(void);
+
+/**
+ * \brief Set the event flags for synchronizing a thread specified by handle.
+ *
+ * \note This function may not be allowed to be called from Interrupt Service
+ * Routines.
+ *
+ * \param[in] handle Thread handle to be notified
+ * \param[in] flags Event flags value
+ *
+ * \return Returns \ref OS_WRAPPER_SUCCESS on success, or \ref OS_WRAPPER_ERROR
+ * in case of error
+ */
+uint32_t os_wrapper_thread_set_flag(void *handle, uint32_t flags);
+
+/**
+ * \brief Set the event flags in an interrupt handler for synchronizing a thread
+ * specified by handle.
+ *
+ * \param[in] handle Thread handle to be notified
+ * \param[in] flags Event flags value
+ *
+ * \return Returns \ref OS_WRAPPER_SUCCESS on success, or \ref OS_WRAPPER_ERROR
+ * in case of error
+ */
+uint32_t os_wrapper_thread_set_flag_isr(void *handle, uint32_t flags);
+
+/**
+ * \brief Wait for the event flags for synchronizing threads.
+ *
+ * \note This function may not be allowed to be called from Interrupt Service
+ * Routines.
+ *
+ * \param[in] flags Specify the flags to wait for
+ * \param[in] timeout Timeout value
+ *
+ * \return Returns \ref OS_WRAPPER_SUCCESS on success, or \ref OS_WRAPPER_ERROR
+ * in case of error
+ */
+uint32_t os_wrapper_thread_wait_flag(uint32_t flags, uint32_t timeout);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_WRAPPER_THREAD_H__ */
diff --git a/app_broker/os_wrapper/tick.h b/app_broker/os_wrapper/tick.h
new file mode 100644
index 0000000..de7d2f5
--- /dev/null
+++ b/app_broker/os_wrapper/tick.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2023 Cypress Semiconductor Corporation (an Infineon company)
+ * or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __OS_WRAPPER_TICK_H__
+#define __OS_WRAPPER_TICK_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "os_wrapper/common.h"
+
+/**
+ * \brief Return RTOS current tick count
+ *
+ * \return The current tick count
+ */
+uint32_t os_wrapper_get_tick(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_WRAPPER_TICK_H__ */
diff --git a/app_broker/test_app.h b/app_broker/test_app.h
new file mode 100644
index 0000000..d60827c
--- /dev/null
+++ b/app_broker/test_app.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2017-2022, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TFM_TEST_APP_H__
+#define __TFM_TEST_APP_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Simple macro to mark UNUSED variables
+ *
+ */
+#define UNUSED_VARIABLE(X) ((void)(X))
+
+/**
+ * \brief Main test application for the RTX-TFM core
+ * integration tests
+ *
+ */
+void test_app(void *argument);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TFM_TEST_APP_H__ */