aboutsummaryrefslogtreecommitdiff
path: root/interface
diff options
context:
space:
mode:
authorDavid Hu <david.hu@arm.com>2020-06-12 13:47:24 +0800
committerDavid Hu <david.hu@arm.com>2021-02-05 03:32:50 +0000
commit62f05aabbd98c18b490a2381f72425b01c8470d0 (patch)
tree9f6da10fb8e329118074043ee7f1012dc3b220b1 /interface
parent83650a2a4b61daa8b1189e4e0567d19823eebcea (diff)
downloadtrusted-firmware-m-62f05aabbd98c18b490a2381f72425b01c8470d0.tar.gz
Dualcpu: Add RTOS message queue wrappers
Add RTOS message queue wrappers to support dual-cpu multiple PSA client calls. Change-Id: Ic1c2eefec7eb9434fe027fd4a2ed66b2a8711970 Signed-off-by: David Hu <david.hu@arm.com>
Diffstat (limited to 'interface')
-rw-r--r--interface/include/os_wrapper/msg_queue.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/interface/include/os_wrapper/msg_queue.h b/interface/include/os_wrapper/msg_queue.h
new file mode 100644
index 000000000..ac69773f1
--- /dev/null
+++ b/interface/include/os_wrapper/msg_queue.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2020-2021, Arm Limited. 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 "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__ */