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