le_ulpm_common.h

Go to the documentation of this file.
1 
2 /*
3  * ====================== WARNING ======================
4  *
5  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
6  * DO NOT MODIFY IN ANY WAY.
7  *
8  * ====================== WARNING ======================
9  */
10 /**
11  * @file le_ulpm_common.h
12  *
13  * Type definitions for le_ulpm.
14  *
15  */
16 #ifndef LE_ULPM_COMMON_H_INCLUDE_GUARD
17 #define LE_ULPM_COMMON_H_INCLUDE_GUARD
18 
19 
20 #include "legato.h"
21 
22 #define IFGEN_LE_ULPM_PROTOCOL_ID "9431e37e61d607aea62e91937079db61"
23 #define IFGEN_LE_ULPM_MSG_SIZE 32
24 /** @addtogroup le_ulpm
25  * @{ **/
26 
27 
28 //--------------------------------------------------------------------------------------------------
29 /**
30  * Maximum version length of mcu firmware.
31  */
32 //--------------------------------------------------------------------------------------------------
33 #define LE_ULPM_MAX_VERS_LEN 8
34 
35 //--------------------------------------------------------------------------------------------------
36 /**
37  * State of gpio pin. This state will be used to exit from low power state.
38  */
39 //--------------------------------------------------------------------------------------------------
40 typedef enum
41 {
43  ///< Gpio voltage level low.
45  ///< Gpio voltage level high.
47  ///< Gpio edge rising.
49  ///< Gpio edge falling.
51  ///< Gpio edge either rising or falling.
53  ///< Gpio off.
54 }
56 
57 
58 //--------------------------------------------------------------------------------------------------
59 /**
60  * Possible ULPS (Ultra Low Power State) configurations to select before shutdown.
61  *
62  * Value 3 is skipped as it should not be used according to swimcu_pm documentation.
63  */
64 //--------------------------------------------------------------------------------------------------
65 typedef enum
66 {
68  ///< Resquest to disable PSM
70  ///< Request enable PSM with ULPM fallback
72  ///< Request power off module
74  ///< No request (Default value)
76  ///< Request enable PSM only
78  ///< Request enable ULPM only
79 }
81 
82 
83 
84 //--------------------------------------------------------------------------------------------------
85 /**
86  * Get if this client bound locally.
87  */
88 //--------------------------------------------------------------------------------------------------
89 LE_SHARED bool ifgen_le_ulpm_HasLocalBinding
90 (
91  void
92 );
93 
94 
95 //--------------------------------------------------------------------------------------------------
96 /**
97  * Init data that is common across all threads
98  */
99 //--------------------------------------------------------------------------------------------------
100 LE_SHARED void ifgen_le_ulpm_InitCommonData
101 (
102  void
103 );
104 
105 
106 //--------------------------------------------------------------------------------------------------
107 /**
108  * Perform common initialization and open a session
109  */
110 //--------------------------------------------------------------------------------------------------
111 LE_SHARED le_result_t ifgen_le_ulpm_OpenSession
112 (
113  le_msg_SessionRef_t _ifgen_sessionRef,
114  bool isBlocking
115 );
116 
117 //--------------------------------------------------------------------------------------------------
118 /**
119  * Configure the system to boot based on a state change of a given GPIO.
120  *
121  * @return
122  * - LE_OK if specified gpio is configured as boot source.
123  * - LE_NOT_PERMITTED if the process lacks sufficient permissions to configure the GPIO as a
124  * boot source.
125  * - LE_UNSUPPORTED if the device lacks the ability to boot based on the given GPIO.
126  * - LE_BAD_PARAMETER if the state parameter was rejected.
127  * - LE_FAULT if there is a non-specific failure.
128  */
129 //--------------------------------------------------------------------------------------------------
130 LE_SHARED le_result_t ifgen_le_ulpm_BootOnGpio
131 (
132  le_msg_SessionRef_t _ifgen_sessionRef,
133  uint32_t gpioNum,
134  ///< [IN] Gpio number to boot.
135  le_ulpm_GpioState_t state
136  ///< [IN] State which should cause boot.
137 );
138 
139 //--------------------------------------------------------------------------------------------------
140 /**
141  * Boot after expiration of timer interval.
142  *
143  * @return
144  * - LE_OK if timer is configured as boot source.
145  * - LE_NOT_PERMITTED if the process lacks sufficient permissions to configure the timer as a
146  * boot source.
147  * - LE_UNSUPPORTED if the device lacks the ability to boot based on a timer.
148  * - LE_BAD_PARAMETER if the state parameter was rejected.
149  * - LE_FAULT if there is a non-specific failure.
150  */
151 //--------------------------------------------------------------------------------------------------
152 LE_SHARED le_result_t ifgen_le_ulpm_BootOnTimer
153 (
154  le_msg_SessionRef_t _ifgen_sessionRef,
155  uint32_t expiryVal
156  ///< [IN] Expiration time(in second) to boot. This is relative time from
157  ///< modem/app processor shutdown.
158 );
159 
160 //--------------------------------------------------------------------------------------------------
161 /**
162  * Configure and enable an ADC as a boot source.
163  *
164  * It is possible to specify a single range of operation or two ranges of operation with a
165  * non-operational range in between. When bootAboveAdcReading is less than bootBelowAdcReading,
166  * then a single range bootAboveReading to bootBelowReading is the configured operational range.
167  * However if bootAboveAdcReading is greater than bootBelowAdcReading, then there are two
168  * operational ranges. The first is any reading less than bootBelowAdcReading and the second is any
169  * reading greater than bootAboveAdcReading.
170  *
171  * @return
172  * - LE_OK on success
173  * - LE_NOT_PERMITTED if the process lacks sufficient permissions to configure the adc as a
174  * boot source.
175  * - LE_OVERFLOW if the provided bootAboveAdcReading or bootBelowAdcReading are too large to
176  * convert to fit in the internal string buffer.
177  * - LE_BAD_PARAMETER if the pollIntervalInMs, bootAboveAdcReading or bootBelowAdcReading
178  * parameter were rejected.
179  * - LE_UNSUPPORTED if the device does not support using the given adc as a boot source.
180  * - LE_FAULT if there is a non-specific failure.
181  */
182 //--------------------------------------------------------------------------------------------------
183 LE_SHARED le_result_t ifgen_le_ulpm_BootOnAdc
184 (
185  le_msg_SessionRef_t _ifgen_sessionRef,
186  uint32_t adcNum,
187  ///< [IN] Number of the ADC to configure
188  uint32_t pollIntervalInMs,
189  ///< [IN] How frequently to poll the ADC while sleeping
190  double bootAboveAdcReading,
191  ///< [IN] Reading above which the system should boot
192  double bootBelowAdcReading
193  ///< [IN] Reading below which the system should boot
194 );
195 
196 //--------------------------------------------------------------------------------------------------
197 /**
198  * Get the ultra low power manager firmware version.
199  *
200  * @return
201  * - LE_OK on success
202  * - LE_OVERFLOW if version string to big to fit in provided buffer
203  * - LE_FAULT for any other errors
204  */
205 //--------------------------------------------------------------------------------------------------
206 LE_SHARED le_result_t ifgen_le_ulpm_GetFirmwareVersion
207 (
208  le_msg_SessionRef_t _ifgen_sessionRef,
209  char* version,
210  ///< [OUT] Firmware version string
211  size_t versionSize
212  ///< [IN]
213 );
214 
215 //--------------------------------------------------------------------------------------------------
216 /**
217  * Initiate shutting down of app processor/modem etc.
218  *
219  * @return
220  * - LE_OK if entry to ultra low power mode initiates properly.
221  * - LE_UNAVAILABLE if shutting is not possible now. Try again.
222  * - LE_NOT_PERMITTED if the process lacks sufficient permissions to perform a shutdown.
223  * - LE_UNSUPPORTED if the device lacks the ability to shutdown via ULPM.
224  * - LE_FAULT if there is a non-specific failure.
225  */
226 //--------------------------------------------------------------------------------------------------
227 LE_SHARED le_result_t ifgen_le_ulpm_ShutDown
228 (
229  le_msg_SessionRef_t _ifgen_sessionRef
230 );
231 
232 //--------------------------------------------------------------------------------------------------
233 /**
234  * Initiate reboot of app processor/modem etc.
235  *
236  * @return
237  * - LE_OK if reboot initiates properly.
238  * - LE_UNAVAILABLE if rebooting is not possible now. Try again.
239  * - LE_NOT_PERMITTED if the process lacks sufficient permissions to perform a reboot.
240  * - LE_UNSUPPORTED if the device lacks the ability to reboot via ULPM.
241  * - LE_FAULT if there is a non-specific failure.
242  */
243 //--------------------------------------------------------------------------------------------------
244 LE_SHARED le_result_t ifgen_le_ulpm_Reboot
245 (
246  le_msg_SessionRef_t _ifgen_sessionRef
247 );
248 
249 //--------------------------------------------------------------------------------------------------
250 /**
251  * Set the Low Power Mode configuration to apply when le_ulpm_ShutDown is called.
252  *
253  * @return
254  * - LE_OK on success
255  * - LE_BAD_PARAMETER if the value of a parameter is invalid
256  * - LE_UNSUPPORTED if not supported
257  * - LE_FAULT for any other errors
258  */
259 //--------------------------------------------------------------------------------------------------
260 LE_SHARED le_result_t ifgen_le_ulpm_SetShutDownStrategy
261 (
262  le_msg_SessionRef_t _ifgen_sessionRef,
263  le_ulpm_ULPSConfiguration_t ulpsConfig
264  ///< [IN] Value used to configure ULPS.
265 );
266 /** @} **/
267 #endif // LE_ULPM_COMMON_H_INCLUDE_GUARD
Gpio edge falling.
Definition: le_ulpm_common.h:48
Gpio voltage level low.
Definition: le_ulpm_common.h:42
Gpio edge rising.
Definition: le_ulpm_common.h:46
#define LE_SHARED
Definition: le_basics.h:300
le_result_t
Definition: le_basics.h:46
Gpio voltage level high.
Definition: le_ulpm_common.h:44
Request enable PSM with ULPM fallback.
Definition: le_ulpm_common.h:69
le_ulpm_GpioState_t
Definition: le_ulpm_common.h:40
Request power off module.
Definition: le_ulpm_common.h:71
No request (Default value)
Definition: le_ulpm_common.h:73
struct le_msg_Session * le_msg_SessionRef_t
Definition: le_messaging.h:860
Request enable PSM only.
Definition: le_ulpm_common.h:75
Gpio edge either rising or falling.
Definition: le_ulpm_common.h:50
Request enable ULPM only.
Definition: le_ulpm_common.h:77
Resquest to disable PSM.
Definition: le_ulpm_common.h:67
le_ulpm_ULPSConfiguration_t
Definition: le_ulpm_common.h:65
Gpio off.
Definition: le_ulpm_common.h:52