Tamas Kaman | 262dc7b | 2019-03-20 13:37:12 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2019, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __TFM_PLATFORM_DEFS__ |
| 9 | #define __TFM_PLATFORM_DEFS__ |
| 10 | |
| 11 | #include <stdint.h> |
| 12 | #include <limits.h> |
| 13 | |
| 14 | #ifdef __cplusplus |
| 15 | extern "C" { |
| 16 | #endif |
| 17 | |
| 18 | /*! |
| 19 | * \enum tfm_pin_service_type_t |
| 20 | * |
| 21 | * \brief Pin service types (supported types may vary based on the platform) |
| 22 | */ |
| 23 | enum tfm_pin_service_type_t { |
| 24 | TFM_PIN_SERVICE_TYPE_SET_ALTFUNC = 0, /*!< Set alternate function type */ |
| 25 | TFM_PIN_SERVICE_TYPE_SET_DEFAULT_IN, /*!< Set default in function type */ |
| 26 | TFM_PIN_SERVICE_TYPE_SET_PIN_MODE, /*!< Set pin mode function type */ |
| 27 | TFM_PIN_SERVICE_TYPE_MAX = INT_MAX /*!< Max to force enum max size */ |
| 28 | }; |
| 29 | |
| 30 | /*! |
| 31 | * \struct tfm_pin_service_args_t |
| 32 | * |
| 33 | * \brief Argument list for each platform pin service |
| 34 | */ |
| 35 | struct tfm_pin_service_args_t { |
| 36 | enum tfm_pin_service_type_t type; |
| 37 | union { |
| 38 | struct set_altfunc { /*!< TFM_PIN_SERVICE_TYPE_SET_ALTFUNC */ |
| 39 | uint32_t alt_func; |
| 40 | uint64_t pin_mask; |
| 41 | } set_altfunc; |
| 42 | struct set_default_in { /*!< TFM_PIN_SERVICE_TYPE_SET_DEFAULT_IN */ |
| 43 | uint32_t alt_func; |
| 44 | uint32_t pin_value; |
| 45 | bool default_in_value; |
| 46 | } set_default_in; |
| 47 | struct set_pin_mode { /*!< TFM_PIN_SERVICE_TYPE_SET_PIN_MODE */ |
| 48 | uint64_t pin_mask; |
| 49 | uint32_t pin_mode; |
| 50 | } set_pin_mode; |
| 51 | } u; |
| 52 | }; |
| 53 | |
| 54 | #ifdef __cplusplus |
| 55 | } |
| 56 | #endif |
| 57 | |
| 58 | #endif /* __TFM_PLATFORM_DEFS__ */ |