Add packed-c protocol support for crypto service
To provide a lightweight parameter encoding that is aligned to
conventions used by SCMI, the packed-c parameter serialization has
been added to the crypto service. This builds on generic
components that allow other packed-c service access protocols
to be added easily. Service level tests have been extended to
use both protobuf and packed-c clients.
Signed-off-by: julhal01 <julian.hall@arm.com>
Change-Id: I9279b0814bcc9cf6c4aa4e30629e2f46f2df4c23
diff --git a/components/rpc/common/test/protocol/check_rpc_status_alignment.cpp b/components/rpc/common/test/protocol/check_rpc_status_alignment.cpp
new file mode 100644
index 0000000..81cf64e
--- /dev/null
+++ b/components/rpc/common/test/protocol/check_rpc_status_alignment.cpp
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#include <rpc/common/protobuf/status.pb.h>
+#include <protocols/rpc/common/packed-c/status.h>
+#include <CppUTest/TestHarness.h>
+
+/*
+ * Check alignment of RPC status protocol values for different protocol
+ * definition schemes.
+ */
+TEST_GROUP(RpcStatusProtocolChecks) {
+
+};
+
+TEST(RpcStatusProtocolChecks, checkProtobufRpcStatusCodes) {
+
+ /*
+ * Check alignment between packed-c and protobuf rpc status codes
+ */
+ LONGS_EQUAL(TS_RPC_CALL_ACCEPTED, ts_rpc_Status_CALL_ACCEPTED);
+ LONGS_EQUAL(TS_RPC_ERROR_EP_DOES_NOT_EXIT, ts_rpc_Status_ERROR_EP_DOES_NOT_EXIT);
+ LONGS_EQUAL(TS_RPC_ERROR_INVALID_OPCODE, ts_rpc_Status_ERROR_INVALID_OPCODE);
+ LONGS_EQUAL(TS_RPC_ERROR_SERIALIZATION_NOT_SUPPORTED, ts_rpc_Status_ERROR_SERIALIZATION_NOT_SUPPORTED);
+ LONGS_EQUAL(TS_RPC_ERROR_INVALID_REQ_BODY, ts_rpc_Status_ERROR_INVALID_REQ_BODY);
+ LONGS_EQUAL(TS_RPC_ERROR_INVALID_RESP_BODY, ts_rpc_Status_ERROR_INVALID_RESP_BODY);
+ LONGS_EQUAL(TS_RPC_ERROR_RESOURCE_FAILURE, ts_rpc_Status_ERROR_RESOURCE_FAILURE);
+ LONGS_EQUAL(TS_RPC_ERROR_NOT_READY, ts_rpc_Status_ERROR_NOT_READY);
+ LONGS_EQUAL(TS_RPC_ERROR_INVALID_TRANSACTION, ts_rpc_Status_ERROR_INVALID_TRANSACTION);
+ LONGS_EQUAL(TS_RPC_ERROR_INTERNAL, ts_rpc_Status_ERROR_INTERNAL);
+ LONGS_EQUAL(TS_RPC_ERROR_INVALID_PARAMETER, ts_rpc_Status_ERROR_INVALID_PARAMETER);
+}
\ No newline at end of file
diff --git a/components/rpc/common/test/protocol/component.cmake b/components/rpc/common/test/protocol/component.cmake
new file mode 100644
index 0000000..8c7dabe
--- /dev/null
+++ b/components/rpc/common/test/protocol/component.cmake
@@ -0,0 +1,14 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+if (NOT DEFINED TGT)
+ message(FATAL_ERROR "mandatory parameter TGT is not defined.")
+endif()
+
+target_sources(${TGT} PRIVATE
+ "${CMAKE_CURRENT_LIST_DIR}/check_rpc_status_alignment.cpp"
+ )
+