Core: move PSA API sources into `ipc` directory

Move ipc related source code to 'ipc' folder for easier code
browsing. This also readies codebase for future additions.

Change-Id: Icc78338a3832b73e9a71bf33577829bf310da890
Signed-off-by: Ken Liu <ken.liu@arm.com>
diff --git a/secure_fw/CMakeLists.txt b/secure_fw/CMakeLists.txt
index 248c8eb..75e19d6 100644
--- a/secure_fw/CMakeLists.txt
+++ b/secure_fw/CMakeLists.txt
@@ -32,6 +32,10 @@
 include(${SECURE_FW_DIR}/spm/CMakeLists.inc)
 include(${SECURE_FW_DIR}/core/CMakeLists.inc)
 include(${SECURE_FW_DIR}/ns_callable/CMakeLists.inc)
+# Involve IPC sources only PSA APIs are there
+if(TFM_PSA_API)
+	include(${SECURE_FW_DIR}/core/ipc/CMakeLists.inc)
+endif()
 
 set(BUILD_CMSIS_CORE On)
 set(BUILD_RETARGET On)
diff --git a/secure_fw/core/CMakeLists.inc b/secure_fw/core/CMakeLists.inc
index c108aa8..2c80817 100644
--- a/secure_fw/core/CMakeLists.inc
+++ b/secure_fw/core/CMakeLists.inc
@@ -39,11 +39,7 @@
 if (NOT DEFINED TFM_PSA_API)
 	message(FATAL_ERROR "Incomplete build configuration: TFM_PSA_API is undefined. ")
 elseif (TFM_PSA_API)
-	list(APPEND SS_CORE_C_SRC "${SS_CORE_DIR}/tfm_psa_api_client.c"
-				"${SS_CORE_DIR}/tfm_thread.c"
-				"${SS_CORE_DIR}/tfm_queue.c"
-				"${SS_CORE_DIR}/psa_api.c"
-				)
+	list(APPEND SS_CORE_C_SRC "${SS_CORE_DIR}/tfm_psa_api_client.c")
 endif()
 
 #Append all our source files to global lists.
diff --git a/secure_fw/core/ipc/CMakeLists.inc b/secure_fw/core/ipc/CMakeLists.inc
new file mode 100644
index 0000000..4753fdb
--- /dev/null
+++ b/secure_fw/core/ipc/CMakeLists.inc
@@ -0,0 +1,59 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "ipc" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+#	TFM_ROOT_DIR - directory where secure FW sourec is located.
+#
+#Outputs:
+#	Will modify include directories to make the source compile.
+#	ALL_SRC_C: C source files to be compiled will be added to this list.
+#	  This shall be added to your add_executable or add_library command.
+#	ALL_SRC_CXX: C++ source files to be compiled will be added to this list.
+#	  This shall be added to your add_executable or add_library command.
+#	ALL_SRC_ASM: assembly source files to be compiled will be added to this
+#	  list. This shall be added to your add_executable or add_library
+#	  command.
+#	Include directories will be modified by using the include_directories()
+#	  commands as needed.
+
+#Get the current directory where this file is located.
+set(SS_IPC_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+	message(FATAL_ERROR
+		"Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+if (NOT DEFINED TFM_PSA_API)
+	message(FATAL_ERROR "Incomplete build configuration: TFM_PSA_API is undefined. ")
+elseif (TFM_PSA_API)
+	set (SS_IPC_C_SRC "${SS_IPC_DIR}/tfm_thread.c"
+			"${SS_IPC_DIR}/tfm_queue.c"
+			"${SS_IPC_DIR}/psa_api.c"
+			)
+endif()
+
+#Append all our source files to global lists.
+list(APPEND ALL_SRC_C ${SS_IPC_C_SRC})
+unset(SS_IPC_C_SRC)
+
+#Setting include directories
+embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core/ipc ABSOLUTE)
+
+if(NOT DEFINED PLATFORM_CMAKE_FILE)
+	message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
+elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
+	message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
+else()
+	include(${PLATFORM_CMAKE_FILE})
+endif()
diff --git a/secure_fw/core/psa_api.c b/secure_fw/core/ipc/psa_api.c
similarity index 100%
rename from secure_fw/core/psa_api.c
rename to secure_fw/core/ipc/psa_api.c
diff --git a/secure_fw/core/tfm_queue.c b/secure_fw/core/ipc/tfm_queue.c
similarity index 100%
rename from secure_fw/core/tfm_queue.c
rename to secure_fw/core/ipc/tfm_queue.c
diff --git a/secure_fw/core/tfm_queue.h b/secure_fw/core/ipc/tfm_queue.h
similarity index 100%
rename from secure_fw/core/tfm_queue.h
rename to secure_fw/core/ipc/tfm_queue.h
diff --git a/secure_fw/core/tfm_thread.c b/secure_fw/core/ipc/tfm_thread.c
similarity index 100%
rename from secure_fw/core/tfm_thread.c
rename to secure_fw/core/ipc/tfm_thread.c
diff --git a/secure_fw/core/tfm_thread.h b/secure_fw/core/ipc/tfm_thread.h
similarity index 100%
rename from secure_fw/core/tfm_thread.h
rename to secure_fw/core/ipc/tfm_thread.h
diff --git a/test/test_services/tfm_ipc_test/ipc_test_service.c b/test/test_services/tfm_ipc_test/ipc_test_service.c
index ab1a1f1..404493f 100644
--- a/test/test_services/tfm_ipc_test/ipc_test_service.c
+++ b/test/test_services/tfm_ipc_test/ipc_test_service.c
@@ -9,7 +9,7 @@
 #include <stdio.h>
 #include "psa_client.h"
 #include "psa_service.h"
-#include "secure_fw/core/tfm_thread.h"
+#include "secure_fw/core/ipc/tfm_thread.h"
 #include "secure_fw/core/secure_utilities.h"
 #include "secure_fw/core/tfm_secure_api.h"
 #include "tfm_api.h"