1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef NRFS_GDPWR_H 8 #define NRFS_GDPWR_H 9 10 #include <internal/services/nrfs_gdpwr.h> 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** @brief Global domain power request service response notification types. */ 17 typedef enum __NRFS_PACKED { 18 NRFS_GDPWR_REQ_APPLIED, /** Request accepted. */ 19 NRFS_GDPWR_REQ_REJECTED /** Request rejected. */ 20 } nrfs_gdpwr_evt_type_t; 21 22 /** @brief Global domain power request service response data structure. */ 23 typedef struct { 24 nrfs_gdpwr_evt_type_t type; 25 } nrfs_gdpwr_evt_t; 26 27 /** @brief Global domain power request service event handler type. */ 28 typedef void (*nrfs_gdpwr_evt_handler_t)(nrfs_gdpwr_evt_t const *p_evt, 29 void *context); 30 31 /** 32 * @brief Function for initializing the global domain power request service. 33 * 34 * @param[in] handler Function called as a response to the request. 35 * 36 * @retval NRFS_SUCCESS Service initialized successfully. 37 * @retval NRFS_ERR_INVALID_STATE Service was already initialized. 38 */ 39 nrfs_err_t nrfs_gdpwr_init(nrfs_gdpwr_evt_handler_t handler); 40 41 /** 42 * @brief Function for uninitializing the global domain power request service. 43 * 44 * @warning Notifications from previous requests are dropped after service uninitialization. 45 */ 46 void nrfs_gdpwr_uninit(void); 47 48 /** 49 * @brief Function for requesting and releasing power request in the specific global domain. 50 * 51 * @param[in] power_domain selection of power domain in the global domain. 52 * @param[in] req_type set/clear power request for specific power domain. 53 * @param[in] p_context Opaque user data that will be passed to registered callback. 54 * 55 * @retval NRFS_SUCCESS Request sent successfully. 56 * @retval NRFS_ERR_INVALID_STATE Service is uninitialized. 57 * @retval NRFS_ERR_IPC Backend returned error during request sending. 58 */ 59 nrfs_err_t nrfs_gdpwr_power_request(gdpwr_power_domain_t power_domain, 60 gdpwr_request_type_t req_type, 61 void *p_context); 62 63 #ifdef __cplusplus 64 } 65 #endif 66 67 #endif /* NRFS_GDPWR_H */ 68