Interface: Add psa/error.h header
Adds the psa/error.h header to the interface/include directory. Removes
definitions from psa/client.h that are now in psa/error.h. Fixes
includes for psa/client.h and psa/service.h so that each one includes
exactly the headers it depends on.
Change-Id: Icf6ae904977a4646f33202edb7d6842c2bc5b5cf
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
diff --git a/interface/include/psa/client.h b/interface/include/psa/client.h
index 71adb80..33e3f2d 100644
--- a/interface/include/psa/client.h
+++ b/interface/include/psa/client.h
@@ -8,13 +8,15 @@
#ifndef __PSA_CLIENT_H__
#define __PSA_CLIENT_H__
+#include <stddef.h>
+#include <stdint.h>
+
+#include "psa/error.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-#include <stdint.h>
-#include <stddef.h>
-
/*********************** PSA Client Macros and Types *************************/
#define PSA_FRAMEWORK_VERSION (0x0100)
@@ -22,7 +24,6 @@
#define PSA_VERSION_NONE (0)
/* PSA response types */
-#define PSA_SUCCESS (0)
#define PSA_CONNECTION_REFUSED (INT32_MIN + 1)
#define PSA_CONNECTION_BUSY (INT32_MIN + 2)
#define PSA_DROP_CONNECTION (INT32_MIN)
@@ -30,7 +31,6 @@
/* PSA message handles */
#define PSA_NULL_HANDLE ((psa_handle_t)0)
-typedef int32_t psa_status_t;
typedef int32_t psa_handle_t;
/**
diff --git a/interface/include/psa/error.h b/interface/include/psa/error.h
new file mode 100644
index 0000000..1107a24
--- /dev/null
+++ b/interface/include/psa/error.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+/**
+ * \file psa/error.h
+ * \brief Standard error codes for the SPM and RoT Services
+ */
+
+#ifndef __PSA_ERROR_H__
+#define __PSA_ERROR_H__
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef int32_t psa_status_t;
+
+#define PSA_SUCCESS ((psa_status_t)0)
+
+#define PSA_ERROR_PROGRAMMER_ERROR ((psa_status_t)-129)
+#define PSA_ERROR_CONNECTION_REFUSED ((psa_status_t)-130)
+#define PSA_ERROR_CONNECTION_BUSY ((psa_status_t)-131)
+#define PSA_ERROR_GENERIC_ERROR ((psa_status_t)-132)
+#define PSA_ERROR_NOT_PERMITTED ((psa_status_t)-133)
+#define PSA_ERROR_NOT_SUPPORTED ((psa_status_t)-134)
+#define PSA_ERROR_INVALID_ARGUMENT ((psa_status_t)-135)
+#define PSA_ERROR_INVALID_HANDLE ((psa_status_t)-136)
+#define PSA_ERROR_BAD_STATE ((psa_status_t)-137)
+#define PSA_ERROR_BUFFER_TOO_SMALL ((psa_status_t)-138)
+#define PSA_ERROR_ALREADY_EXISTS ((psa_status_t)-139)
+#define PSA_ERROR_DOES_NOT_EXIST ((psa_status_t)-140)
+#define PSA_ERROR_INSUFFICIENT_MEMORY ((psa_status_t)-141)
+#define PSA_ERROR_INSUFFICIENT_STORAGE ((psa_status_t)-142)
+#define PSA_ERROR_INSUFFICIENT_DATA ((psa_status_t)-143)
+#define PSA_ERROR_SERVICE_FAILURE ((psa_status_t)-144)
+#define PSA_ERROR_COMMUNICATION_FAILURE ((psa_status_t)-145)
+#define PSA_ERROR_STORAGE_FAILURE ((psa_status_t)-146)
+#define PSA_ERROR_HARDWARE_FAILURE ((psa_status_t)-147)
+#define PSA_ERROR_INVALID_SIGNATURE ((psa_status_t)-149)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __PSA_ERROR_H__ */
diff --git a/interface/include/psa/service.h b/interface/include/psa/service.h
index 2e8558a..9af3f67 100644
--- a/interface/include/psa/service.h
+++ b/interface/include/psa/service.h
@@ -8,14 +8,16 @@
#ifndef __PSA_SERVICE_H__
#define __PSA_SERVICE_H__
+#include <stddef.h>
+#include <stdint.h>
+
+#include "psa/error.h"
+#include "psa/client.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-#include <inttypes.h>
-
-#include "psa/client.h"
-
/********************** PSA Secure Partition Macros and Types ****************/
/* PSA wait timeouts */