App: Add event flags set and wait operations for thread synchronization
Add os_wrapper_thread_set_flag(), os_wrapper_thread_set_flag_isr()
and os_wrapper_thread_wait_flag() to provide event flags set and
wait operations for synchronizing threads in NS application.
Implement the above APIs by CMSIS-RTOS v2 Thread Flags as an
example.
Change-Id: Ifb7ffe22c27973725b8601e9037d807cfeadb8ad
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/interface/include/os_wrapper/thread.h b/interface/include/os_wrapper/thread.h
index 8386bd5..a493593 100644
--- a/interface/include/os_wrapper/thread.h
+++ b/interface/include/os_wrapper/thread.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -56,6 +56,46 @@
*/
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