1 /*
2  * Copyright (c) 2024 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #ifndef NRFS_INTERNAL_DVFS_H
8 #define NRFS_INTERNAL_DVFS_H
9 
10 #include <internal/services/nrfs_generic.h>
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 enum __NRFS_PACKED dvfs_frequency_setting {
17 	DVFS_FREQ_HIGH	  = 0,
18 	DVFS_FREQ_MEDLOW  = 1,
19 	DVFS_FREQ_LOW	  = 2,
20 	DVFS_FREQ_COUNT
21 };
22 
23 /** @brief Dynamic Voltage and Frequency Scaling service notification data structure. */
24 typedef struct __NRFS_PACKED {
25 	bool scaling_prepare; /**< true if given response is a request for scaling preparation,
26 				*   false if given response is just a confirmation.
27 				*/
28 	enum dvfs_frequency_setting freq;	/**< Maximum allowed HSFLL frequency oppoint. */
29 } nrfs_dvfs_rsp_data_t;
30 
31 /** @brief Dynamic Voltage and Frequency Scaling service request data structure. */
32 typedef struct __NRFS_PACKED {
33 	enum dvfs_frequency_setting target_freq; /** Requested frequency oppoint. */
34 } nrfs_dvfs_opp_req_data_t;
35 
36 /** @brief Dynamic Voltage and Frequency Scaling operating frequency change request structure. */
37 typedef struct __NRFS_PACKED {
38 	nrfs_hdr_t hdr;		       /**< Header of the message. */
39 	nrfs_ctx_t ctx;		       /**< Context of the message. */
40 	nrfs_dvfs_opp_req_data_t data; /**< Data of the request. */
41 } nrfs_dvfs_opp_req_t;
42 
43 /** @brief Dynamic Voltage and Frequency Scaling general request structure. */
44 typedef struct __NRFS_PACKED {
45 	nrfs_hdr_t hdr; /**< Header of the message. */
46 	nrfs_ctx_t ctx; /**< Context of the message. */
47 } nrfs_dvfs_req_t;
48 
49 /** @brief Dynamic Voltage and Frequency Scaling service notification structure. */
50 typedef struct __NRFS_PACKED {
51 	nrfs_hdr_t hdr;		   /**< Header of the message. */
52 	nrfs_ctx_t ctx;		   /**< Context of the message. */
53 	nrfs_dvfs_rsp_data_t data; /**< Data of the notification. */
54 } nrfs_dvfs_rsp_t;
55 
56 #ifdef __cplusplus
57 }
58 #endif
59 
60 #endif /* NRFS_INTERNAL_DVFS_H */
61