1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef NRFS_INTERNAL_PMIC_H 8 #define NRFS_INTERNAL_PMIC_H 9 10 #include <internal/services/nrfs_generic.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** @brief PMIC SIM selection. */ 17 typedef enum __NRFS_PACKED { 18 PMIC_SIM1 = 1, /** SIM1 */ 19 PMIC_SIM2 = 2 /** SIM2 */ 20 } pmic_sim_t; 21 22 /** @brief PMIC BLE RADIO TX power. */ 23 typedef enum __NRFS_PACKED { 24 PMIC_BLE_RADIO_TXPOWER_POS10DBM, /** +10 dBm */ 25 PMIC_BLE_RADIO_TXPOWER_POS9DBM, /** +9 dBm */ 26 PMIC_BLE_RADIO_TXPOWER_POS8DBM, /** +8 dBm */ 27 PMIC_BLE_RADIO_TXPOWER_POS7DBM, /** +7 dBm */ 28 PMIC_BLE_RADIO_TXPOWER_POS6DBM, /** +6 dBm */ 29 PMIC_BLE_RADIO_TXPOWER_POS5DBM, /** +5 dBm */ 30 PMIC_BLE_RADIO_TXPOWER_POS4DBM, /** +4 dBm */ 31 PMIC_BLE_RADIO_TXPOWER_POS3DBM, /** +3 dBm */ 32 PMIC_BLE_RADIO_TXPOWER_POS2DBM, /** +2 dBm */ 33 PMIC_BLE_RADIO_TXPOWER_POS1DBM, /** +1 dBm */ 34 PMIC_BLE_RADIO_TXPOWER_0DBM, /** 0 dBm */ 35 PMIC_BLE_RADIO_TXPOWER_NEG1DBM, /** -1 dBm */ 36 PMIC_BLE_RADIO_TXPOWER_NEG2DBM, /** -2 dBm */ 37 PMIC_BLE_RADIO_TXPOWER_NEG4DBM, /** -4 dBm */ 38 PMIC_BLE_RADIO_TXPOWER_NEG8DBM, /** -8 dBm */ 39 PMIC_BLE_RADIO_TXPOWER_NEG12DBM, /** -12 dBm */ 40 PMIC_BLE_RADIO_TXPOWER_NEG16DBM, /** -16 dBm */ 41 PMIC_BLE_RADIO_TXPOWER_NEG20DBM, /** -20 dBm */ 42 PMIC_BLE_RADIO_TXPOWER_NEG30DBM, /** -30 dBm */ 43 PMIC_BLE_RADIO_TXPOWER_NEG40DBM, /** -40 dBm */ 44 PMIC_BLE_RADIO_TXPOWER_NEG70DBM /** -70 dBm */ 45 } pmic_ble_radio_txpower_t; 46 47 /** @brief PMIC TEST IF register access type. */ 48 typedef enum __NRFS_PACKED { 49 PMIC_REG_READ, /** Register read */ 50 PMIC_REG_WRITE, /** Register write */ 51 PMIC_REG_INVALID, /** Register access invalid */ 52 } pmic_reg_access_type_t; 53 54 /** @brief PMIC TEST IF register access. */ 55 typedef struct __NRFS_PACKED { 56 pmic_reg_access_type_t access_type; /** Register access type */ 57 uint16_t addr; /** Register address */ 58 uint8_t val; /** Register value for writes */ 59 } pmic_reg_access_t; 60 61 /** @brief PMIC service notification data structure. */ 62 typedef struct __NRFS_PACKED { 63 pmic_reg_access_type_t access_type; /** Register access type */ 64 uint8_t val; /** Register value of 8-bit register. */ 65 } nrfs_pmic_rsp_data_t; 66 67 /** @brief PMIC RFFE ON request structure. */ 68 typedef struct __NRFS_PACKED { 69 nrfs_hdr_t hdr; /**< Header of the message. */ 70 nrfs_ctx_t ctx; /**< Context of the message. */ 71 } nrfs_pmic_rffe_on_req_t; 72 73 /** @brief PMIC RFFE OFF request structure. */ 74 typedef struct __NRFS_PACKED { 75 nrfs_hdr_t hdr; /**< Header of the message. */ 76 nrfs_ctx_t ctx; /**< Context of the message. */ 77 } nrfs_pmic_rffe_off_req_t; 78 79 /** @brief PMIC SIM ON request structure. */ 80 typedef struct __NRFS_PACKED { 81 nrfs_hdr_t hdr; /**< Header of the message. */ 82 nrfs_ctx_t ctx; /**< Context of the message. */ 83 pmic_sim_t sim; /**< SIM to enable. */ 84 } nrfs_pmic_sim_on_req_t; 85 86 /** @brief PMIC SIM OFF request structure. */ 87 typedef struct __NRFS_PACKED { 88 nrfs_hdr_t hdr; /**< Header of the message. */ 89 nrfs_ctx_t ctx; /**< Context of the message. */ 90 pmic_sim_t sim; /**< SIM to disable. */ 91 } nrfs_pmic_sim_off_req_t; 92 93 /** @brief PMIC BLE RADIO ON request structure. */ 94 typedef struct __NRFS_PACKED { 95 nrfs_hdr_t hdr; /**< Header of the message. */ 96 nrfs_ctx_t ctx; /**< Context of the message. */ 97 pmic_ble_radio_txpower_t txpower; /**< Needed BLE Radio TX Power. */ 98 } nrfs_pmic_ble_radio_on_req_t; 99 100 /** @brief PMIC BLE RADIO OFF request structure. */ 101 typedef struct __NRFS_PACKED { 102 nrfs_hdr_t hdr; /**< Header of the message. */ 103 nrfs_ctx_t ctx; /**< Context of the message. */ 104 } nrfs_pmic_ble_radio_off_req_t; 105 106 /** @brief PMIC PWM default set request structure. */ 107 typedef struct __NRFS_PACKED { 108 nrfs_hdr_t hdr; /**< Header of the message. */ 109 nrfs_ctx_t ctx; /**< Context of the message. */ 110 } nrfs_pmic_pwm_default_req_t; 111 112 /** @brief PMIC PWM ghost avoid set request structure. */ 113 typedef struct __NRFS_PACKED { 114 nrfs_hdr_t hdr; /**< Header of the message. */ 115 nrfs_ctx_t ctx; /**< Context of the message. */ 116 } nrfs_pmic_pwm_ghost_avoid_req_t; 117 118 /** @brief PMIC TEST IF request structure. */ 119 typedef struct __NRFS_PACKED { 120 nrfs_hdr_t hdr; /**< Header of the message. */ 121 nrfs_ctx_t ctx; /**< Context of the message. */ 122 pmic_reg_access_t reg; /**< PMIC register access. */ 123 } nrfs_pmic_test_if_req_t; 124 125 /** @brief PMIC INFO request structure. */ 126 typedef struct __NRFS_PACKED { 127 nrfs_hdr_t hdr; /**< Header of the message. */ 128 nrfs_ctx_t ctx; /**< Context of the message. */ 129 } nrfs_pmic_info_req_t; 130 131 /** @brief PMIC available info. */ 132 typedef enum __NRFS_PACKED { 133 PMIC_NOT_AVAILABLE, 134 PMIC_AVAILABLE 135 } pmic_available_t; 136 137 /** @brief PMIC info data structure. */ 138 typedef struct __NRFS_PACKED { 139 pmic_available_t pmic_available; 140 } nrfs_pmic_info_rsp_data_t; 141 142 /** @brief PMIC service notification structure. */ 143 typedef struct __NRFS_PACKED { 144 nrfs_hdr_t hdr; /**< Header of the message. */ 145 nrfs_ctx_t ctx; /**< Context of the message. */ 146 nrfs_pmic_info_rsp_data_t data; /**< Data of the notification. */ 147 } nrfs_pmic_info_rsp_t; 148 149 /** @brief PMIC service notification structure. */ 150 typedef struct __NRFS_PACKED { 151 nrfs_hdr_t hdr; /**< Header of the message. */ 152 nrfs_ctx_t ctx; /**< Context of the message. */ 153 nrfs_pmic_rsp_data_t data; /**< Data of the notification. */ 154 } nrfs_pmic_rsp_t; 155 156 #ifdef __cplusplus 157 } 158 #endif 159 160 #endif /* NRFS_INTERNAL_PMIC_H */ 161