summaryrefslogtreecommitdiff
path: root/nrfdemo/build/tfm/api_ns/interface/include/os_wrapper
diff options
context:
space:
mode:
authorMichal Hanus <mikehanus@protonmail.com>2025-04-14 22:04:32 +0200
committerMichal Hanus <mikehanus@protonmail.com>2025-04-14 22:04:32 +0200
commit2e13c372f1419f08dab7797b244681f889dd9bcf (patch)
tree995a31c40f13068c4135c213e938e0a2a9ed05a3 /nrfdemo/build/tfm/api_ns/interface/include/os_wrapper
parent620dfd94019f3c7e3022fa5a5fb9c9b51491062d (diff)
nrfdemo
Diffstat (limited to 'nrfdemo/build/tfm/api_ns/interface/include/os_wrapper')
-rw-r--r--nrfdemo/build/tfm/api_ns/interface/include/os_wrapper/common.h26
-rw-r--r--nrfdemo/build/tfm/api_ns/interface/include/os_wrapper/mutex.h65
2 files changed, 91 insertions, 0 deletions
diff --git a/nrfdemo/build/tfm/api_ns/interface/include/os_wrapper/common.h b/nrfdemo/build/tfm/api_ns/interface/include/os_wrapper/common.h
new file mode 100644
index 0000000..6494723
--- /dev/null
+++ b/nrfdemo/build/tfm/api_ns/interface/include/os_wrapper/common.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __OS_WRAPPER_COMMON_H__
+#define __OS_WRAPPER_COMMON_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define OS_WRAPPER_SUCCESS (0x0)
+#define OS_WRAPPER_ERROR (0xFFFFFFFFU)
+#define OS_WRAPPER_WAIT_FOREVER (0xFFFFFFFFU)
+#define OS_WRAPPER_DEFAULT_STACK_SIZE (-1)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_WRAPPER_COMMON_H__ */
diff --git a/nrfdemo/build/tfm/api_ns/interface/include/os_wrapper/mutex.h b/nrfdemo/build/tfm/api_ns/interface/include/os_wrapper/mutex.h
new file mode 100644
index 0000000..ffdf92c
--- /dev/null
+++ b/nrfdemo/build/tfm/api_ns/interface/include/os_wrapper/mutex.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2017-2019, 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_MUTEX_H__
+#define __OS_WRAPPER_MUTEX_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "os_wrapper/common.h"
+
+/**
+ * \brief Creates a mutex for mutual exclusion of resources
+ *
+ * \return The handle of the created mutex on success or NULL on error
+ */
+void *os_wrapper_mutex_create(void);
+
+/**
+ * \brief Acquires a mutex that is created by \ref os_wrapper_mutex_create()
+ *
+ * \param[in] handle The handle of the mutex to acquire. Should be one of the
+ * handles returned by \ref os_wrapper_mutex_create()
+ * \param[in] timeout The maximum amount of time(in tick periods) for the
+ * thread to wait for the mutex to be available.
+ * If timeout is zero, the function will return immediately.
+ * Setting timeout to \ref OS_WRAPPER_WAIT_FOREVER will
+ * cause the thread to wait indefinitely
+ *
+ * \return \ref OS_WRAPPER_SUCCESS on success or \ref OS_WRAPPER_ERROR on error
+ * or timeout
+ */
+uint32_t os_wrapper_mutex_acquire(void *handle, uint32_t timeout);
+
+/**
+ * \brief Releases the mutex acquired previously
+ *
+
+ * \param[in] handle The handle of the mutex that has been acquired
+ *
+ * \return \ref OS_WRAPPER_SUCCESS on success or \ref OS_WRAPPER_ERROR on error
+ */
+uint32_t os_wrapper_mutex_release(void *handle);
+
+/**
+ * \brief Deletes a mutex that is created by \ref os_wrapper_mutex_create()
+ *
+ * \param[in] handle The handle of the mutex to be deleted
+ *
+ * \return \ref OS_WRAPPER_SUCCESS on success or \ref OS_WRAPPER_ERROR on error
+ */
+uint32_t os_wrapper_mutex_delete(void *handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_WRAPPER_MUTEX_H__ */