Test: Refactor the os_wrapper layer and NS test
This patch refactors the os_wrapper layer and NS test.
- Use consistent naming of functions in the OS wrapper.
- Code style fixes.
- Rename the implementation to highlight that they are
CMSIS-RTOS2 specific examples.
- Reduce stack size used by SST test threads in regression.
- Reorganise the SST test to avoid the usage of thread
join operation.
- Remove un-needed functions.
- Disallow LOG_MSG(...) from Handler mode.
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: Ifbdb3429f006cdf1a97090ed0c5e0db195777969
diff --git a/interface/src/tfm_ns_lock_rtx.c b/interface/src/tfm_ns_lock_cmsis_rtos.c
similarity index 83%
rename from interface/src/tfm_ns_lock_rtx.c
rename to interface/src/tfm_ns_lock_cmsis_rtos.c
index 14fd76a..a81f6e1 100644
--- a/interface/src/tfm_ns_lock_rtx.c
+++ b/interface/src/tfm_ns_lock_cmsis_rtos.c
@@ -15,8 +15,7 @@
/**
* \brief struct ns_lock_state type
*/
-struct ns_lock_state
-{
+struct ns_lock_state {
bool init;
osMutexId_t id;
};
@@ -24,7 +23,7 @@
/**
* \brief ns_lock status
*/
-static struct ns_lock_state ns_lock = {.init=false, .id=NULL};
+static struct ns_lock_state ns_lock = {.init = false, .id = NULL};
/**
* \brief Mutex properties, NS lock
@@ -51,7 +50,7 @@
}
/* TFM request protected by NS lock */
- if (osMutexAcquire(ns_lock.id,osWaitForever) != osOK) {
+ if (osMutexAcquire(ns_lock.id, osWaitForever) != osOK) {
return TFM_ERROR_GENERIC;
}
@@ -67,20 +66,13 @@
/**
* \brief NS world, Init NS lock
*/
-enum tfm_status_e tfm_ns_lock_init()
+enum tfm_status_e tfm_ns_lock_init(void)
{
if (ns_lock.init == false) {
ns_lock.id = osMutexNew(&ns_lock_attrib);
ns_lock.init = true;
return TFM_SUCCESS;
- }
- else {
+ } else {
return TFM_ERROR_GENERIC;
}
}
-
-bool tfm_ns_lock_get_init_state()
-{
- return ns_lock.init;
-}
-