Add generic RPC layer
Adds generic RPC caller and endpoint. This is the base for specialized
RPC communication using e.g. FF-A messaging. The protocol description
is implemented in two flavours: packed C structures and protobuf.
Change-Id: I17f450b7272bd4008fc20fe8f716a253f6754000
Signed-off-by: Julian Hall <julian.hall@arm.com>
diff --git a/protocols/rpc/common/packed-c/test/check_rpc_status_packed-c.cpp b/protocols/rpc/common/packed-c/test/check_rpc_status_packed-c.cpp
new file mode 100644
index 0000000..c377957
--- /dev/null
+++ b/protocols/rpc/common/packed-c/test/check_rpc_status_packed-c.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2020, 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 packed-c protocol values.
+ */
+TEST_GROUP(PackedCrpcCommonProtocolChecks) {
+
+};
+
+TEST(PackedCrpcCommonProtocolChecks, checkRpcStatusCodes) {
+
+ /*
+ * Check alignment between packed-c and protobuf rpc status codes
+ */
+ CHECK_EQUAL(TS_RPC_CALL_ACCEPTED, ts_rpc_Status_CALL_ACCEPTED);
+ CHECK_EQUAL(TS_RPC_ERROR_EP_DOES_NOT_EXIT, ts_rpc_Status_ERROR_EP_DOES_NOT_EXIT);
+ CHECK_EQUAL(TS_RPC_ERROR_INVALID_OPCODE, ts_rpc_Status_ERROR_INVALID_OPCODE);
+ CHECK_EQUAL(TS_RPC_ERROR_SERIALIZATION_NOT_SUPPORTED, ts_rpc_Status_ERROR_SERIALIZATION_NOT_SUPPORTED);
+ CHECK_EQUAL(TS_RPC_ERROR_INVALID_REQ_BODY, ts_rpc_Status_ERROR_INVALID_REQ_BODY);
+ CHECK_EQUAL(TS_RPC_ERROR_INVALID_RESP_BODY, ts_rpc_Status_ERROR_INVALID_RESP_BODY);
+ CHECK_EQUAL(TS_RPC_ERROR_RESOURCE_FAILURE, ts_rpc_Status_ERROR_RESOURCE_FAILURE);
+ CHECK_EQUAL(TS_RPC_ERROR_NOT_READY, ts_rpc_Status_ERROR_NOT_READY);
+ CHECK_EQUAL(TS_RPC_ERROR_INVALID_TRANSACTION, ts_rpc_Status_ERROR_INVALID_TRANSACTION);
+ CHECK_EQUAL(TS_RPC_ERROR_INTERNAL, ts_rpc_Status_ERROR_INTERNAL);
+ CHECK_EQUAL(TS_RPC_ERROR_INVALID_PARAMETER, ts_rpc_Status_ERROR_INVALID_PARAMETER);
+}
\ No newline at end of file
diff --git a/protocols/rpc/common/packed-c/test/component.cmake b/protocols/rpc/common/packed-c/test/component.cmake
new file mode 100644
index 0000000..28a896b
--- /dev/null
+++ b/protocols/rpc/common/packed-c/test/component.cmake
@@ -0,0 +1,14 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, 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_packed-c.cpp"
+ )
+