common_library: gettid is multiple declaration in cl_error
[staging/basesystem.git] / video_in_hal / systemservice / interface_unified / library / include / system_service / ss_system_manager_if.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup  system_manager
19 /// \file     ss_system_manager_if.h
20 /// \brief    This file supports the System Manager client interface.
21 ///
22 ///////////////////////////////////////////////////////////////////////////////
23
24 #ifndef SS_SYSTEM_MANAGER_IF_H_  // NOLINT (build/header_guard)
25 #define SS_SYSTEM_MANAGER_IF_H_
26
27 #include <native_service/frameworkunified_types.h>
28 #include <system_service/ss_sm_ram_access.h>
29 #include "system_service/ss_system_if.h"
30 #include "system_service/ss_error_event_common.h"
31 #include "system_service/ss_power_service.h"
32
33 /// \ingroup system_manager
34 /// \brief Boot mode information
35 typedef enum {
36     e_SS_SM_BOOT_MODE_INVALID     = -1
37   , e_SS_SM_BOOT_MODE_APPLICATION
38   , e_SS_SM_BOOT_MODE_PROGRAMMING
39 }ESMBootModeInfo;
40
41 /// \ingroup system_manager
42 /// \brief Data reset mode information
43 typedef enum {
44     e_SS_SM_DATA_RESET_MODE_NONE
45   , e_SS_SM_DATA_RESET_MODE_USER
46   , e_SS_SM_DATA_RESET_MODE_FACTORY
47   , e_SS_SM_DATA_RESET_MODE_PROGUPDATE  // cannot use this
48 }ESMDataResetModeInfo;
49
50 /// \ingroup system_manager
51 /// \brief Program update status
52 typedef UI_32 SMProgUpdateState;
53 #define SS_SM_PROG_UPDATE_STATE_NONE            0x0000
54 #define SS_SM_PROG_UPDATE_STATE_UPDATED         0x0001
55 #define SS_SM_PROG_UPDATE_STATE_MAP_UPDATED     0x0002
56 #define SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED 0x0004
57
58 /// Set Next Wakeup type information
59 typedef enum {
60     e_SS_SM_NEXT_WAKEUP_TYPE_NONE = 0
61   , e_SS_SM_NEXT_WAKEUP_TYPE_COLD
62   , e_SS_SM_NEXT_WAKEUP_TYPE_HOT
63 }ESMNextWakeupType;
64
65 /// \ingroup system_manager
66 /// \brief DRAM backup status
67 typedef enum {
68     e_SS_SM_DRAM_BACKUP_UNSET = -1
69   , e_SS_SM_DRAM_BACKUP_OK
70   , e_SS_SM_DRAM_BACKUP_NG
71 }ESMDramBackupStatus;
72
73 /// \ingroup system_manager
74 /// \brief Reset status
75 typedef enum {
76     e_SS_SM_RESET_STATUS_UNSET = -1
77   , e_SS_SM_RESET_STATUS_NONE
78   , e_SS_SM_RESET_STATUS_NG
79   , e_SS_SM_RESET_STATUS_IMMEDIATE
80 }ESMResetStatus;
81
82 /// \ingroup system_manager
83 /// \brief Relaunch status
84 typedef enum {
85     e_SS_SM_RELAUNCH_STATUS_NONE
86   , e_SS_SM_RELAUNCH_STATUS_SAFE
87   , e_SS_SM_RELAUNCH_STATUS_ERR
88 }EMRelaunchStatus;
89
90
91 /// \ingroup system_manager
92 /// \brief CPU Reset Reason
93 typedef enum {
94     e_SS_SM_CPU_RESET_REASON_INVALID = -1
95   , e_SS_SM_CPU_RESET_REASON_NORMAL  =  0
96   , e_SS_SM_CPU_RESET_REASON_DATA_RESET
97   , e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET
98   , e_SS_SM_CPU_RESET_REASON_GENERIC
99   , e_SS_SM_CPU_RESET_REASON_GENERIC_ERR = e_SS_SM_CPU_RESET_REASON_GENERIC
100   , e_SS_SM_CPU_RESET_REASON_DSP_ERR
101   , e_SS_SM_CPU_RESET_REASON_IMMRESET_NORMAL
102   , e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR  // DRAM backup will be discarded after reset
103 }ESMCpuResetReason;
104
105 /// \ingroup system_manager
106 /// \brief CPU Reset Info
107 typedef struct T_SystemManagerCpuResetInfo {
108 #define SS_SM_RESET_MSG_STR_SIZE 64
109 #define SS_SM_SUFFIX_STR_SIZE  32
110     ESMCpuResetReason resetReason;
111     CHAR              messageStr[SS_SM_RESET_MSG_STR_SIZE];
112     CHAR              suffixStr[SS_SM_SUFFIX_STR_SIZE];
113     T_SystemManagerCpuResetInfo
114        () : resetReason(e_SS_SM_CPU_RESET_REASON_INVALID) {
115     }
116 }TSystemManagerCpuResetInfo;
117
118
119 /// \ingroup system_manager
120 /// \brief Data Reset Reason
121 typedef enum {
122     e_SS_SM_DATA_RESET_TYPE_USER = 0
123   , e_SS_SM_DATA_RESET_TYPE_FACTORY  // AKA Shipment Mode
124   , e_SS_SM_DATA_RESET_TYPE_CONFIGURATION
125   , e_SS_SM_DATA_RESET_TYPE_PROGUPDATE    // cannot use this
126 }ESMDataResetType;
127
128 typedef enum {
129     e_SS_SM_SVC_WAKEUP_STATUS_COMPLETE = 0x01
130 }ESMServiceWakeupStatus;
131
132 /// \ingroup system_manager
133 /// \brief Data Reset Reason
134 typedef struct T_SS_BootModeListStruct {
135   ESMBootModeInfo             hostBootMode;
136   EPWR_SC__CWORD56__BOOT_MODE_TYPE _CWORD56_BootMode;
137 } TSS_BootModeListStruct;
138
139 //****************************************************************************
140 /// \ingroup system_manager                                                   *
141 /// Data passed in the NTFY_SSSystemMgrPowerOnOff and                        *
142 /// NTFY_SSSystemMgrUserMode notification messages                           *
143
144 /// \ingroup system_manager
145 typedef struct T_SS_SM_UserModeOnOffNotification_Struct {                 // *
146     BOOL                              isUserModeOn;                       // *
147     EPWR_WAKEUP_FACTOR_TYPE           startupReason;                      // *
148     EPWR_USER_MODE_CHANGE_REASON_TYPE userModeChangeReason;               // *
149     T_SS_SM_UserModeOnOffNotification_Struct                              // *
150        () : isUserModeOn(FALSE),                                          // *
151             startupReason(epswfINVALID),                                  // *
152             userModeChangeReason(epsumcrNOT_AVAILABLE) {                  // *
153     }                                                                     // *
154     T_SS_SM_UserModeOnOffNotification_Struct                              // *
155         (BOOL                              f_bUserMode,                   // *
156          EPWR_WAKEUP_FACTOR_TYPE           f_startupReason,               // *
157          EPWR_USER_MODE_CHANGE_REASON_TYPE f_changeReason)                // *
158            : isUserModeOn(f_bUserMode),                                   // *
159              startupReason(f_startupReason),                              // *
160              userModeChangeReason(f_changeReason) {                       // *
161     }                                                                     // *
162                                                                           // *
163 } T_SS_SM_UserModeOnOffNotification_StructType;                           // *
164 //                                                                           *
165 // End of Data passed as part of NTFY_SSSystemMgrPowerOnOff notification ... *
166 //****************************************************************************
167
168
169 //****************************************************************************
170 /// \ingroup system_manager
171 /**
172  * \~english Parameters of the following message. \n
173  *            SS_SM_START             'FrameworkunifiedOnStart'/'evStart' \n
174  *            SS_SM_PRE_START         'FrameworkunifiedOnPreStart'/'evPreStart' \n
175  *            SS_SM_BACKGROUND_START  'FrameworkunifiedOnBackgroundStart'/'evBackgroundStart' \n
176  */
177 typedef struct T_SS_SM_START_DataStruct {
178     EPWR_WAKEUP_FACTOR_TYPE           startupReason;        //!< \~english
179     BOOL                              isUserModeOn;         //!< \~english
180     ESMDataResetModeInfo              dataResetMode;        //!< \~english
181     EPWR_SC_SECURITY_STATUS           securityStatus;       //!< \~english
182     EPWR_SC_WAKEUP_TYPE               wakeupType;           //!< \~english
183     ESMDramBackupStatus               dramBackupStatus;     //!< \~english
184     ESMResetStatus                    resetStatus;          //!< \~english
185     UI_32                             errResetCount;        //!< \~english
186     /**
187      *  \~english Constructor
188      */
189     T_SS_SM_START_DataStruct
190        () : startupReason(epswfINVALID),
191             isUserModeOn(FALSE),
192             dataResetMode(e_SS_SM_DATA_RESET_MODE_NONE),
193             securityStatus(epsssINVALID),
194             wakeupType(epsstINVALID),
195             dramBackupStatus(e_SS_SM_DRAM_BACKUP_UNSET),
196             resetStatus(e_SS_SM_RESET_STATUS_UNSET),
197             errResetCount(0) {}
198     /**
199      *  \~english Constructor
200      */
201     T_SS_SM_START_DataStruct
202         (EPWR_WAKEUP_FACTOR_TYPE  f_startupReason,
203          BOOL                     f_isUserModeOn,
204          ESMDataResetModeInfo     f_dataResetMode,
205          EPWR_SC_SECURITY_STATUS  f_securityStatus,
206          EPWR_SC_WAKEUP_TYPE      f_wakeupType,
207          ESMDramBackupStatus      f_dramBackupStatus,
208          ESMResetStatus           f_resetStatus,
209          UI_32                    f_resetCount)
210            : startupReason(f_startupReason),
211              isUserModeOn(f_isUserModeOn),
212              dataResetMode(f_dataResetMode),
213              securityStatus(f_securityStatus),
214              wakeupType(f_wakeupType),
215              dramBackupStatus(f_dramBackupStatus),
216              resetStatus(f_resetStatus),
217              errResetCount(f_resetCount) {}
218 } T_SS_SM_START_DataStructType;
219 //                                                                           *
220 // End of Data passed as part of SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message  *
221 //****************************************************************************
222
223 //****************************************************************************
224 /// \ingroup system_manager
225 /// Data passed as part of SS_SM_STOP 'FrameworkunifiedOnStop'/'evStop' message            *
226 typedef struct T_SS_SM_STOP_DataStruct {                                  // *
227   EPWR_SHUTDOWN_TRIGGER_TYPE     shutdownTrigger;                       // *
228   EPWR_USER_MODE_TYPE            lastUserMode;                          // *
229 } T_SS_SM_STOP_DataStructType;                                            // *
230 //                                                                           *
231 // End of Data passed as part of SS_SM_STOP 'FrameworkunifiedOnStop'/'evStop' message  // *
232 //****************************************************************************
233
234 //****************************************************************************
235 /// \ingroup system_manager
236 /// Extended Parameter for FrameworkunifiedOnStart                                        *
237 typedef struct {                                                          // *
238 #define SS_SM_START_EXT_INFO_SIZE 64                                      // *
239 #define SS_SM_START_EXT_BODY_SIZE ( sizeof(BOOL) \
240                                     + sizeof(EMRelaunchStatus) \
241                                     + sizeof(BOOL) \
242                                     + sizeof(BOOL) \
243                                     )
244
245 #define SS_SM_START_EXT_RSV_SIZE  SS_SM_START_EXT_INFO_SIZE \
246                                 - SS_SM_START_EXT_BODY_SIZE               // *
247         BOOL             isProgUpdated;                                   // *
248         EMRelaunchStatus relaunchStatus;                                  // *
249         BOOL             isMapUpdated;                                    // *
250         BOOL             isMapDiffUpdated;                                // *
251         uint8_t          reserved[SS_SM_START_EXT_RSV_SIZE];              // *
252 } T_SS_SM_START_ExtDataStructType;                                        // *
253 //                                                                           *
254 // End of Extended Parameter for FrameworkunifiedOnStart                                  *
255 //****************************************************************************
256
257 //****************************************************************************
258 /// \ingroup system_manager
259 /// Extended Parameter for FrameworkunifiedOnStop                                         *
260 typedef struct {                                                          // *
261 #define SS_SM_STOP_EXT_INFO_SIZE 64                                       // *
262 #define SS_SM_STOP_EXT_BODY_SIZE (sizeof(BOOL))                           // *
263 #define SS_SM_STOP_EXT_RSV_SIZE  SS_SM_STOP_EXT_INFO_SIZE \
264                                - SS_SM_STOP_EXT_BODY_SIZE                 // *
265         BOOL     isProgUpdated;                                           // *
266         uint8_t  reserved[SS_SM_STOP_EXT_RSV_SIZE];                       // *
267 }T_SS_SM_STOP_ExtDataStructType;                                          // *
268 //                                                                           *
269 // End of Extended Parameter for FrameworkunifiedOnStop                                   *
270 //****************************************************************************
271
272 struct SMErrorEventNtfData {
273 #define SM_MODULE_NAME_SIZE 64
274   EErrorEventType  EventType;
275   CHAR             ModuleName[SM_MODULE_NAME_SIZE];
276   BOOL             isNeedReboot;
277 };
278
279 //*************************************************************************
280 // Boot Micro Logging Protocol                                            *
281 //                                                                        *
282 enum eSMBootMicroResetReason {
283     SS_SM_BOOT_MICRO_RESET_REASON_SELF_RESET = 0,
284     SS_SM_BOOT_MICRO_RESET_REASON_USER_FORCE_RESET,
285     SS_SM_BOOT_MICRO_RESET_REASON_DSP_RESET,
286     SS_SM_BOOT_MICRO_RESET_REASON_HB_TIMEOUT
287 };
288 //                                                                        *
289 // End of Boot Micro Logging Protocol                                     *
290 //*************************************************************************
291
292
293 //****************************************************************************
294 /// \ingroup system_manager                                                        *
295 /// Error Event Logging enumerations                                         *
296 ///
297 enum eSMUserLogType {
298     e_SS_SM_CAPTURE_ALL_LOGS = 1,  //!< \~english Capture all logs
299     e_SS_SM_SCREEN_CAPTURE,  //!< \~english Capture screenshot
300     e_SS_SM_CAPTURE_INTERFACEUNIFIED_LOGS,  //!< \~english Capture application log
301     e_SS_SM_USER_FORCE_RESET,  //!< \~english Capture logs are forcibily reset
302     e_SS_SM_CAPTURE_DEV_LOGS,  //!< \~english Capture device log
303     e_SS_SM_CAPTURE_MODULE_LOGS,  //!< \~english Capture debug log
304     e_SS_SM_CAPTURE_DTC_LOGS,  //!< \~english Capture DTC event log
305     e_SS_SM_CAPTURE_NAVI_LOGS,  //!< \~english Capture Navi event log
306     e_SS_SM_CAPTURE_GROUP_RELAUNCH  //!< \~english Capture log by Group Relaunch
307 };
308 //                                                                           *
309 // Error Event Logging enumerations                                          *
310 //****************************************************************************
311
312 //****************************************************************************
313 /// \ingroup system_manager                                                        *
314 /// \brief Error Event Logging Info                                          *
315 typedef struct T_SystemManagerLoggingRequestInfo {
316 #define SS_SM_LOG_MSG_STR_SIZE 64
317     eSMUserLogType    logType;
318     CHAR              messageStr[SS_SM_LOG_MSG_STR_SIZE];
319     CHAR              suffixStr[SS_SM_SUFFIX_STR_SIZE];
320 }TSystemManagerLoggingRequestInfo;
321 //
322 // Error Event Logging Info                                                  *
323 //****************************************************************************
324
325 //****************************************************************************
326 /// \ingroup system_manager                                                        *
327 /// \brief Error Event Clear Logs Info                                       *
328 typedef struct T_SystemManagerClearLogsInfo {
329     void *rsv;
330 }TSystemManagerClearLogsInfo;
331 //
332 // Error Event Clear Logs Info                                               *
333 //****************************************************************************
334
335 #endif /* SS_SYSTEM_MANAGER_IF_H_ */  // NOLINT (build/header_guard)