Platform: Create platform service for pin functions
This patch creates new platform service API for
alternate functions, default input and pin mode setting.
The functions are implemented only for Musca B1,
not needed on Musca A, AN519 and AN521
Change-Id: Ic6d6dbeafe059aadc4f57a066513281afa8aa61b
Signed-off-by: Tamas Kaman <tamas.kaman@arm.com>
diff --git a/interface/include/tfm_platform_api.h b/interface/include/tfm_platform_api.h
index 1c3069e..7cc57ab 100644
--- a/interface/include/tfm_platform_api.h
+++ b/interface/include/tfm_platform_api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -9,6 +9,7 @@
#define __TFM_PLATFORM_API__
#include <limits.h>
+#include <stdbool.h>
#include "tfm_api.h"
#ifdef __cplusplus
@@ -19,7 +20,7 @@
* \brief TFM secure partition platform API version
*/
#define TFM_PLATFORM_API_VERSION_MAJOR (0)
-#define TFM_PLATFORM_API_VERSION_MINOR (1)
+#define TFM_PLATFORM_API_VERSION_MINOR (2)
/* The return value is shared with the TF-M partition status value.
* The Platform return codes shouldn't overlap with predefined TFM status
@@ -36,6 +37,7 @@
enum tfm_platform_err_t {
TFM_PLATFORM_ERR_SUCCESS = 0,
TFM_PLATFORM_ERR_SYSTEM_ERROR = TFM_PLATFORM_ERR_OFFSET,
+ TFM_PLATFORM_ERR_INVALID_PARAM,
/* Following entry is only to ensure the error code of int size */
TFM_PLATFORM_ERR_FORCE_INT_SIZE = INT_MAX
@@ -48,6 +50,50 @@
*/
enum tfm_platform_err_t tfm_platform_system_reset(void);
+/*!
+ * \brief Sets pin alternate function for the given pins
+ *
+ * \param[in] alt_func Alternate function to set (allowed values vary
+ * based on the platform)
+ * \param[in] pin_mask Pin mask of the selected pins
+ * \param[out] result Return error value
+ *
+ * \return Returns values as specified by the \ref tfm_platform_err_t
+ */
+enum tfm_platform_err_t
+tfm_platform_set_pin_alt_func(uint32_t alt_func, uint64_t pin_mask,
+ uint32_t *result);
+
+/*!
+ * \brief Sets default in value to use when the alternate function is not
+ * selected for the pin
+ *
+ * \param[in] alt_func Alternate function to use (allowed values vary
+ * based on the platform)
+ * \param[in] pin_value Pin value to use
+ * \param[in] default_in_value Default in value to set
+ * \param[out] result Return error value
+ *
+ * \return Returns values as specified by the \ref tfm_platform_err_t
+ */
+enum tfm_platform_err_t
+tfm_platform_set_pin_default_in(uint32_t alt_func, uint32_t pin_value,
+ bool default_in_value, uint32_t *result);
+
+/*!
+ * \brief Sets pin mode for the selected pins
+ *
+ * \param[in] pin_mask Pin mask of the selected pins
+ * \param[in] pin_mode Pin mode to set for the selected pins
+ * \param[out] result Return error value
+ *
+ * \return Returns values as specified by the \ref tfm_platform_err_t
+ */
+enum tfm_platform_err_t
+tfm_platform_set_pin_mode(uint64_t pin_mask, uint32_t pin_mode,
+ uint32_t *result);
+
+
#ifdef __cplusplus
}
#endif