aboutsummaryrefslogtreecommitdiff
path: root/interface/include
diff options
context:
space:
mode:
authorDavid Hu <david.hu@arm.com>2021-04-06 18:03:33 +0800
committerDavid Hu <david.hu@arm.com>2021-04-29 08:56:18 +0200
commitf07f3f16c35beed23772e83453a7c08d0b78ddb8 (patch)
treeba2fdf5865104d1b272af6db21589ac1047c5bc0 /interface/include
parent7c2a744b3712f481b9dc7ab89bcc0ef5cb30f5fa (diff)
downloadtrusted-firmware-m-f07f3f16c35beed23772e83453a7c08d0b78ddb8.tar.gz
Interface: Remove NS RTOS specific implementation
Move NS RTOS related interface code to tf-m-test to decouple TF-M from NS specific implementation. The removed code includes OS wrapper headers and RTOS specific implementation. Export tfm_ns_interface_dispatch() to NS as API to integrate with TF-M NS interface. Add an example of tfm_ns_interface_dispatch() implementation. Change-Id: I9b331c32ac26551bfdbc4996eecd08efc7d7c2c3 Signed-off-by: David Hu <david.hu@arm.com>
Diffstat (limited to 'interface/include')
-rw-r--r--interface/include/os_wrapper/common.h26
-rw-r--r--interface/include/os_wrapper/msg_queue.h70
-rw-r--r--interface/include/os_wrapper/mutex.h62
-rw-r--r--interface/include/os_wrapper/semaphore.h64
-rw-r--r--interface/include/os_wrapper/thread.h103
-rw-r--r--interface/include/os_wrapper/tick.h28
-rw-r--r--interface/include/tfm_ns_interface.h22
7 files changed, 7 insertions, 368 deletions
diff --git a/interface/include/os_wrapper/common.h b/interface/include/os_wrapper/common.h
deleted file mode 100644
index 6494723030..0000000000
--- a/interface/include/os_wrapper/common.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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/interface/include/os_wrapper/msg_queue.h b/interface/include/os_wrapper/msg_queue.h
deleted file mode 100644
index ac69773f10..0000000000
--- a/interface/include/os_wrapper/msg_queue.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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__ */
diff --git a/interface/include/os_wrapper/mutex.h b/interface/include/os_wrapper/mutex.h
deleted file mode 100644
index e55ef706e2..0000000000
--- a/interface/include/os_wrapper/mutex.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2017-2019, Arm Limited. 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 "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
- */
-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__ */
diff --git a/interface/include/os_wrapper/semaphore.h b/interface/include/os_wrapper/semaphore.h
deleted file mode 100644
index 83d88cac65..0000000000
--- a/interface/include/os_wrapper/semaphore.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2017-2020, Arm Limited. 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 "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/interface/include/os_wrapper/thread.h b/interface/include/os_wrapper/thread.h
deleted file mode 100644
index a493593a61..0000000000
--- a/interface/include/os_wrapper/thread.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2017-2020, Arm Limited. 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 "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/interface/include/os_wrapper/tick.h b/interface/include/os_wrapper/tick.h
deleted file mode 100644
index b377b0e5fb..0000000000
--- a/interface/include/os_wrapper/tick.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2020, Arm Limited. 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 "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/interface/include/tfm_ns_interface.h b/interface/include/tfm_ns_interface.h
index 1dd0692571..fa0cc31746 100644
--- a/interface/include/tfm_ns_interface.h
+++ b/interface/include/tfm_ns_interface.h
@@ -24,11 +24,14 @@ typedef int32_t (*veneer_fn) (uint32_t arg0, uint32_t arg1,
* desired veneer function, to be called with the parameters
* described from arg0 to arg3.
*
+ * \note NSPE shall implement this dispatcher according to NS specific
+ * implementation and actual usage scenario.
+ *
* \param[in] fn Function pointer to the veneer function desired
- * \param[in] arg0 Argument 0
- * \param[in] arg1 Argument 1
- * \param[in] arg2 Argument 2
- * \param[in] arg3 Argument 3
+ * \param[in] arg0 Argument 0 of fn
+ * \param[in] arg1 Argument 1 of fn
+ * \param[in] arg2 Argument 2 of fn
+ * \param[in] arg3 Argument 3 of fn
*
* \return Returns the same return value of the requested veneer function
*
@@ -40,17 +43,6 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn,
uint32_t arg0, uint32_t arg1,
uint32_t arg2, uint32_t arg3);
-/**
- * \brief NS interface, Initialise the NS interface
- *
- * \details This function needs to be called from the NS world to
- * properly initialise the NS interface towards TF-M. This
- * function will initialise all the objects required for
- * runtime dispatching of TF-M requests to services
- *
- * \return A value according to \ref enum tfm_status_e
- */
-enum tfm_status_e tfm_ns_interface_init(void);
#ifdef __cplusplus
}
#endif