aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSummer Qin <summer.qin@arm.com>2020-08-20 14:20:27 +0800
committerKen Liu <ken.liu@arm.com>2020-08-24 01:10:34 +0000
commit2ecfc9fa17456fd99abb81ea0cae9be6aeec8fa6 (patch)
treea119cadb0f7320094f3a88e66ac54bf01cdd34fd
parentbcbe938945bf9a8964758f4e6a4a29d75f6bea98 (diff)
downloadtrusted-firmware-m-2ecfc9fa17456fd99abb81ea0cae9be6aeec8fa6.tar.gz
Docs: Define tfm_hal_status_t as enum in HAL
TF-M coding style avoids 'typedef' usage for non-function types. Define 'tfm_hal_status_t' as enum type in HAL. Change-Id: Idcd0f35c842030e1a42a1ea57173ec39da3f7f4e Signed-off-by: Summer Qin <summer.qin@arm.com>
-rw-r--r--docs/design_documents/hardware_abstraction_layer.rst43
1 files changed, 10 insertions, 33 deletions
diff --git a/docs/design_documents/hardware_abstraction_layer.rst b/docs/design_documents/hardware_abstraction_layer.rst
index a8b32333ab..b7e1772381 100644
--- a/docs/design_documents/hardware_abstraction_layer.rst
+++ b/docs/design_documents/hardware_abstraction_layer.rst
@@ -129,7 +129,16 @@ This is a status code to be used as the return type of :term:`HAL` APIs.
.. code-block:: c
- typedef int32_t tfm_hal_status_t
+ enum tfm_hal_status_t {
+ TFM_HAL_ERROR_MEM_FAULT = CHAR_MIN,
+ TFM_HAL_ERROR_MAX_VALUE,
+ TFM_HAL_ERROR_BAD_STATE,
+ TFM_HAL_ERROR_NOT_SUPPORTED,
+ TFM_HAL_ERROR_INVALID_INPUT,
+ TFM_HAL_ERROR_NOT_INIT,
+ TFM_HAL_ERROR_GENERIC,
+ TFM_HAL_SUCCESS = 0
+ };
Error Codes
===========
@@ -142,69 +151,37 @@ TFM_HAL_SUCCESS
---------------
Status code to indicate general success.
-.. code-block:: c
-
- #define TFM_HAL_SUCCESS ((tfm_hal_status_t)0)
-
TFM_HAL_ERROR_GENERIC
---------------------
Status code to indicate an error that does not correspond to any defined failure
cause.
-.. code-block:: c
-
- #define TFM_HAL_ERROR_GENERIC ((tfm_hal_status_t)-1)
-
TFM_HAL_ERROR_NOT_INIT
----------------------
Status code to indicate that the module is not initialed.
-.. code-block:: c
-
- #define TFM_HAL_ERROR_NOT_INIT ((tfm_hal_status_t)-2)
-
TFM_HAL_ERROR_INVALID_INPUT
---------------------------
Status code to indicate that the input is invalid.
-.. code-block:: c
-
- #define TFM_HAL_ERROR_INVALID_INPUT ((tfm_hal_status_t)-3)
-
TFM_HAL_ERROR_NOT_SUPPORTED
---------------------------
Status code to indicate that the requested operation or a parameter is not
supported.
-.. code-block:: c
-
- #define TFM_HAL_ERROR_NOT_SUPPORTED ((tfm_hal_status_t)-4)
-
TFM_HAL_ERROR_BAD_STATE
-----------------------
Status code to indicate that the requested action cannot be performed in the
current state.
-.. code-block:: c
-
- #define TFM_HAL_ERROR_BAD_STATE ((tfm_hal_status_t)-5)
-
TFM_HAL_ERROR_MAX_VALUE
-----------------------
Status code to indicate that the current number has got the max value.
-.. code-block:: c
-
- #define TFM_HAL_ERROR_MAX_VALUE ((tfm_hal_status_t)-6)
-
TFM_HAL_ERROR_MEM_FAULT
-----------------------
Status code to indicate that the memory check failed.
-.. code-block:: c
-
- #define TFM_HAL_ERROR_MEM_FAULT ((tfm_hal_status_t)-7)
-
--------------
*Copyright (c) 2020, Arm Limited. All rights reserved.*