Interface: Refactor NS lock and SVC's interface
The NS lock implementation is refactored to use X
macros. This improves maintenability and readability
as limits only to tfm_ns_svc.h the file to be modified
when a new SVC interface has to be added. The SVC
declarations are also amended to use X macros.
Change-Id: I5d20e9a99c3193594b8882967be085406b8a354b
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
diff --git a/app/main_ns.c b/app/main_ns.c
index 1af2c23..13725d0 100644
--- a/app/main_ns.c
+++ b/app/main_ns.c
@@ -14,14 +14,7 @@
#include "cmsis_os2.h"
#include "tfm_integ_test.h"
#include "tfm_ns_svc.h"
-#include "tfm_sst_svc_handler.h"
#include "tfm_ns_lock.h"
-#ifdef TFM_PARTITION_TEST_CORE
-#include "svc_core_test_ns.h"
-#endif
-#ifdef TFM_PARTITION_TEST_SST
-#include "sst_test_service_svc.h"
-#endif
#ifdef TEST_FRAMEWORK_NS
#include "test/framework/integ_test.h"
#endif
@@ -41,31 +34,24 @@
void * const osRtxUserSVC[1+USER_SVC_COUNT] = {
(void *)USER_SVC_COUNT,
-/* SERVICES_TEST_NS */
- (void *)tfm_sst_svc_get_handle,
- (void *)tfm_sst_svc_create,
- (void *)tfm_sst_svc_get_attributes,
- (void *)tfm_sst_svc_read,
- (void *)tfm_sst_svc_write,
- (void *)tfm_sst_svc_delete,
+#define X(SVC_ENUM, SVC_HANDLER) (void*)SVC_HANDLER,
+ /* SVC API for Services */
+ LIST_SVC_DISPATCHERS
#if defined(CORE_TEST_INTERACTIVE)
- (void *)svc_secure_decrement_ns_lock_1,
- (void *)svc_secure_decrement_ns_lock_2,
+ LIST_SVC_CORE_TEST_INTERACTIVE
#endif /* CORE_TEST_INTERACTIVE */
#if defined(TFM_PARTITION_TEST_CORE)
- (void *)svc_tfm_core_test,
- (void *)svc_tfm_core_test_multiple_calls,
+ LIST_SVC_TFM_PARTITION_TEST_CORE
#endif /* TFM_PARTITION_TEST_CORE */
#if defined(TFM_PARTITION_TEST_SST)
- (void *)sst_test_service_svc_setup,
- (void *)sst_test_service_svc_dummy_encrypt,
- (void *)sst_test_service_svc_dummy_decrypt,
- (void *)sst_test_service_svc_clean,
+ LIST_SVC_TFM_PARTITION_TEST_SST
#endif /* TFM_PARTITION_TEST_SST */
+#undef X
+
//(void *)user_function1,
// ...
};
diff --git a/app/tfm_integ_test.h b/app/tfm_integ_test.h
index 5be104b..a823ff1 100644
--- a/app/tfm_integ_test.h
+++ b/app/tfm_integ_test.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -26,15 +26,6 @@
*/
#define UNUSED_VARIABLE(X) ((void)(X))
-/**
- * \brief Declarations for User defined SVC functions
- * used in CORE_TEST_INTERACTIVE or
- * CORE_TEST_POSITIVE
- *
- */
-void svc_secure_decrement_ns_lock_1(void);
-void svc_secure_decrement_ns_lock_2(void);
-
#ifdef TEST_FRAMEWORK_NS
/**
* \brief Main test application for the RTX-TFM core