le_dualsys_interface.h

Go to the documentation of this file.
1 
2 
3 /*
4  * ====================== WARNING ======================
5  *
6  * THE CONTENTS OF THIS FILE HAVE BEEN AUTO-GENERATED.
7  * DO NOT MODIFY IN ANY WAY.
8  *
9  * ====================== WARNING ======================
10  */
11 
12 /**
13  * @page c_le_dualsys Dual systems partition definition
14  *
15  * @ref le_dualsys_interface.h "API Reference"
16  *
17  * <HR>
18  *
19  * Dual systems are systems composed with two set of partitions: one is said "ACTIVE", so currently
20  * in use, and the other said "UPDATE", so not used but ready-to-use.
21  *
22  * On dual systems, when Legato updates an image through the le_fwupdate API, it works on the
23  * UPDATE system.
24  * And then an "install" command performs a switch from UPDATE to ACTIVE after a reboot:
25  * The new ACTIVE system is used. The UPDATE partition becomes ready for a new update or for
26  * roll-back if the new ACTIVE fails to start properly.
27  *
28  * In each set, three sub-systems are defined:
29  * - The "modem" group for all binaries and filesystem related to modem core,
30  * - The "lk" group for the LK bootloader,
31  * - The "linux" group the kernel, rootfs and legato partitions.
32  *
33  * @section le_dualsys_binding IPC interfaces binding
34  *
35  * All the functions of this API are provided by the @b le_dualsys service.
36  *
37  * Here's a code sample binding to the le_dualsys service:
38  * @verbatim
39  bindings:
40  {
41  clientExe.clientComponent.le_dualsys -> fwupdateService.le_dualsys
42  }
43  @endverbatim
44  *
45  *
46  * @warning All of these APIs are only available for all dual systems platforms. Please refer
47  * to the Product Technical Specification document of your platform for further details.
48  * Please refer to @subpage platformConstraintsFwUpdate for details.
49  *
50  * @section le_dualsys_DisableSyncBeforeUpdate Disable the check of sync before updating
51  *
52  * It is possible to force the update of any partition even if the systems are not synchronized.
53  * This is done by calling le_fwupdate_DisableSyncBeforeUpdate() with the value true. If the value
54  * is false, the synchronization will be mandatory before performing an update.
55  * Note that the synchronization is automatically done by calling the function
56  * le_fwupdate_InitDownload() when the synchronization check is enabled.
57  *
58  * @section le_dualsys_system Defining a System
59  *
60  * It is possible to define a system by calling le_dualsys_SetSystem(). This function takes
61  * three values, one for the modem sub-system, one for the lk sub-system and one for the linux
62  * sub-system. The values are one of 0 for system 1 or 1 for system 2. When set, the system will
63  * be usable after the next reset.
64  * If no error is encountered, this function will perform a reset.
65  *
66  * It is possible the get the last defined system by calling the le_dualsys_GetSystem(). This
67  * function returns the values for the three sub-systems. This system is updated accordingly
68  * the last system set by le_dualsys_SetSystem().
69  *
70  * It is possible to get the current active system by calling le_dualsys_GetCurrentSystem().
71  * This function returns the values for the three sub-systems. If le_dualsys_SetSystem() is
72  * called before le_dualsys_GetCurrentSystem(), the returned values may differ as they represent
73  * the current system in use.
74  *
75  * <HR>
76  *
77  * Copyright (C) Sierra Wireless Inc.
78  */
79 /**
80  * @file le_dualsys_interface.h
81  *
82  * Legato @ref c_le_dualsys include file.
83  *
84  * Copyright (C) Sierra Wireless Inc.
85  */
86 
87 #ifndef LE_DUALSYS_INTERFACE_H_INCLUDE_GUARD
88 #define LE_DUALSYS_INTERFACE_H_INCLUDE_GUARD
89 
90 
91 #include "legato.h"
92 
93 
94 //--------------------------------------------------------------------------------------------------
95 /**
96  * Type for handler called when a server disconnects.
97  */
98 //--------------------------------------------------------------------------------------------------
99 typedef void (*le_dualsys_DisconnectHandler_t)(void *);
100 
101 //--------------------------------------------------------------------------------------------------
102 /**
103  *
104  * Connect the current client thread to the service providing this API. Block until the service is
105  * available.
106  *
107  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
108  * called before any other functions in this API. Normally, ConnectService is automatically called
109  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
110  *
111  * This function is created automatically.
112  */
113 //--------------------------------------------------------------------------------------------------
115 (
116  void
117 );
118 
119 //--------------------------------------------------------------------------------------------------
120 /**
121  *
122  * Try to connect the current client thread to the service providing this API. Return with an error
123  * if the service is not available.
124  *
125  * For each thread that wants to use this API, either ConnectService or TryConnectService must be
126  * called before any other functions in this API. Normally, ConnectService is automatically called
127  * for the main thread, but not for any other thread. For details, see @ref apiFilesC_client.
128  *
129  * This function is created automatically.
130  *
131  * @return
132  * - LE_OK if the client connected successfully to the service.
133  * - LE_UNAVAILABLE if the server is not currently offering the service to which the client is
134  * bound.
135  * - LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
136  * - LE_COMM_ERROR if the Service Directory cannot be reached.
137  */
138 //--------------------------------------------------------------------------------------------------
140 (
141  void
142 );
143 
144 //--------------------------------------------------------------------------------------------------
145 /**
146  * Set handler called when server disconnection is detected.
147  *
148  * When a server connection is lost, call this handler then exit with LE_FATAL. If a program wants
149  * to continue without exiting, it should call longjmp() from inside the handler.
150  */
151 //--------------------------------------------------------------------------------------------------
153 (
154  le_dualsys_DisconnectHandler_t disconnectHandler,
155  void *contextPtr
156 );
157 
158 //--------------------------------------------------------------------------------------------------
159 /**
160  *
161  * Disconnect the current client thread from the service providing this API.
162  *
163  * Normally, this function doesn't need to be called. After this function is called, there's no
164  * longer a connection to the service, and the functions in this API can't be used. For details, see
165  * @ref apiFilesC_client.
166  *
167  * This function is created automatically.
168  */
169 //--------------------------------------------------------------------------------------------------
171 (
172  void
173 );
174 
175 
176 //--------------------------------------------------------------------------------------------------
177 /**
178  * System
179  * Define on which system 1 or 2 belong the partition group (0 = system 1, 1 = system 2)
180  */
181 //--------------------------------------------------------------------------------------------------
182 typedef enum
183 {
184  LE_DUALSYS_MODEM_GROUP = 0x1, ///< System 1 or 2 for MODEM sub-system
185  LE_DUALSYS_LK_GROUP = 0x2, ///< System 1 or 2 for LK sub-system
186  LE_DUALSYS_LINUX_GROUP = 0x4 ///< System 1 or 2 for LINUX sub-system
187 }
189 
190 
191 //--------------------------------------------------------------------------------------------------
192 /**
193  * Disable (true) or enable (false) the synchronisation check before performing an update.
194  * The default behavior at startup is always to have the check enabled. It remains enabled
195  * until this service is called with the value true. To re-enable the synchronization check
196  * call this service with the value false.
197  *
198  * @note Upgrading some partitions without performing a sync before may let the whole system
199  * into a unworkable state. THIS IS THE RESPONSABILITY OF THE CALLER TO KNOW WHAT IMAGES
200  * ARE ALREADY FLASHED INTO THE UPDATE SYSTEM.
201  *
202  * @note Fuction must be called after each target reboot or updateDaemon restart
203  *
204  * @return
205  * - LE_OK On success
206  * - LE_UNSUPPORTED The feature is not supported
207  * - LE_FAULT On failure
208  */
209 //--------------------------------------------------------------------------------------------------
211 (
212  bool isDisabled
213  ///< [IN] State of sync check : true (disable) or false (enable)
214 );
215 
216 //--------------------------------------------------------------------------------------------------
217 /**
218  * Define a new "system" by setting the three sub-systems. This system will become the current
219  * system in use after the reset performed by this service, if no error are reported.
220  *
221  * @note On success, a device reboot is initiated without returning any value.
222  *
223  * @return
224  * - LE_FAULT On failure
225  * - LE_UNSUPPORTED The feature is not supported
226  */
227 //--------------------------------------------------------------------------------------------------
229 (
230  le_dualsys_System_t systemMask
231  ///< [IN] Sub-system bitmask for "modem/lk/linux" partitions
232 );
233 
234 //--------------------------------------------------------------------------------------------------
235 /**
236  * Get the current "system" in use.
237  *
238  * @return
239  * - LE_OK On success
240  * - LE_FAULT On failure
241  * - LE_UNSUPPORTED The feature is not supported
242  */
243 //--------------------------------------------------------------------------------------------------
245 (
246  le_dualsys_System_t* systemMaskPtr
247  ///< [OUT] Sub-system bitmask for "modem/lk/linux" partitions
248 );
249 
250 #endif // LE_DUALSYS_INTERFACE_H_INCLUDE_GUARD
le_result_t
Definition: le_basics.h:35
System 1 or 2 for LINUX sub-system.
Definition: le_dualsys_interface.h:186
le_result_t le_dualsys_SetSystem(le_dualsys_System_t systemMask)
le_result_t le_dualsys_DisableSyncBeforeUpdate(bool isDisabled)
le_result_t le_dualsys_TryConnectService(void)
void(* le_dualsys_DisconnectHandler_t)(void *)
Definition: le_dualsys_interface.h:99
System 1 or 2 for LK sub-system.
Definition: le_dualsys_interface.h:185
System 1 or 2 for MODEM sub-system.
Definition: le_dualsys_interface.h:184
void le_dualsys_ConnectService(void)
void le_dualsys_DisconnectService(void)
le_result_t le_dualsys_GetCurrentSystem(le_dualsys_System_t *systemMaskPtr)
void le_dualsys_SetServerDisconnectHandler(le_dualsys_DisconnectHandler_t disconnectHandler, void *contextPtr)
le_dualsys_System_t
Definition: le_dualsys_interface.h:182