summaryrefslogtreecommitdiffstats
path: root/systemservice/task_manager/server/include
diff options
context:
space:
mode:
Diffstat (limited to 'systemservice/task_manager/server/include')
-rw-r--r--systemservice/task_manager/server/include/system_service/INI_API.h25
-rw-r--r--systemservice/task_manager/server/include/system_service/INI_API.hpp738
-rw-r--r--systemservice/task_manager/server/include/system_service/Primary_common.h148
-rw-r--r--systemservice/task_manager/server/include/system_service/sysup.h41
-rw-r--r--systemservice/task_manager/server/include/system_service/sysup_from.h41
-rw-r--r--systemservice/task_manager/server/include/system_service/task_manager.h54
-rw-r--r--systemservice/task_manager/server/include/system_service/tskm.h413
-rw-r--r--systemservice/task_manager/server/include/system_service/tskm_local_type.h287
-rw-r--r--systemservice/task_manager/server/include/system_service/tskm_svc.h904
-rw-r--r--systemservice/task_manager/server/include/system_service/tskm_type.h123
-rw-r--r--systemservice/task_manager/server/include/tskm_comm.h59
-rw-r--r--systemservice/task_manager/server/include/tskm_debug.h208
-rw-r--r--systemservice/task_manager/server/include/tskm_main.h71
-rw-r--r--systemservice/task_manager/server/include/tskm_port_pf.h46
-rw-r--r--systemservice/task_manager/server/include/tskm_port_subsys.h42
-rw-r--r--systemservice/task_manager/server/include/tskm_shutdown.h27
-rw-r--r--systemservice/task_manager/server/include/tskm_state.h36
-rw-r--r--systemservice/task_manager/server/include/tskm_wakeup.h26
-rw-r--r--systemservice/task_manager/server/include/tskm_watch.h25
19 files changed, 3314 insertions, 0 deletions
diff --git a/systemservice/task_manager/server/include/system_service/INI_API.h b/systemservice/task_manager/server/include/system_service/INI_API.h
new file mode 100644
index 00000000..871be5e3
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/INI_API.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file INI_API.h
+ * @brief \~english This file include INI_API.hpp
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
+
+#include "system_service/INI_API.hpp"
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_INI_API_H_
diff --git a/systemservice/task_manager/server/include/system_service/INI_API.hpp b/systemservice/task_manager/server/include/system_service/INI_API.hpp
new file mode 100644
index 00000000..00fe7339
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/INI_API.hpp
@@ -0,0 +1,738 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file INI_API.hpp
+ * @brief \~english This file provide api to operating INI
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef _INI_API_HPP_
+#define _INI_API_HPP_
+
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_system_manager_if.h>
+#include "system_service/Primary_common.h"
+
+#define INI_SUCCESS 0 /* Normal */
+#define INI_FALSE -1 /* Failed */
+
+#define INI_FD_MAX 3
+
+// Only the information required for event completion notification is left
+// Gradual startup
+#define INI_INITCOMP_NONE 0x0000000000000000LLU
+#define INI_INITCOMP_ON_START 0x0000000000000001LLU /* ON_START */
+#define INI_INITCOMP_NVM_ACCESS 0x0000000000000002LLU /* NVM ACCESS */
+
+#define INI_INITCOMP_TEST0 0x1000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST1 0x2000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST2 0x4000000000000000LLU /* for test */
+#define INI_INITCOMP_TEST3 0x8000000000000000LLU /* for test */
+
+// Gradual termination
+#define INI_TERMCOMP_NONE 0x0000000000000000LLU
+#define INI_TERMCOMP_ACTIVITYMGR 0x0000000000000001LLU /* Terminate ActivityManager */
+#define INI_TERMCOMP_RESIDENT 0x0000000000000002LLU /* Terminate regident SVC */
+#define INI_TERMCOMP_TRANSIENT 0x0000000000000004LLU /* Terminate non-regident SVC */
+
+#define INI_TERMCOMP_TEST0 0x1000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST1 0x2000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST2 0x4000000000000000LLU /* for test */
+#define INI_TERMCOMP_TEST3 0x8000000000000000LLU /* for test */
+
+
+
+typedef struct _T_PRIM_PRM{
+ PCSTR name;
+ const PRIM_SHAREDATA_TBL* shmTbl;
+ const PRIM_EXFUNC_TBL* wakeupExFuncTbl;
+ const PRIM_EXFUNC_TBL* downExFuncTbl;
+ EFrameworkunifiedStatus (*onInit)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onDestory)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onTouch)(HANDLE hApp);
+ EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp);
+ void* priv;
+ _T_PRIM_PRM(){
+ name = NULL;
+ shmTbl = NULL;
+ wakeupExFuncTbl = NULL;
+ downExFuncTbl = NULL;
+ onInit = NULL;
+ onDestory = NULL;
+ onDebugDump = NULL;
+ onTouch = NULL;
+ onLowMem = NULL;
+ priv = NULL;
+ }
+}T_PRIM_PRM;
+
+
+typedef struct {
+ BOOL bIsRun;
+ uint32_t timeout;
+}T_PRIM_MONITOR_PRM;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Main
+/// \~english @par Summary:
+/// Runs the main thread of primary library.
+/// \~english @param [in] p_prm
+/// T_PRIM_PRM - The pointer to the parameter table of primary library
+/// \~english @param [in] argc
+/// int - The number of command parameters (The parameters passed to main functions must be set without processing.)
+/// \~english @param [in] argv
+/// char* - Command parameters (The parameters passed to main functions must be set without processing.)
+/// \~english @par
+/// - Shared memory creation table \n
+/// In process running, register the shared memory to create.\n
+/// This creates the shared memory to be registered in process running and releases it in process end.\n
+/// This must terminate by adding {"\0"} into member shmName of table termination.\n
+/// It is able to access to the shared memory to have been created by shm_open.\n
+/// \~english @code
+/// typedef struct {
+/// char shmName[32]; /* Shared memory name */
+/// uint32_t size; /* Shared memory size (BYTE) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @par
+/// - Running extended function table / End extended function table \n
+/// Registers callback functions to be called in process start and exit.\n
+/// This must terminate by adding NULL into member func of table termination.\n
+/// Parameters prm of callback functions are User private information and the pointer designated by prm is passed as input parameters [in].\n
+/// Local phase numbers callback func by the designated phase numbers.\n
+/// \~english @code
+/// typedef struct {
+/// void (* func)( void* prm); /* Callback functions for function extension */
+/// void* prm; /* The pointer to the parameters of Callback function func */
+/// uint8_t localStep; /* Local phase numbers */
+/// uint8_t rsv[3]; /* Reserve for alignment */
+/// }PRIM_EXFUNC_TBL;
+/// @endcode
+/// \~english @par
+/// - %Parameter table of primary library\n
+/// For FrameworkunifiedOnInitialization/FrameworkunifiedOnDestroy/FrameworkunifiedOnDebugDump/TaskmanagerOnTouch/FrameworkunifiedOnLowMemory, check the corresponding API specification.\n
+/// It is able to get User private data by INI_GetPrivate().\n
+/// \~english @code
+/// typedef struct _T_PRIM_PRM{
+/// PCSTR name; /* Application name */
+/// const PRIM_SHAREDATA_TBL* shmTbl; /* The pointer to shared memory creation table */
+/// const PRIM_EXFUNC_TBL* wakeupExFuncTbl; /* The pointer to running extended function table */
+/// const PRIM_EXFUNC_TBL* downExFuncTbl; /* The pointer to end extended function table */
+/// EFrameworkunifiedStatus (*onInit)(HANDLE hApp); /* FrameworkunifiedOnInitialization callback function setting */
+/// EFrameworkunifiedStatus (*onDestory)(HANDLE hApp); /* FrameworkunifiedOnDestroy callback function setting */
+/// EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp); /* FrameworkunifiedOnDebugDump Callback function setting */
+/// EFrameworkunifiedStatus (*onTouch)(HANDLE hApp); /* TaskmanagerOnTouch callback function setting */
+/// EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp); /* FrameworkunifiedOnLowMemory callback function setting */
+/// void* priv; /* User private data */
+/// }T_PRIM_PRM;
+/// @endcode
+/// \~english @retval INI_SUCCESS Normal end
+/// \~english @retval INI_FALSE Abnormal end
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the shared memory creation table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the running extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the end extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnInitialization callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDestroy callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDebugDump callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of TaskmanagerOnTouch callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail:
+/// This executes the main processing of primary library. Functions do not return until all of end processing of process is completed. \n
+/// Normal end returns INI_SUCCESS and abnormal end does INI_FALSE. \n
+/// User process must return this function's returned values as the returned values of main function and end main function. \n
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int INI_Main(T_PRIM_PRM* p_prm,int argc,char* argv[]);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_ExitStart
+/// \~english @par Summary:
+/// Starts the end processing of process.
+/// \~english @param [in] rsv
+/// void* - The pointer to reservation parameters (NULL must be appointed)
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Collects the resource which primary library got, does the end processing equal to local_step=all and end process. \n
+/// (At the end processing in abnormality, process must be ended by not this function but exit(),_exit() function immediately) \n
+/// When this API is called after this API is already called, do nothing to process.
+/// \~english @par Supplemtent:
+/// local_step is the information defined in default_wakeup.xml/default_shutdown.xml as the definition of running order / end order. \n
+/// local_step defined in default_shutdown.xml has the following types.
+/// - 1-9 : Designates local phase numbers (the phase numbers of end processing)
+/// - last : This designates local phase numbers to be last. When there is the local phase processing not to be executed, this executes all.
+/// - all : The same as last.
+/// \~english @see INI_Main, INI_Init, INI_ExitDone
+////////////////////////////////////////////////////////////////////////////////////
+void INI_ExitStart(void* rsv); // Termination process start
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_ExitDone
+/// \~english @par Summary:
+/// Notifies the completion of process end processing.
+/// \~english @param [in] status
+/// int - Unused (This is for future extension. 0 must be designated.)
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Notifies the completion of service end processing to TaskManager. \n
+/// TaskManager ends the corresponding service by this notification. At the time, this callbacks FrameworkunifiedOnDestroy(). \n
+/// \~english @see INI_Main, INI_Init, INI_ExitStart
+////////////////////////////////////////////////////////////////////////////////////
+void INI_ExitDone(int status); // Termination process completed
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetPrivate
+/// \~english @par Summary:
+/// Gets private data.
+/// \~english @param None
+/// \~english @retval void* The pointer to user private data
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called and user private data must be set.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the private data designated at INI_Main/INI_Init from the inside of the context management information of the process inside primary library and returns it.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+void* INI_GetPrivate();
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetHandle
+/// \~english @par Summary:
+/// Gets the application handle of NSFW.
+/// \~english @param None
+/// \~english @retval void*(HANDLE) The application handle of NSFW
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called and the application handle of NSFW must be generated.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the application handle of NSFW from the inside of the context management information of the process inside primary library and returns it.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+void* INI_GetHandle();
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_SetMonitorTimeout
+/// \~english @par Summary:
+/// Requests the change for abnormality monitoring timeout time to Task Manager. \n
+/// (This is used when main thread is not implemented at service side)
+/// \~english @param [in] timeout
+/// uint32_t - Abnormality monitoring timeout time (sec)(When 0 is designated, the service must be out of abnormality monitoring object.)
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Main()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sets the abnormality monitoring timeout time designated by parameters inside the context management information of the process inside primary library and returns returned values and INI_SUCCESS. \n
+/// Set timeout time becomes valid after the event waiting at the loop of main thread and this requests the change for service abnormality monitoring timeout time to TaskManager. In other words, this API can be used after running extended function Callback. \n
+/// When process does not return to main thread past the timeout time designated by this function, TaskManager ends the service forcibly. When this function is not called, TaskManager treats the timeout of monitoring time as 50 seconds.
+/// \~english @see INI_Main
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_SetMonitorTimeout(uint32_t timeout);
+
+// Event completion notification
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_StepForkComp
+/// \~english @par Summary:
+/// Notifies the completion of running event to TaskManager.
+/// \~english @param [in] compId
+/// uint64_t - The comparison ID for phase running (Designates INI_INITCOMP_[a-zA-Z_]+ to define at INI_API.hpp)
+/// \~english @par
+/// The ID descripted at INI_API.hpp
+/// \~english @code
+/// - INI_INITCOMP_NONE: None
+/// - INI_INITCOMP_ON_START: For ON Start
+/// - INI_INITCOMP_NVM_ACCESS: For NVM access
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called.
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The sending of the completion notification of running event to TaskManager failed [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sends the comparison ID for phase running as the completion notification of running event to TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// TaskManager holds which completion notification of running event is notified and can add it to the transition conditions to next phase at phase running. \n
+/// The way to add at TaskManager side depends on the definition of next_trans_condition element described in default_wakeup.xml as the definition of running order.
+/// \~english @par Supplement:
+/// next_trans_condition is the element to designate transition conditions to next phase. The transition to next phase is done when the following two conditions are met. \n
+/// When the description of next_trans_condition element is omitted, transition is done only by condition 1. \n
+/// 1. All of the phase running request processing set by request element is completed. (The phase running request processing is executed by primary library asynchronously) \n
+/// 2. The completion notification of the event designated by next_trans_condition element is completed. \n
+/// Waiting conditions for event completion notification INI_INITCOMP_[A-Z]+ stipulated at INI_API.hpp is set in cond property designated at next_trans_condition element. \n
+/// AND condition can be set by being INI_INITCOMP_AAAA| INI_INITCOMP_BBBB when conditions are some. \n
+/// Event completion notification can be issued by using INI_StepForkComp.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_StepForkComp(uint64_t compId);
+
+// Event completion notification
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_AccOffComp
+/// \~english @par Summary:
+/// Notifies end event completion notification to TaskManager.
+/// \~english @param [in] compId
+/// uint64_t - The comparison ID for phase running (Designates INI_TERMCOMP_[a-zA-Z_]+ defined at INI_API.hpp)
+/// \~english @par
+/// The ID described at INI_API.hpp
+/// \~english @code
+/// - INI_TERMCOMP_NONE : None
+/// - INI_TERMCOMP_ACTIVITYMGR : For ActivityManager end
+/// - INI_TERMCOMP_RESIDENT : For resident service end
+/// - INI_TERMCOMP_TRANSIENT : For non-resident service end
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The sending of the completion notification of end event to TaskManager failed [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sends the comparison ID for phase running as the completion notification of end event to TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, return INI_FALSE. \n
+/// TaskManager holds which completion notification of end event is notified and can add it to the transition conditions to next phase at phase end. \n
+/// The way to add at TaskManager side depends on the definition of next_trans_condition element described in default_shutdown.xml as the definition of end order.
+/// \~english @par Supplement:
+/// next_trans_condition is the element to designate transition conditions to next phase. The transition to next phase is done when the following two conditions are met. \n
+/// When the description of next_trans_condition element is omitted, transition is done only by condition 1. \n
+/// 1. All of the phase end request processing set by request element is completed. (The phase end request processing is executed by primary library asynchronously) \n
+/// 2. The completion notification of the event designated by next_trans_condition element is completed. Waiting conditions for event completion notification INI_INITCOMP_[A-Z]+ stipulated at INI_API.hpp is set in cond property designated at next_trans_condition element. \n
+/// AND condition can be set by being INI_INITCOMP_AAAA| INI_INITCOMP_BBBB when conditions are some. \n
+/// Event completion notification can be issued by using INI_ AccOffComp.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_AccOffComp(uint64_t compId);
+
+// Get boot info
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetBootInfo
+// \~english @par Summary:
+/// Gets boot information.
+/// \~english @param [in] info
+/// T_SS_SM_START_DataStructType * - The pointer to boot information structure
+/// \~english @par
+/// T_SS_SM_START_DataStructType structure
+/// \~english @code
+/// typedef struct T_SS_SM_START_DataStruct{
+/// EPWR_WAKEUP_FACTOR_TYPE startupReason; /* Startup reason */
+/// BOOL isUserModeOn; /* User mode ON/OFF */
+/// ESMDataResetModeInfo dataResetMode; /* Data reset mode */
+/// EPWR_SC_SECURITY_STATUS securityStatus; /* Security state */
+/// EPWR_SC_WAKEUP_TYPE wakeupType; /* Battery disconnection state */
+/// ESMDramBackupStatus dramBackupStatus; /* Backup memory area state */
+/// ESMResetStatus resetStatus; /* Reset state */
+/// UI_32 resetCount; /* Abnormal reboot number */
+/// } T_SS_SM_START_DataStructType;
+///
+/// Startup reason type:
+/// - epswfIGN_ACC : Ignition ACC (Currently, Fixed)
+/// User mode ON/OFF:
+/// - TRUE : User mode ON (Currently, Fixed)
+/// Data reset mode:
+/// - e_SS_SM_DATA_RESET_NONE: Not-initialized
+/// - e_SS_SM_DATA_RESET_USER: User data initialization
+/// - e_SS_SM_DATA_RESET_FACTORY: Factory initialization
+/// Security state:
+/// - epsssUNLOCK : Unlock state
+/// - epsssLOCK : Lock state
+/// Battery disconnection state:
+/// - epsstWARMSTART : Battery disconnection does not occur
+/// - epsstCOLDSTART : Battery disconnection occurs
+/// Backup memory area state:
+/// - e_SS_SM_DRAM_BACKUP_OK: Backup OK of Backup memory area
+/// - e_SS_SM_DRAM_BACKUP_NG: Backup NG of Backup memory area
+/// Reset state:
+/// - e_SS_SM_RESET_STATUS_UNSET: Information unsetting(Not decided yet)
+/// - e_SS_SM_RESET_STATUS_NONE : Normal
+/// - e_SS_SM_RESET_STATUS_NG : Abnormality occurred (Abnormal RESET or booting after service abnormal end)
+/// - e_SS_SM_RESET_STATUS_IMMEDIATE : Immediate RESET occurred
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called. (%Process running must be completed)
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to boot information structure designated at parameters is NULL [INI_FALSE]
+/// - Startup reason type inside the context management information of the process inside primary library is wrong (%Process running is not completed) [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets boot information which is managed inside the context management information of the process inside primary library.
+/// If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// This sets valid values as info values in FrameworkunifiedOnStart of TaskManager. In other words, this sets valid values after running ActivityManager.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_GetBootInfo(T_SS_SM_START_DataStructType *info);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_GetExtBootInfo
+/// \~english @par Summary:
+/// Gets boot extended information.
+/// \~english @param [in] info
+/// T_SS_SM_START_ExtDataStructType * - The pointer to boot extended information structure
+/// \~english @par
+/// T_SS_SM_START_ExtDataStructType structure
+/// \~english @code
+/// #define SS_SM_START_EXT_INFO_SIZE 64
+/// #define SS_SM_START_EXT_BODY_SIZE ( sizeof(BOOL)
+/// + sizeof(EMRelaunchStatus)
+/// + sizeof(BOOL)
+/// + sizeof(BOOL)
+/// )
+/// define SS_SM_START_EXT_RSV_SIZE SS_SM_START_EXT_INFO_SIZE
+/// - SS_SM_START_EXT_BODY_SIZE
+/// typedef struct {
+/// BOOL isProgUpdated; /* Program update information */
+/// EMRelaunchStatus relaunchStatus; /* Own-service Relaunch state */
+/// BOOL isMapUpdated; /* Map update information */
+/// BOOL isMapDiffUpdated; /* Map difference update information */
+/// uint8_t reserved[SS_SM_START_EXT_RSV_SIZE]; /* Reserve area */
+/// } T_SS_SM_START_ExtDataStructType;
+///
+/// Program update information
+/// - TRUE : Program update
+/// - FALSE : No Program update
+/// Own-service Relaunch state:
+/// - e_SS_SM_RELAUNCH_STATUS_NONE : Relaunch does not occur (Initial boot)
+/// - e_SS_SM_RELAUNCH_STATUS_SAFE : Normal Relaunch
+/// - e_SS_SM_RELAUNCH_STATUS_ERR : Abnormal Relaunch
+/// Map update information:
+/// - TRUE : Map update
+/// - FALSE : No Map update
+/// Map difference update information
+/// - TRUE : Map difference update
+/// - FALSE : No Map difference update
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - INI_Main or INI_Init must be called. (%Process running must be completed.)
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to boot information structure designated at parameters is NULL [INI_FALSE]
+/// - Startup reason type inside the context management information of the process inside primary library is wrong (%Process running is not completed) [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets boot extended information which is managed inside the context management information of the process inside primary library.
+/// If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE \n
+/// This sets valid values as info values in FrameworkunifiedOnStart of TaskManager. In other words, this sets valid values after running ActivityManager.
+/// Because TaskManager does not have Relaunch function, always sets e_SS_SM_RELAUNCH_STATUS_NONE in relaunchStatus.
+/// \~english @see INI_Main, INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *info);
+
+//withoutMainLoop
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Init
+/// \~english @par Summary:
+/// Initializes primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_prm
+/// T_PRIM_PRM - The pointer to parameter table of primary library
+/// \~english @param [in] argc
+/// int - The number of command parameters (The parameters passed to main functions must be set without processing)
+/// \~english @param [in] argv
+/// char* - Command parameters (The parameters passed to main functions must be set without processing)
+/// \~english @param [out] fdNum
+/// int * - The number of element stored in fdlist (INI_FD_MAX:3)
+/// \~english @param [out] fdlist[INI_FD_MAX]
+/// int - The array of FD (File Descriptor) for event reception which primary library waits
+/// \~english @par
+/// - Shared memory creation table \n
+/// In process running, register the shared memory to create. \n
+/// This creates the shared memory to be registered in process running and releases it in process end. \n
+/// This must terminate by adding {"\0"} into member shmName of table termination. \n
+/// It is able to access to the shared memory to have been created by shm_open. \n
+/// \~english @code
+/// typedef struct {
+/// char shmName[32]; /* Shared memory name */
+/// uint32_t size; /* Shared memory size (BYTE) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @par
+/// - Running extended function table / End extended function table \n
+/// Registers callback functions to be called in process start and exit. \n
+/// This must terminate by adding NULL into member func of table termination. \n
+/// Parameters prm of callback functions are User private information and the pointer designated by prm is passed as input parameters [in]. \n
+/// Local phase numbers callback func by the designated phase numbers. \n
+/// \~english @code
+/// typedef struct {
+/// void (* func)( void* prm); /* Callback functions for function extension */
+/// void* prm; /* The pointer to the parameters of Callback function func */
+/// uint8_t localStep; /* Local phase numbers */
+/// uint8_t rsv[3]; /* Reserve for alignment */
+/// }PRIM_EXFUNC_TBL;
+/// @endcode
+/// \~english @par
+/// - %Parameter table of primary library \n
+/// For FrameworkunifiedOnInitialization/FrameworkunifiedOnDestroy/FrameworkunifiedOnDebugDump/TaskmanagerOnTouch/FrameworkunifiedOnLowMemory, check the corresponding API specification. \n
+/// It is able to get User private data by INI_GetPrivate(). \n
+/// \~english @code
+/// typedef struct _T_PRIM_PRM{
+/// PCSTR name; /* Application name */
+/// const PRIM_SHAREDATA_TBL* shmTbl; /* The pointer to shared memory creation table */
+/// const PRIM_EXFUNC_TBL* wakeupExFuncTbl; /* The pointer to running extended function table */
+/// const PRIM_EXFUNC_TBL* downExFuncTbl; /* The pointer to end extended function table */
+/// EFrameworkunifiedStatus (*onInit)(HANDLE hApp); /* FrameworkunifiedOnInitialization callback function setting */
+/// EFrameworkunifiedStatus (*onDestory)(HANDLE hApp); /* FrameworkunifiedOnDestroy callback function setting */
+/// EFrameworkunifiedStatus (*onDebugDump)(HANDLE hApp); /* FrameworkunifiedOnDebugDump Callback function setting */
+/// EFrameworkunifiedStatus (*onTouch)(HANDLE hApp); /* TaskmanagerOnTouch callback function setting */
+/// EFrameworkunifiedStatus (*onLowMem)(HANDLE hApp); /* FrameworkunifiedOnLowMemory callback function setting */
+/// void* priv; /* User private data */
+/// }T_PRIM_PRM;
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer to the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the shared memory creation table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the running extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The pointer to the end extended function table inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnInitialization callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDestroy callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of FrameworkunifiedOnDebugDump callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// - The setting of TaskmanagerOnTouch callback function inside the parameter table of primary library is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Initializes primary thread. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE. \n
+/// When implementing main thread at service, this function must be called in running main thread. \n
+/// Waits fd of fdlist gotten by functions by select and when there is change in fd, service must execute event handler of primary by calling INI_Handler().
+/// \~english @see INI_Main
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_Init(T_PRIM_PRM* p_prm,int argc ,char* argv[],int *fdNum,int fdlist[INI_FD_MAX]);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Handler
+/// \~english @par Summary:
+/// Processes the reception event of primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_fds
+/// fd_set* - fd set varied and detected by select()
+/// \~english @retval TRUE Service running (Continuing)
+/// \~english @retval FALSE The process end processing of primary library is completed
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Init()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Access is not from main thread context [FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// When FD which primary library should process in fd set designated by p_fds is included, processes event processing of primary library. \n
+/// When implementing main thread by service, it is necessary to execute the event reception processing of primary library by this function. \n
+/// Returns TRUE during service running and does FALSE when the process end processing of primary library was completed. When FALSE is returned, service must call
+/// INI_Term() and end itself.
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+BOOL INI_Handler(fd_set* p_fds);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_Term
+/// \~english @par Summary:
+/// Releases the resource of primary library. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param None
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_Init()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Releases the resource of primary library. \n
+/// When implementing main thread at service, this function must release the resource of primary library in service end.
+/// \~english @see INI_Init, INI_Handler
+////////////////////////////////////////////////////////////////////////////////////
+void INI_Term(void);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup INI_SetMonitorState
+/// \~english @par Summary:
+/// Sets abnormality monitoring state. \n
+/// (This is used when implementing main thread at service side)
+/// \~english @param [in] p_prm
+/// T_PRIM_MONITOR_PRM - The pointer to the parameters structure for monitoring
+/// \~english @par
+/// T_PRIM_MONITOR_PRM structure
+/// \~english @code
+/// typedef struct {
+/// BOOL bIsRun; /* Monitoring state (TRUE:RUN FALSE:SLEEP) */
+/// uint32_t timeout; /* Monitoring timeout time (sec) */
+/// }PRIM_SHAREDATA_TBL;
+/// @endcode
+/// \~english @retval INI_SUCCESS Succeeded
+/// \~english @retval INI_FALSE Failed
+/// \~english @par Preconditions:
+/// - Main thread must be run at INI_ Init ()
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - The pointer(p_prm) to the parameters structure for monitoring designated by parameters is NULL [INI_FALSE]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Sets abnormality monitoring for TaskManager. If it succeeded, returns INI_SUCCESS and if it failed, does INI_FALSE \n
+/// When bIsRun=FALSE is not set until time designated by timeout passes after setting bIsRun=TRUE, TaskManager decides that the service falls into abnormal state and ends forcibly. \n
+/// When 0 is designated at monitoring timeout time(timeout), the service must be out of abnormality monitoring object.
+/// When monitoring state (bIsRun) is FALSE, monitoring state becomes invalid. \n
+/// This API can be used after running extended function CALLBACK.
+/// \~english @see INI_Init
+////////////////////////////////////////////////////////////////////////////////////
+int32_t INI_SetMonitorState(T_PRIM_MONITOR_PRM *p_prm);
+
+
+void _INI_DEBUGDUMP(BOOL bIsNeedSvcName, PCSTR f_cFormat, ...);
+
+#define INI_DEBUGDUMP(args...) _INI_DEBUGDUMP(TRUE, ## args)
+#define INI_DEBUGDUMP_RAW(args...) _INI_DEBUGDUMP(FALSE, ## args)
+
+// Callback functions
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TaskmanagerOnTouch
+/// \~english @par Summary:
+/// Callback to notify process use
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @retval eFrameworkunifiedStatusOK Succeeded
+/// \~english @retval Other-than-eFrameworkunifiedStatusOK Failed (Error type depends on the implementation at user side)
+/// \~english @par Preconditions:
+/// - Must set inside running information structure in calling INI_Main or INI_Init
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Implementation specification of callback depends on the implementation (design) of an application. For this, error type on failure conditions must be considered at an application side.
+/// \~english @par Detail:
+/// Service is call backed just before using. \n
+/// INI_ExitStart must not be issued for 30 seconds after service called this function. \n
+/// Timeout must be implemented such as counting up by using interval timer so that INI_ExitStart is not issued by timeout after this API was called. \n
+/// This function cannot call the API (TSKM_Xxxx) of TaskManager. (If this calls, deadlock occurs)
+/// \~english @par Classification:
+/// Public
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+EFrameworkunifiedStatus TaskmanagerOnTouch(HANDLE hApp);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //_INI_API_HPP_
+
+/** @}*/ // end of TaskManager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/task_manager/server/include/system_service/Primary_common.h b/systemservice/task_manager/server/include/system_service/Primary_common.h
new file mode 100644
index 00000000..e0624bba
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/Primary_common.h
@@ -0,0 +1,148 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file Primary_common.h
+ * @brief \~english This file contains declaration of common enum and structures
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+
+#include <stdint.h>
+#include <pthread.h>
+
+typedef unsigned int PRI_DWORD; // To eliminate the DWORD
+
+/* SRAM process type */
+#define SRAM_INIT (int)0 /* Initialization processing specification */
+#define SRAM_CHK (int)1 /* Range check processing specification */
+#define SRAM_MAPVER (int)2 /* Map Version change support designation */
+#define SRAM_MAPVER_CHK (int)3 /* Map Version change support + range checking specification */
+#define SRAM_SYSTEM_INIT (int)4 /* System initialization processing specification */
+#define SRAM_CONFIG_INIT (int)5 /* Reset setting */
+
+/* Processing result */
+#define SRAM_CHK_OK (int)0 /* SRAM checking completed normally (no change) */
+#define SRAM_CHK_CHG (int)1 /* SRAM checking Successful completion value is changed (Including during initialization) */
+#define SRAM_CHK_NG (int)-1 /* SRAM checking error */
+
+/*
+ Constant definition
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+#define PRIM_SHM_NAME_MAX 32 /* Maximum name size */
+
+// Local stage number of the stage start request/end request from the TSKM
+// In XML, it is set with a direct value of 1-9, but it is left because the legacy service refers to this definition
+enum _PRIM_FORK_STEP {
+ PRIM_STEPFORK_FIRST = 1, /* First startup step */
+ PRIM_STEPFORK_SECOND, /* 2nd startup step */
+ PRIM_STEPFORK_THIRD, /* 3rd startup step */
+ PRIM_STEPFORK_FOURTH, /* 4th startup step */
+ PRIM_STEPFORK_FIFTH, /* 5th startup step */
+ PRIM_STEPFORK_SIXTH, /* 6th startup step */
+ PRIM_STEPFORK_SEVENTH, /* 7th startup step */
+ PRIM_STEPFORK_EIGHTH, /* 8th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_NINTH, /* 9th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_TENTH, /* 10th startup step */ /* #GPF_10_018 */
+ PRIM_STEPFORK_MAX /* Maximum number of Gradual startup steps */ /* Used for judgment when receiving gradual startup */
+};
+
+enum _PRIM_ACCOFF_STEP {
+ PRIM_ACCOFF_FIRST = 1, /* First step */
+ PRIM_ACCOFF_SECOND, /* 2nd step */
+ PRIM_ACCOFF_THIRD, /* 3rd step */
+ PRIM_ACCOFF_FOURTH, /* 4th step */
+ PRIM_ACCOFF_FIFTH, /* 5th step */
+ PRIM_ACCOFF_MAX /* Total number of ACC-OFF steps */ /* Used for judgment when receiving ACC-OFF instruction */
+};
+
+/******************************************************************************
+ * TAG : PRIM_SHAREDATA_TBL
+ * ABSTRACT : Shared data table
+ * NOTE :
+ ******************************************************************************/
+/* Structure of shared data table */
+typedef struct {
+ char shmName[PRIM_SHM_NAME_MAX]; /* Shared data name */
+ int32_t size; /* Shared data size */
+} PRIM_SHAREDATA_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_FORK_TBL
+ * ABSTRACT : Startup process table
+ * NOTE :
+ ******************************************************************************/
+typedef struct {
+ PRI_DWORD (*threadFunc)(void* prm); /* Thread function */
+ void* prm; /* Thread startup parameters */
+ uint32_t priority; /* Thread priority */
+ uint16_t pno; /* Thuread number */
+ uint8_t rsv; /* Reserved field */
+ uint8_t wakeLocalStep; /* Startup step */
+ // The following is valid only when useLegacy = FALSE
+ char threadName[16]; /* Thread name */
+ char downLocalStep; /* When the termination step is 0, termination notification is not issued */
+ void* primaryLocal; /* Local area for libPrimary (cannot be changed) */
+} PRIM_FORK_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_EXFUNC_TBL
+ * ABSTRACT : Feature extension table
+ ******************************************************************************/
+typedef struct {
+ void (*func)(void* prm); /* Feature extension function */
+ void* prm; /* parameters */
+ uint8_t localStep; /* Startup step */
+ uint8_t rsv[3]; /* Reserved */
+} PRIM_EXFUNC_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_BACKUPCHK_TBL
+ * ABSTRACT : Function table for check backup data
+ ******************************************************************************/
+typedef struct {
+ int32_t (*func)(int32_t kind); /* Feature Extension Functions */
+} PRIM_BACKUPCHK_TBL;
+
+/******************************************************************************
+ * TAG : PRIM_ACCOFF_TBL
+ * ABSTRACT : ACC-OFF process table
+ ******************************************************************************/
+typedef struct {
+ uint32_t localStep; /* ACC-OFF process step */
+ uint16_t pno; /* PNO of Notification destination */
+ uint8_t rsv[2];
+} PRIM_ACCOFF_TBL;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
+/*
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ End of File : Primary_common.h
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ */
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/system_service/sysup.h b/systemservice/task_manager/server/include/system_service/sysup.h
new file mode 100644
index 00000000..ef930a4b
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/sysup.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file sysup.h
+ * @brief \~english This file contains declaration of system status(SYS_RESET, SYS_ONLY_RESET)
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+
+#define SYS_RESET (int32)1 /* Resetting */
+#define SYS_ONLY_RESET (int)2 /* Reset only */
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_H_
+/** @}*/
+/** @}*/
+/** @}*/
+
diff --git a/systemservice/task_manager/server/include/system_service/sysup_from.h b/systemservice/task_manager/server/include/system_service/sysup_from.h
new file mode 100644
index 00000000..be7e0feb
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/sysup_from.h
@@ -0,0 +1,41 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
+
+/**
+ * @file sysup_from.h
+ * @brief \~english empty file
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+// Deleted the definitions in the file because they are not used.
+// Left them for legacy sources that you include.
+/** @}*/
+/** @}*/
+/** @}*/
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_SYSUP_FROM_H_
diff --git a/systemservice/task_manager/server/include/system_service/task_manager.h b/systemservice/task_manager/server/include/system_service/task_manager.h
new file mode 100644
index 00000000..82d23fb7
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/task_manager.h
@@ -0,0 +1,54 @@
+/*
+ * @copyright Copyright (c) 2017-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file task_manager.h
+ * @brief \~english include all task_manager_library head files
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+
+#include "system_service/INI_API.h"
+#include "system_service/INI_API.hpp"
+#include "system_service/Primary_common.h"
+#include "system_service/sysup_from.h"
+#include "system_service/sysup.h"
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_type.h"
+#include "system_service/tskm.h"
+#include "system_service/tskm_local_type.h"
+#include "system_service/tskm_xml_data.h"
+#include "system_service/tskm_svcid.h"
+#include "system_service/task_manager_libtskmcfg.h"
+#include "system_service/tskm_data_init.h"
+#include "system_service/task_manager_libss_data_init.h"
+
+
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TASK_MANAGER_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/system_service/tskm.h b/systemservice/task_manager/server/include/system_service/tskm.h
new file mode 100644
index 00000000..1a2f962d
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/tskm.h
@@ -0,0 +1,413 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file tskm.h
+ * @brief \~english This file contains primary API of task manager
+ */
+
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+
+
+#include <other_service/rpc.h>
+#include "system_service/tskm_type.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TSKM_ID RPC_ID
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Init
+/// \~english @par Summary:
+/// Creates the resource to communicate with Task_Manager.
+/// \~english @param [out] *pID
+/// UINT32 - Unique ID of the automatically allocated program
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - None
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Creates the resource to communicate with Task_Manager. \n
+/// It is necessary to call this before using the APIs of TSKM_xxxx defined after this. \n
+/// It is necessary to call this by the thread. \n
+/// \~english @see TSKM_End
+////////////////////////////////////////////////////////////////////////////////////
+#define TSKM_Init(p_tskmId) RPC_START_CLIENT(p_tskmId)
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_End
+/// \~english @par Summary:
+/// Releases the resource created at TSKM_Init.
+/// \~english @param [in] ID
+/// UINT32 - ID gotten at TSKM_Init()
+/// \~english @retval None
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal stat:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// None
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Releases the resource created at TSKM_Init.
+/// \~english @see TSKM_Init
+////////////////////////////////////////////////////////////////////////////////////
+#define TSKM_End(tskmId) RPC_end(tskmId)
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SvcCtl
+// \~english @par Summary:
+/// Run the control for service.
+/// \~english @param [in] svcid
+/// TSKM_SVCID_t - Service ID
+/// \~english @param [in] ctl
+/// TSKM_SVC_CTL_t* - Command
+/// \~english @code
+/// typedef struct{
+/// TSKM_SVC_CMD_t cmd;
+/// } TSKM_SVC_CTL_t;
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_STATE State error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters ctl is NULL [TSKM_E_PAR]
+/// - Service context is not found [TSKM_E_PAR]
+/// - Before FrameworkunifiedOnStart of Task_Manager is called [TSKM_E_STATE]
+/// - It is prohibited to run designated service [TSKM_E_STATE]
+/// - Message sending failed [TSKM_E_RETRY]
+/// - When the specified service executes the start prohibition except during
+/// the stop or start prohibition status. [TSKM_E_STATE]
+/// - Maximum numbers to register running reservation service are exceeded [TSKM_E_STATE]
+/// - Anything except for the commands specified as parameters is designated [TSKM_E_PAR]
+/// - Writing in files of running reservation information failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// - TSKM_SVC_CMD_EXEC\n
+/// Designated service runs. \n
+/// When designated service already runs, this returns TSKM_E_OK without processing service running. \n
+/// Running equal to local_step=all of request element is done. \n
+/// When designated service designates the service that running is prohibited by
+/// TSKM_SVC_CMD_DISABLE, this returns TSKM_E_STATE. \n
+/// This guarantees that service running finished in API succeeding. \n
+/// - TSKM_SVC_CMD_DISABLE\n
+/// This prohibits to run the designated service. \n
+/// At the prohibited service to run already, this returns TSKM_E_OK without doing anything. \n
+/// When this API uses the service to be run already, this returns TSKM_E_STATE. \n
+/// By this, at resident service, it is necessary to call this before running corresponding service. \n
+/// About the prohibited service, this doesn't decide the wait condition of event completion notice
+/// which service running, phase startup, phase end request, corresponding service control. \n
+/// This command is prepared in consideration of changing the service to run in response to
+/// with or without extended BOX and device configuration. \n
+/// Initial values are running permission. \n
+/// - TSKM_SVC_CMD_ENABLE\n
+/// This permits to run the service to be set as running prohibition. \n
+/// At running permission service, this returns TSKM_E_OK without doing anything. \n
+/// - TSKM_SVC_RESERVE\n
+/// This does the running reservation of non-resident service. \n
+/// In next running, designated service runs automatically after finishing in running resident service. \n
+/// Once this runs automatically, this forgets reservation information. \n
+/// Maximum numbers of service able to do running reservation is the values of TSKM_SVC_RESERVE_MAX. \n
+/// When this reserves over maximum numbers, this returns TSKM_E_STATE. \n
+/// When backup RAM is invalid in running, this does not run automatically and
+/// discards reservation information. \n
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SvcCtl(TSKM_SVCID_t svcId, const TSKM_SVC_CTL_t* ctl);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SvcGetInfo
+// \~english @par Summary:
+/// Gets the information of designated service.
+/// \~english @param [in] svcid
+/// TSKM_SVCID_t - Service ID
+/// \~english @param [out] svcInfo
+/// TSKM_SVC_INFO_t* - Service information
+/// \~english @code
+/// typedef struct {
+/// TSKM_SVCID_t svcId;
+/// TSKM_BOOL_t isExecDisable;
+/// } TSKM_SVC_INFO_t;
+/// svcId : Service ID
+/// isExecDisable : Service running prohibition state
+/// TSKM_TRUE : Running prohibition
+/// TSKM_FALSE : Running permission
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Service context is not found [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Gets the information of designated service.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SvcGetInfo(TSKM_SVCID_t svcId, TSKM_SVC_INFO_t* svcInfo);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_ErrorReboot
+/// \~english @par Summary:
+/// Let system do abnormal reboot.
+/// \~english @param [in] p_info
+/// TSKM_ERROR_REBOOT_t* - REBOOT information
+/// \~english @code
+/// typedef struct {
+/// TSKM_ERROR_REBOOT_TYPE_t type;
+/// TSKM_LOGGING_ INFO_t log;
+/// } TSKM_ERROR_REBOOT_t;
+/// type
+/// TSKM_ERROR_REBOOT_NORMAL : Abnormal detection
+/// log : Log saving information
+/// typedef struct {
+/// char messageStr[TSKM_LOGGING_MSG_STR_SIZE];
+/// } TSKM_LOGGING_INFO_ t;
+/// messageStr : Abnormal message character string
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// - Reboot factors are except for TSKM_ERROR_REBOOT_NORMAL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Does REBOOT. \n
+/// It is assumed to issue when system is damaged if processing continues any more
+/// such as device trouble and non-volatile data trouble. \n
+/// Access limitation is done to this API by gid and uid. \n
+/// When an application with no authorization calls this, this force-quits the application to have called API. \n
+/// This stores the string designated to messageStr as factors in system information LOG. \n
+/// To link with PSMShadow about trouble factors, this designates abnormal message character string defined
+/// inside ss_error_message.h to messageStr.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Reboot
+/// \~english @par Summary:
+/// Let system do reboot.
+/// \~english @param [in] rsv
+/// TSKM_RSV_t* - Reservation ( This must designate NULL)
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_rsv is except for NULL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync x Method
+/// \~english @par Detail:
+/// Let system do normal reboot.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_Reboot(const TSKM_RSV_t * p_rsv);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_Logging
+/// \~english @par Summary:
+/// Stores LOG in internal non-volatile area.
+/// \~english @param [in] p_info
+/// TSKM_LOGGING_INFO_t * - Log storing information
+/// \~english @code
+/// typedef struct{
+/// TSKM_LOGGING_TYPE_NORMAL_t type;
+/// char messageStr[TSKM_LOGGING_MSG_STR_SIZE];
+/// }TSKM_LOGGING_INFO_t;
+/// type : Log storing type
+/// TSKM_LOGGING_TYPE_MODULE_LOGS: General LOG storing request from service
+/// TSKM_LOGGING_TYPE_GRP_RELAUNCH: Log collection by Group Relaunch
+/// messageStr : Trouble factors
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync only
+/// \~english @par Detail:
+/// Collects LOG information and stores it in internal non-volatile area \n
+/// This stores the string designated to messageStr as factors in system information LOG.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_Logging(const TSKM_LOGGING_INFO_t* p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_DataInit
+/// \~english @par Summary:
+/// Does the initialization process of service data.
+/// \~english @param [in] hApp
+/// HANDLE - Application handle
+/// \~english @param [in] p_info
+/// TSKM_DATAINIT_t * - Data initialization information
+/// \~english @code
+/// typedef struct {
+/// TSKM_DATAINIT_TYPE_t type;
+/// EFrameworkunifiedStatus (*onCompInit)(HANDLE hApp);
+/// } TSKM_DATAINIT_t;
+/// type : Data initialization type
+/// TSKM_DATAINIT_TYPE_USER : User data initialization
+/// onCompInit : Initialization complete Callback
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters hAPP is NULL [TSKM_E_PAR]
+/// - Parameters p_info is NULL [TSKM_E_PAR]
+/// - Member type of parameters p_info is except for TSKM_DATAINIT_TYPE_USER [TSKM_E_PAR]
+/// - Member onCompInit of parameters p_info is NULL [TSKM_E_PAR]
+/// - The process of FrameworkunifiedAttachCallbackToDispatcher failed [TSKM_E_NG]
+/// - The process of FrameworkunifiedOpenService failed [TSKM_E_STATE]
+/// - The process of FrameworkunifiedSendMsg failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Method only
+/// \~english @par Detail:
+/// - How to report \n
+/// Reports by Callback of onCompInit. \n
+/// This can get message data by calling GetMsgData inside onCompInit. \n
+/// - Structure of message data \n
+/// TSKM_ERR_t:Processing result \n
+/// TSKM_E_OK :Normal end \n
+/// TSKM_E_STATE :State error \n
+/// TSKM_E_NG :Error
+/// - Summary of action \n
+/// Calls initialization functions which each service implemented. \n
+/// When this API was called before Availability of Task_Manager becomes TRUE, this
+/// does not call initialization functions and returns TSKM_E_STATE by onCompInit. \n
+/// It is permitted for same application to call this API several times, at this case,
+/// it is necessary to designate the pointer to same functions to onCompInit. \n
+/// When this API was called by designating TSKM_DATAINIT_TYPE_USER to type, this calls
+/// the initialization functions of each service by designating the following parameters. \n
+/// <table>
+/// <tr><th>Member</th><th>Values</th></tr>
+/// <tr><td>startupReason</td><td>epswfIGN_ACC</td></tr>
+/// <tr><td>isUserModeOn</td><td>TRUE</td></tr>
+/// <tr><td>dataResetMode</td><td>e_SS_SM_DATA_RESET_MODE_USER</td></tr>
+/// <tr><td>wakeupType</td><td>epsstWARMSTART</td></tr>
+/// <tr><td>dramBackupStatus</td><td>e_SS_SM_DRAM_BACKUP_OK</td></tr>
+/// <tr><td>resetStatus</td><td>e_SS_SM_RESET_STATUS_NONE</td></tr>
+/// <tr><td>resetCount</td><td>0</td></tr>
+/// </table>
+/// Because Task_Manager calls the initialization functions of each service and implements
+/// the recovery processing according to running factors at the timing of fixing running factor,
+/// this designates the above parameters not to do duplicate recover processing.
+/// \~english @see TSKM_DATA_INIT_FUNC
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_DataInit(HANDLE hApp, const TSKM_DATAINIT_t *p_info);
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup TSKM_SetWakeupOrder
+/// \~english @par Summary:
+/// Holds running order.
+/// \~english @param [in] p_order
+/// TSKM_WAKEUP_ORDER_t * - Running order information
+/// \~english @code
+/// typedef struct {
+/// char orderName[TSKM_ORDER_NAME_MAX];
+/// } TSKM_WAKEUP_ORDER_t;
+/// orderName: Order name (MAX:31 characters)
+/// @endcode
+/// \~english @retval TSKM_E_OK Succeeded
+/// \~english @retval TSKM_E_PAR %Parameter error
+/// \~english @retval TSKM_E_NG Error
+/// \~english @par Preconditions:
+/// - TSKM_Init must be used and initialized
+/// \~english @par Changes of the internal state:
+/// - The internal state is not changed
+/// \~english @par Causes of failures:
+/// - Parameters p_order is NULL [TSKM_E_PAR]
+/// - The string length of the member orderName of Parameters p_order exceeds 32 [TSKM_E_PAR]
+/// - The process of SetWakeupOrderToSystemManager failed [TSKM_E_NG]
+/// \~english @par Classification:
+/// Public
+/// \~english @par Type
+/// Sync x Sync
+/// \~english @par Detail:
+/// This function is Wrapper function to provide SetWakeupOrderToSystemManager
+/// by sessionless which SystemManger provides.
+/// This designates NULL to p_order and returns TSKM_E_PAR.
+/// For the detail of action, refer to SystemManager (SetWakeupOrderToSystemManager).
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t TSKM_SetWakeupOrder(const TSKM_WAKEUP_ORDER_t* p_order);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_H_
+
+/** @}*/ // end of Task_Manager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
+
+
diff --git a/systemservice/task_manager/server/include/system_service/tskm_local_type.h b/systemservice/task_manager/server/include/system_service/tskm_local_type.h
new file mode 100644
index 00000000..79831aa1
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/tskm_local_type.h
@@ -0,0 +1,287 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_local_type.h
+ * @brief \~english localtype of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <native_service/frameworkunified_types.h>
+#include "system_service/INI_API.hpp"
+#include "system_service/tskm_type.h"
+
+//==================================================
+// Configuration
+//==================================================
+
+#if 1
+#define TSKM_CFG_WAIT_SHUTDOWN 10000
+#else
+#define TSKM_CFG_WAIT_SHUTDOWN 1 // Handy for test
+#warning TSKM_CFG_WAIT_SHUTDOWN is temorary
+#endif
+
+#define TSKM_CFG_TOUCH_TIMEOUT 2 // TOUCH time-out
+
+//==================================================
+// Task manager internal
+//==================================================
+// State
+#define TSKM_ST_ACCOFF 0x01000000U // ACC-OFF (Default) No transition here
+#define TSKM_ST_ACCON 0x02000000U // ACC-ON
+#define TSKM_ST_WAKEUP 0x02010000U // Gradual startup
+#define TSKM_ST_RUNNING 0x02020000U // Running (Startup completed)
+#define TSKM_ST_DOWN 0x02040000U // Gradual Terminating
+
+typedef uint32_t TSKM_STATE_t;
+#define TSKM_STATE_MASK0 0xFF000000U
+#define TSKM_STATE_MASK1 0xFFFF0000U
+#define TSKM_STATE_MASK2 0xFFFFFF00U
+#define TSKM_STATE_MASK3 0xFFFFFFFFU
+
+// Global step IDs for gradual starting
+typedef uint32_t TSKM_GLOBAL_STEP_t;
+#define TSKM_GSTEP_NONE 0x00000000U //
+#define TSKM_GSTEP_BUPCHK 0x00000001U
+
+// Local step
+typedef uint32_t TSKM_LOCAL_STEP_t;
+#define TSKM_LSTEP_LAST 0xFFFFFFF0U // Executing to end of local steps
+#define TSKM_LSTEP_SHM 0xFFFFFFF1U // Creating shared memory
+#define TSKM_LSTEP_BUPCHK 0xFFFFFFF2U // Checking backup memory
+#define TSKM_LSTEP_ALL 0xFFFFFFF3U // Executing all user definitions
+
+/************************************************************
+ * Structure of gradual startup/termination structure
+ (When this structure is modified, structure of parsexml is also changed)
+ *************************************************************/
+// Structure of request for services
+typedef struct {
+ TSKM_SVCID_t svcId; // Service ID
+ TSKM_LOCAL_STEP_t localStep; // Local step number
+} TSKM_GSTEP_REQ_INFO_t;
+
+// Structure of gradual startup/termination
+typedef struct {
+ uint32_t gstepId;
+
+ // List of executing services
+ uint32_t execSvcNum;
+ TSKM_SVCID_t* execSvcIdList;
+
+ // List of request
+ uint32_t reqNum;
+ TSKM_GSTEP_REQ_INFO_t* reqList;
+
+ // Event completion wait conditions
+ uint64_t nextTransCond;
+} TSKM_GSTEP_t;
+
+typedef struct {
+ uint32_t gstepIdx; // Step index
+ uint32_t gstepNum; // Step number
+ TSKM_GSTEP_t* gstep; // Gradual startup/termination info
+ uint64_t compState; // Status of receiving for Event completion notification
+} TSKM_GSTEP_CTX_t;
+
+//********* Non-volatile management information ****************
+
+#define TSKM_NV_STRUCT_VERSION "v000" // Compatible version of non-volatile management structure
+#define TSKM_SVC_RESERVE_MAX (8) // Maximum number of reserved services to startup
+
+#define TSKM_NV_SIZE_ALL (512)
+#define TSKM_NV_SIZE_HEADER (32)
+#define TSKM_NV_SIZE_FOOTER (32)
+#define TSKM_NV_SIZE_BODY (TSKM_NV_SIZE_ALL - TSKM_NV_SIZE_HEADER - TSKM_NV_SIZE_FOOTER)
+
+// Header
+typedef struct {
+ char version[5];
+} TSKM_NV_HEADER_t;
+
+// Footer
+typedef struct {
+ uint32_t checkSum;
+} TSKM_NV_FOOTER_t;
+
+// Body
+typedef struct {
+ uint8_t rsvSvcNum; // Number of reserved services
+ TSKM_SVCID_t rsvSvcs[TSKM_SVC_RESERVE_MAX]; // List of services
+} TSKM_NV_BODY_t;
+
+// Non-volatile storage info
+typedef struct {
+ TSKM_NV_HEADER_t header;
+ uint8_t rsvHeader[TSKM_NV_SIZE_HEADER - sizeof(TSKM_NV_HEADER_t)];
+ TSKM_NV_BODY_t body;
+ uint8_t rsvBody[TSKM_NV_SIZE_BODY - sizeof(TSKM_NV_BODY_t)];
+ uint8_t rsvFooter[TSKM_NV_SIZE_FOOTER - sizeof(TSKM_NV_FOOTER_t)];
+ TSKM_NV_FOOTER_t footer;
+} TSKM_NV_INFO_t;
+
+// Internal event
+typedef enum {
+ TSKM_EV_NOP, // Do nothing
+ // TSKM->PRI
+ TSKM_EV_PRI_REQ_WAKEUP, // Startup request
+ TSKM_EV_PRI_REQ_DOWN, // Termination request
+ TSKM_EV_PRI_REQ_TOUCH,
+ TSKM_EV_PRI_REQ_DEBUGDUMP, // DebugDump request
+ TSKM_EV_PRI_REP_LOWMEM, // LowMemory detection request
+
+ // PRI->TSKM(SVC)
+ TSKM_EV_PRI_REP_WAKEUP_COMP, // Notification of event completion at startup
+ TSKM_EV_PRI_REP_DOWN_COMP, // Notification of event completion at termination
+ TSKM_EV_PRI_REP_CONNECT, // Connecting
+ TSKM_EV_PRI_REP_DISCONNECT, // Disconnecting
+ TSKM_EV_PRI_RES_WAKEUP, // Response to startup request
+ TSKM_EV_PRI_RES_DOWN, // Response to termination request
+ TSKM_EV_PRI_RES_DEBUGDUMP, // Response to DebugDump request
+ TSKM_EV_PRI_REQ_EXIT, // Response to terminating request
+
+ // SVC->TSKM
+ TSKM_EV_SVC_REP_TERM, // Termination of service
+
+ // APL->TSKM
+ TSKM_EV_API_REQ_REBOOT, // Reboot system
+ TSKM_EV_API_REQ_SVC_CTL, // Startup service
+ TSKM_EV_API_REQ_SVC_DISABLE, // Prohibit starting service
+
+ // Internal message
+ TSKM_EV_LCL_REQ_STOP, // Termination request
+ TSKM_EV_LCL_CHG_SVC_STATE, // State Change of service
+ TSKM_EV_LCL_REQ_SDUMP, // Dump of service list
+ TSKM_EV_LCL_REP_TIMEOUT, // Occured Timeout
+ TSKM_EV_LCL_REP_POLLING, // Polling request
+ TSKM_EV_LCL_REP_LOWMEM, // Notification of LowMemory detection
+ TSKM_EV_LCL_REQ_TRANS_STEP, // Gradual transitioning request
+} TSKM_EVENT_t;
+
+#define TSKM_EV_BOOTINFO_SIZE sizeof(T_SS_SM_START_DataStructType)
+#define TSKM_EV_EXTBOOTINFO_SIZE sizeof(T_SS_SM_START_ExtDataStructType)
+
+typedef struct {
+ TSKM_SVCID_t svcId;
+ TSKM_LOCAL_STEP_t localStep;
+ char bootInfo[TSKM_EV_BOOTINFO_SIZE];
+ char extBootInfo[TSKM_EV_EXTBOOTINFO_SIZE];
+ TSKM_BOOL_t isDynamic; // Nonresident task?
+} TSKM_EV_PRI_REQ_WAKEUP_PRM_t;
+
+typedef struct {
+ TSKM_LOCAL_STEP_t localStep;
+} TSKM_EV_PRI_REQ_DOWN_PRM_t;
+
+// PRI->TSKM
+typedef struct {
+ uint64_t compId;
+} TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t;
+
+typedef struct {
+ uint64_t compId;
+} TSKM_EV_PRI_REP_DOWN_COMP_PRM_t;
+
+typedef struct {
+ int connFd;
+} TSKM_EV_PRI_REP_CONNECT_PRM_t;
+
+typedef struct {
+ TSKM_BOOL_t isLast;
+ TSKM_BOOL_t isShmDone;
+ TSKM_BOOL_t isStepDone;
+} TSKM_EV_PRI_RES_WAKEUP_PRM_t;
+
+typedef struct {
+ TSKM_BOOL_t isLast;
+} TSKM_EV_PRI_RES_DOWN_PRM_t;
+
+#define TSKM_EV_DEBUGDUMP_SIZE 4096
+
+typedef struct {
+ char dumpMsg[TSKM_EV_DEBUGDUMP_SIZE];
+} TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t;
+
+// APL->TSKM
+
+// Internal message
+typedef struct {
+ TSKM_SVCID_t svcId;
+} TSKM_EV_LCL_CHG_SVC_STATE_PRM_t;
+
+// The structure must be on a stack
+typedef struct _TSKM_EVENT_INFO_t {
+ TSKM_EVENT_t event;
+ TSKM_ERR_t errCode;
+ pid_t fromPid;
+ TSKM_BOOL_t hasExtend;
+ uint32_t extendSize;
+ void *extendPrm;
+ union {
+ // TSKM->PRI
+ TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+
+ // PRI->TSKM
+ TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+
+ // Internal message
+ TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ } prm;
+ _TSKM_EVENT_INFO_t() {
+ event = TSKM_EV_NOP;
+ errCode = TSKM_E_OK;
+ fromPid = 0;
+ hasExtend = TSKM_FALSE;
+ extendSize = 0;
+ extendPrm = NULL;
+ }
+ ~_TSKM_EVENT_INFO_t() {
+ if (hasExtend && !extendPrm) {
+ free(extendPrm);
+ }
+ }
+} TSKM_EVENT_INFO_t;
+
+typedef enum {
+ TSKM_DATAINIT_REQ = 800,
+ TSKM_DATAINIT_RESP,
+ TSKM_TRANS_STEP_REQ
+} TSKM_PROTCOL_t;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_LOCAL_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/system_service/tskm_svc.h b/systemservice/task_manager/server/include/system_service/tskm_svc.h
new file mode 100644
index 00000000..8b255818
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/tskm_svc.h
@@ -0,0 +1,904 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_svc.h
+ * @brief \~english define of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+
+
+#include <unistd.h>
+#include <sys/types.h>
+#include "system_service/tskm_local_type.h"
+
+
+#define TSKM_SVC_WAIT_REQ_MAX (8) // Number of queued requests
+
+// Service type
+typedef enum {
+ TSKM_SVC_TYPE_NATIVE, //
+ TSKM_SVC_TYPE_UNKNONW, //
+} TSKM_SVC_TYPE_t;
+
+// Scheduling policy
+typedef enum {
+ TSKM_SVC_POLICY_TSS, //
+ TSKM_SVC_POLICY_RR, //
+ TSKM_SVC_POLICY_FIFO, //
+} TSKM_SVC_POLICY_t;
+
+// Life cycle
+typedef enum {
+ TSKM_SVC_LC_ALWAYS, // Resident
+ TSKM_SVC_LC_ALWAYS_RECOVERABLE, // Resident(Recoverable)
+ TSKM_SVC_LC_DYNAMIC // Non-resident
+} TSKM_SVC_LC_t;
+
+// CPU allocation: This defined value should match the specification of the second argument of CL_ProcessCreateAttrSetCpuAssign
+
+typedef enum {
+ TSKM_SVC_ASSIGN_CPU_AUTO = 0, // Automatic allocation
+ TSKM_SVC_ASSIGN_CPU_0 = 1, // Fixed to CPU0
+ TSKM_SVC_ASSIGN_CPU_1 = 2, // Fixed to CPU1
+} TSKM_SVC_ASSIGN_CPU_t;
+
+// Service attributes (given by XML)
+typedef struct {
+ TSKM_SVCID_t svcId; //
+ const char* name; //
+ const char* path; //
+ char** args; //
+ TSKM_SVC_TYPE_t type; //
+ uint32_t prio; //
+ TSKM_SVC_POLICY_t policy; //
+ TSKM_SVC_LC_t lifeCycle; //
+ uint32_t retryCnt; //
+ TSKM_SVC_ASSIGN_CPU_t cpuAssign; //
+ const char* user; //
+ uint32_t runtimeLimit; //
+ uint32_t cpuLimit; //
+ uint32_t memLimit; //
+ TSKM_BOOL_t shotdownWait; //
+ uint32_t subgidNum; //
+ gid_t *subgidList; //
+} TSKM_SVC_ATTR_t;
+
+// Service status
+typedef enum {
+ TSKM_SVC_DORMANT, // During dormant (Not exec)
+ TSKM_SVC_WAITCONNECT, // Wait for connection
+ TSKM_SVC_WAKEUP, // Start in progress
+ TSKM_SVC_RUNNING, // Running (Startup completed)
+ TSKM_SVC_DOWN, // Termination in progress
+ TSKM_SVC_FINDOWN, // Termination completed
+ TSKM_SVC_DISABLE, // Prohibitting startup (exec prohibited)
+} TSKM_SVC_STATE_t;
+
+// Service
+typedef struct { // Life cycle
+ TSKM_SVC_ATTR_t *attr; // Service Attributes ALL
+ TSKM_SVC_STATE_t state; // Service State ALL
+ int iFd; // inotifyFd for touch ALL
+ pid_t pid; // PID of service REQ_WAKEUP - FIN_DOWN
+ int connFd; // service communication socket DO_WAKEUP - FIN_DOWN
+ T_SS_SM_START_DataStructType bootInfo; // Boot info REQ_WAKEUP - FIN_DOWN
+ T_SS_SM_START_ExtDataStructType extBootInfo; // Extended boot info REQ_WAKEUP - FIN_DOWN
+
+ TSKM_BOOL_t isShmDone; // Shared memory initialization completed
+ TSKM_BOOL_t isStepDone; // Gradual startup completed
+ TSKM_BOOL_t isAvailable; // Availability reception completed
+
+ uint32_t watchCnt; // Service monitoring counter
+ uint32_t waitResCnt; // Wait for response to request DO_WAKEUP - WAIT_WAKEUP
+ uint32_t waitReqCnt; // Wait for request issuance REQ_WAKEUP - DO_WAKEUP
+ TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX]; // REQ_WAKEUP - DO_WAKEUP
+
+ uint32_t errTermCnt; // Number of abnormal terminations ALL
+} TSKM_SVC_CTX_t;
+
+// Service list
+typedef struct {
+ uint32_t svcNum;
+ TSKM_SVC_CTX_t *svcList;
+} TSKM_SVCS_CTX_t;
+
+// State of waiting for service termination
+typedef enum {
+ TSKM_SVC_WAIT_NONE, // No wait
+ TSKM_SVC_WAIT_TRANSIENT, // Waiting for termination of nonresident service
+ TSKM_SVC_WAIT_BOTH, // Waiting for termination of resident/nonresident service
+} TSKM_SVC_WAIT_STATE_t;
+
+// Service list
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsEventHandle
+ /// \~english @par Summary
+ ///
+ /// \~english @param
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_inEv
+ /// p_inEv - pointer of input event info
+ /// \~english @par
+ /// p_inEv TSKM_EVENT_INFO_t*
+ /// \~english @code
+ /// typedef struct _TSKM_EVENT_INFO_t {
+ /// TSKM_EVENT_t event;
+ /// TSKM_ERR_t errCode;
+ /// pid_t fromPid;
+ /// TSKM_BOOL_t hasExtend;
+ /// uint32_t extendSize;
+ /// void *extendPrm;
+ /// union {
+ /// // TSKM->PRI
+ /// TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ /// TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+ /// // PRI->TSKM
+ /// TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ /// TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ /// TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ /// TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ /// TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+ /// TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ /// } prm;
+ /// } TSKM_EVENT_INFO_t;
+ /// @endcode
+ /// \~english @param [out] p_outEv
+ /// p_outEv - pointer of output event info
+ /// \~english @par
+ /// p_outEv TSKM_EVENT_INFO_t*
+ /// \~english @retval
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// -
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ ///
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsEventHandle(TSKM_SVCS_CTX_t* p_svcs,
+ const TSKM_EVENT_INFO_t* p_inEv,
+ TSKM_EVENT_INFO_t* p_outEv);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcBySvcId
+ /// \~english @par Summary
+ /// find service in inputed service list by service id.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services object
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] svcId
+ /// svcId - service Id
+ /// \~english @par
+ /// svcId uint32_t
+ /// \~english @retval TSKM_SVC_CTX_t* service pointer
+ /// \~english @retval TSKM_SVC_CTX_t* NULL
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If not find svcId in services list. [NULL]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// find service in inputed service list by service id.. If do not find then return NULL pointer.
+ /// \~english @see getSvcCtxBySvcId
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_CTX_t* tskm_svcsGetSvcBySvcId(TSKM_SVCS_CTX_t* p_svcs,
+ TSKM_SVCID_t svcId);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcByPid
+ /// \~english @par Summary
+ /// find service in inputed service list by process id.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] pid
+ /// pid - process id
+ /// \~english @par
+ /// pid pid_t
+ /// \~english @retval TSKM_SVC_CTX_t* service pointer
+ /// \~english @retval TSKM_SVC_CTX_t* NULL
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If not find process id in services list. [NULL]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// find service in inputed service list by process id. If do not find then return NULL pointer.
+ /// \~english @see getSvcCtxByPid
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_CTX_t* tskm_svcsGetSvcByPid(TSKM_SVCS_CTX_t* p_svcs, pid_t pid);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsIsWaiting
+ /// \~english @par Summary
+ /// Is the service state waiting.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_BOOL_t
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If service state is TSKM_SVC_WAITCONNECT and wait response num is 0. [TSKM_FALSE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Is the service state waiting. \n
+ /// There are not service's state equal TSKM_SVC_WAITCONNECT or wait respose number > 0 return TSKM_TRUE.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_BOOL_t tskm_svcsIsWaiting(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsGetSvcTermWaitState
+ /// \~english @par Summary
+ /// Get the service which state equanl not equal terminal.
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_SVC_WAIT_STATE_t
+ /// \~english @par
+ /// TSKM_SVC_WAIT_STATE_t enum
+ /// \~english @code
+ /// typedef enum {
+ /// TSKM_SVC_WAIT_NONE, // not waiting state
+ /// TSKM_SVC_WAIT_TRANSIENT, // dynamic service terminal waiting state
+ /// TSKM_SVC_WAIT_BOTH, // no dynamic/ dyanmic service terminal waiting state
+ /// } TSKM_SVC_WAIT_STATE_t;
+ /// @endcode
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// If all services state equal TSKM_SVC_DORMANT. [TSKM_SVC_WAIT_NONE]
+ /// If dynamic service. [TSKM_SVC_WAIT_TRANSIENT]
+ /// If not dynamic service and state not TSKM_SVC_FINDOWN. [TSKM_SVC_WAIT_BOTH]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Get the service which state equanl not equal terminal. \n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_SVC_WAIT_STATE_t tskm_svcsGetSvcTermWaitState(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsSetBootInfo
+ /// \~english @par Summary
+ /// initialize all services boot info.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_info
+ /// p_info - SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message pointer
+ /// \~english @par
+ /// p_info T_SS_SM_START_DataStructType*
+ /// \~english @code
+ /// Data passed as part of SS_SM_START 'FrameworkunifiedOnStart'/'evStart' message
+ /// typedef struct T_SS_SM_START_DataStruct {
+ /// EPWR_WAKEUP_FACTOR_TYPE startupReason;
+ /// BOOL isUserModeOn;
+ /// ESMDataResetModeInfo dataResetMode;
+ /// EPWR_SC_SECURITY_STATUS securityStatus;
+ /// EPWR_SC_WAKEUP_TYPE wakeupType;
+ /// ESMDramBackupStatus dramBackupStatus;
+ /// ESMResetStatus resetStatus;
+ /// UI_32 errResetCount;
+ /// T_SS_SM_START_DataStruct
+ /// } T_SS_SM_START_DataStructType;
+ /// @endcode
+ /// \~english @param [in] p_exInfo
+ /// p_exInfo - FrameworkunifiedOnStart extend info pointer
+ /// \~english @par
+ /// p_exInfo T_SS_SM_START_ExtDataStructType*
+ /// \~english @code
+ /// /// Extended Parameter for FrameworkunifiedOnStart
+ /// typedef struct {
+ /// BOOL isProgUpdated;
+ /// EMRelaunchStatus relaunchStatus;
+ /// BOOL isMapUpdated;
+ /// BOOL isMapDiffUpdated;
+ /// uint8_t reserved[SS_SM_START_EXT_RSV_SIZE];
+ /// } T_SS_SM_START_ExtDataStructType;
+ /// @endcode
+ /// \~english @retval TSKM_E_OK
+ /// \~english @par
+ /// TSKM_SVC_WAIT_STATE_t enum
+ /// \~english @par Preconditions
+ /// - call tskm_dataInitAll() to get boot info
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - pulbic
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// - initialize all services boot info.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsSetBootInfo(TSKM_SVCS_CTX_t* p_svcs,
+ T_SS_SM_START_DataStructType* p_info,
+ T_SS_SM_START_ExtDataStructType *p_exInfo);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsAvtiveSvcTerm
+ /// \~english @par Summary
+ /// Terminal the dynamic services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_svcDownRequest return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - pulbic
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Terminal all the dynamic services which state equal TSKM_SVC_RUNNING and response num equal 0. \n
+ /// \~english @see tskm_svcDownRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsAvtiveSvcTerm(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsCallDebugDump
+ /// \~english @par Summary
+ /// Send DebugDump message to services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_sockSend send DebugDump message failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Send DebugDump message to services which state equal TSKM_SVC_RUNNING. \n
+ /// \~english @see tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsCallDebugDump(TSKM_SVCS_CTX_t* p_svcs);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcsCallLowMem
+ /// \~english @par Summary
+ /// Send checking low memory message to services.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - tskm_sockSend send LowMemory message failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method only
+ /// \~english @par Detail
+ /// Send checking LowMemory message to services which state equal TSKM_SVC_RUNNING. \n
+ /// \~english @see tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcsCallLowMem(TSKM_SVCS_CTX_t* p_svcs);
+
+// Service
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcEventHandle
+ /// \~english @par Summary
+ /// process event.
+ /// \~english @param [in] p_svcs
+ /// p_svcs - pointer of services
+ /// \~english @par
+ /// p_svcs TSKM_SVCS_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// uint32_t svcNum; // service num
+ /// TSKM_SVC_CTX_t *svcList; // services list pointer
+ /// } TSKM_SVCS_CTX_t;
+ /// @endcode
+ /// \~english @param [in][out] p_ev
+ /// p_ev - event info pointer
+ /// \~english @par
+ /// p_ev TSKM_EVENT_INFO_t*
+ /// \~english @code
+ /// typedef struct _TSKM_EVENT_INFO_t {
+ /// TSKM_EVENT_t event;
+ /// TSKM_ERR_t errCode;
+ /// pid_t fromPid;
+ /// TSKM_BOOL_t hasExtend;
+ /// uint32_t extendSize;
+ /// void *extendPrm;
+ /// union {
+ /// // TSKM->PRI
+ /// TSKM_EV_PRI_REQ_WAKEUP_PRM_t reqWakeup;
+ /// TSKM_EV_PRI_REQ_DOWN_PRM_t reqDown;
+ ///
+ /// // PRI->TSKM
+ /// TSKM_EV_PRI_REP_WAKEUP_COMP_PRM_t repWakeupComp;
+ /// TSKM_EV_PRI_REP_DOWN_COMP_PRM_t repDownComp;
+ /// TSKM_EV_PRI_REP_CONNECT_PRM_t repConnect;
+ /// TSKM_EV_PRI_RES_WAKEUP_PRM_t resWakeup;
+ /// TSKM_EV_PRI_RES_DOWN_PRM_t resDown;
+ /// TSKM_EV_LCL_CHG_SVC_STATE_PRM_t chgSvc;
+ /// } prm;
+ /// } TSKM_EVENT_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// process event.\n
+ /// process connect response.\n
+ /// process disconnect response. \n
+ /// process service wakeup request. \n
+ /// process service down request. \n
+ /// process service debugdump request. \n
+ /// process service exit request. \n
+ /// process service terminal response. \n
+ /// \~english @see isSvcEvent,connectHandle,disConnectHandle,resWakeupHandle, \n
+ /// resDownHandle,resDebugDumpHandle,reqExit,repTermHandle \n
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcEventHandle(TSKM_SVC_CTX_t* p_svc, TSKM_EVENT_INFO_t* p_ev); // p_ev: [IN/OUT]
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcExec
+ /// \~english @par Summary
+ /// start service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of services
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - input parameter p_svc is NULL. [TSKM_E_NG]
+ /// - service state is TSKM_SVC_DISABLE [TSKM_E_STATE]
+ /// - reqTouch return failed [TSKM_E_NG]
+ /// - tskm_pf_createProc return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// start service which state is TSKM_SVC_DORMANT.\n
+ /// \~english @see svcExec, reqTouch, tskm_pf_createProc
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcExec(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcWakeupRequest
+ /// \~english @par Summary
+ /// Send started request to service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_req
+ /// p_req - pointer of request
+ /// \~english @par
+ /// p_req TSKM_GSTEP_REQ_INFO_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVCID_t svcId; // service ID
+ /// TSKM_LOCAL_STEP_t localStep; // local step id
+ /// } TSKM_GSTEP_REQ_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// - none
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Input parameter p_svc is NULL. [TSKM_E_STATE]
+ /// - Service state is TSKM_SVC_DISABLE [TSKM_E_STATE]
+ /// - wakeupRequest return failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Send started request to service. If service do not connect, save the request.\n
+ /// Send request again when service connect. \n
+ /// \~english @see svcWakeupRequest
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcWakeupRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req);
+
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDownRequest
+ /// \~english @par Summary
+ /// Send service down request to service.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @param [in] p_req
+ /// p_req - request pointer
+ /// \~english @par
+ /// p_req TSKM_GSTEP_REQ_INFO_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVCID_t svcId; // service ID
+ /// TSKM_LOCAL_STEP_t localStep; // local step id
+ /// } TSKM_GSTEP_REQ_INFO_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_NG
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - Send service down request failed [TSKM_E_NG]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// If service state is commounicated(TSKM_SVC_WAKEUP, TSKM_SVC_RUNNING), \n
+ /// send service down request and set state as TSKM_SVC_DOWN.\n
+ /// \~english @see tskm_svcIsCommunicatable,tskm_sockSend
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcDownRequest(TSKM_SVC_CTX_t* p_svc,
+ TSKM_GSTEP_REQ_INFO_t* p_req);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDisableRequest
+ /// \~english @par Summary
+ ///
+ /// \~english @param [in][out] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// TSKM_E_STATE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If service state is not TSKM_SVC_DORMANT and TSKM_SVC_DISABLE. [TSKM_E_STATE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Set service state as TSKM_SVC_DISABLE if state is TSKM_SVC_DORMANT.
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcDisableRequest(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcDisableRequest
+ /// \~english @par Summary
+ /// Set service state as start available.
+ /// \~english @param [in][out] p_svc
+ /// p_svc - Pointer to service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_ERR_t
+ /// \~english @par
+ /// TSKM_E_OK
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - none
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Set service state as start available which state is disable(TSKM_SVC_DISABLE).
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_ERR_t tskm_svcEnableRequest(TSKM_SVC_CTX_t* p_svc);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ /// \ingroup tskm_svcIsCommunicatable
+ /// \~english @par Summary
+ /// Whether service is Communicatable.
+ /// \~english @param [in] p_svc
+ /// p_svc - pointer of service
+ /// \~english @par
+ /// p_svc TSKM_SVC_CTX_t*
+ /// \~english @code
+ /// typedef struct {
+ /// TSKM_SVC_ATTR_t *attr; // attribute of service
+ /// TSKM_SVC_STATE_t state; // state of service
+ /// int iFd; // inotifyFd used by touch
+ /// pid_t pid; // PID of service
+ /// int connFd; // service communicate fd
+ /// T_SS_SM_START_DataStructType bootInfo; // BOOT info
+ /// T_SS_SM_START_ExtDataStructType extBootInfo; // extend BOOT info
+ /// TSKM_BOOL_t isShmDone; // shared memory init done
+ /// TSKM_BOOL_t isStepDone; // step done
+ /// TSKM_BOOL_t isAvailable; // Availability flag
+ /// uint32_t watchCnt; // service monitor count
+ /// uint32_t waitResCnt; // wait response num
+ /// uint32_t waitReqCnt; // wait request num
+ /// TSKM_GSTEP_REQ_INFO_t request[TSKM_SVC_WAIT_REQ_MAX];
+ /// uint32_t errTermCnt; // exception terminal count
+ /// } TSKM_SVC_CTX_t;
+ /// @endcode
+ /// \~english @retval TSKM_BOOL_t
+ /// \~english @par
+ /// TSKM_FALSE
+ /// TSKM_TRUE
+ /// \~english @par Preconditions
+ /// -
+ /// \~english @par Change of the internal state
+ /// - The internal state is not changed.
+ /// \~english @par Causes of failures
+ /// - If input parameter p_svc is NULL. [TSKM_FALSE]
+ /// - If input parameter p_svc->attr->type is TSKM_SVC_TYPE_UNKNONW. [TSKM_FALSE]
+ /// - If service state is TSKM_SVC_DORMANT or TSKM_SVC_WAITCONNECT or
+ /// TSKM_SVC_FINDOWN orTSKM_SVC_DISABLE. [TSKM_FALSE]
+ /// \~english @par Classification
+ /// - public
+ /// \~english @par Type
+ /// - method
+ /// \~english @par Detail
+ /// Whether service is Communicatable. \n
+ /// If service state is TSKM_SVC_WAKEUP or TSKM_SVC_RUNNING or TSKM_SVC_DOWN, return TSKM_TRUE. \n
+ /// \~english @see None
+ ////////////////////////////////////////////////////////////////////////////////////
+TSKM_BOOL_t tskm_svcIsCommunicatable(TSKM_SVC_CTX_t* p_svc);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_SVC_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/system_service/tskm_type.h b/systemservice/task_manager/server/include/system_service/tskm_type.h
new file mode 100644
index 00000000..7d1f818e
--- /dev/null
+++ b/systemservice/task_manager/server/include/system_service/tskm_type.h
@@ -0,0 +1,123 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * @file tskm_type.h
+ * @brief \~english type of tskm
+ */
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup task_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+
+
+
+#include <stdint.h>
+#include <native_service/frameworkunified_types.h>
+#include <system_service/ss_services.h>
+#include "system_service/tskm_svcid.h"
+
+
+#define TSKM_ERR_t int32_t
+#define TSKM_E_OK 0
+#define TSKM_E_PAR 1
+#define TSKM_E_STATE 2
+#define TSKM_E_PERMIT 3
+#define TSKM_E_ALREADY 4
+#define TSKM_E_RETRY 5
+#define TSKM_E_NG 6
+
+#define TSKM_BOOL_t int32_t
+#define TSKM_TRUE 1
+#define TSKM_FALSE 0
+
+#define TSKM_RSV_t int
+
+typedef uint32_t TSKM_SVCID_t;
+// Values are defined in tskm_svcid.h
+
+typedef enum {
+ TSKM_SVC_CMD_NOP, // Do nothing
+ TSKM_SVC_CMD_EXEC, // Startup service
+ TSKM_SVC_CMD_ENABLE, // Allow service startup
+ TSKM_SVC_CMD_DISABLE, // Prohibit service startup
+ TSKM_SVC_CMD_RESERVE, // Reserve service startup
+} TSKM_SVC_CMD_t;
+
+typedef struct {
+ TSKM_SVC_CMD_t cmd;
+} TSKM_SVC_CTL_t;
+
+typedef struct {
+ TSKM_SVCID_t svcId;
+ TSKM_BOOL_t isExecDisable;
+} TSKM_SVC_INFO_t;
+
+typedef enum {
+ TSKM_BOOT_NORMAL, // Normal start
+ TSKM_BOOT_FACTRESET, // start with factory default start
+ TSKM_BOOT_USERRESET, // start with resetting user info
+ TSKM_BOOT_VERSIONUP, // start with version up
+} TSKM_BOOT_t;
+
+typedef enum {
+ TSKM_LOGGING_TYPE_MODULE_LOGS, // logging request from the service
+ TSKM_LOGGING_TYPE_GRP_RELAUNCH, // logging by Group Relaunch
+} TSKM_LOGGING_TYPE_NORMAL_t;
+
+typedef enum {
+ TSKM_ERROR_REBOOT_NORMAL, // Anomaly detection
+} TSKM_ERROR_REBOOT_TYPE_t;
+
+#define TSKM_LOGGING_MSG_STR_SIZE 64
+
+typedef struct {
+ TSKM_LOGGING_TYPE_NORMAL_t type; // Log type
+ char messageStr[TSKM_LOGGING_MSG_STR_SIZE]; // Error message
+} TSKM_LOGGING_INFO_t;
+
+typedef struct {
+ TSKM_ERROR_REBOOT_TYPE_t type; // Reboot type
+ TSKM_LOGGING_INFO_t log; // Log info
+} TSKM_ERROR_REBOOT_t;
+
+typedef enum {
+ TSKM_DATAINIT_TYPE_USER, // Reset user info
+} TSKM_DATAINIT_TYPE_t;
+
+typedef struct {
+ TSKM_DATAINIT_TYPE_t type;
+ EFrameworkunifiedStatus (*onCompInit)(HANDLE hApp);
+} TSKM_DATAINIT_t;
+
+#define TSKM_ORDER_NAME_MAX 32
+
+typedef struct {
+ char orderName[TSKM_ORDER_NAME_MAX];
+} TSKM_WAKEUP_ORDER_t;
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_TSKM_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/task_manager/server/include/tskm_comm.h b/systemservice/task_manager/server/include/tskm_comm.h
new file mode 100644
index 00000000..c884be96
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_comm.h
@@ -0,0 +1,59 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Communication module header file
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+
+#include <sys/types.h>
+#include "system_service/tskm_local_type.h"
+
+#define TSKM_SOCKET_NAME "/tmp/tskm_sock" // Sockets for Primary Library
+
+#define TSKM_COMM_CONNECT_MAX (32)
+
+typedef struct {
+ pid_t pid;
+ int connFd;
+} TSKM_SRV_CONNENT_t;
+
+typedef struct {
+ uint32_t num;
+ TSKM_SRV_CONNENT_t conn[TSKM_COMM_CONNECT_MAX];
+} TSKM_SRV_CONNENT_LIST_t;
+
+typedef struct {
+ int sockFd;
+ const char *sockName;
+ TSKM_SRV_CONNENT_LIST_t connList;
+} TSKM_SRV_SOCK_CTX_t;
+
+TSKM_ERR_t tskm_srvSockCreate(const char* sockName,
+ TSKM_SRV_SOCK_CTX_t* p_sock);
+TSKM_SRV_CONNENT_t* tskm_srvSockConnect(TSKM_SRV_SOCK_CTX_t* p_sock);
+void tskm_srvSockDisconnect(TSKM_SRV_SOCK_CTX_t* p_sock,
+ TSKM_SRV_CONNENT_t *p_conn);
+void tskm_srvSockDestory(TSKM_SRV_SOCK_CTX_t* p_sock);
+int tskm_cliSockConnect(const char* sockName);
+int tskm_sockRcv(int fd, TSKM_EVENT_INFO_t* p_ev);
+int tskm_sockSend(int fd, TSKM_EVENT_INFO_t* p_ev);
+void tskm_sockDestory(int fd);
+
+int tskm_comm_procInit(void);
+int tskm_comm_setSvcWatchState(uint32_t id, BOOL bIsRun, uint32_t timeout);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_COMM_H_
+
diff --git a/systemservice/task_manager/server/include/tskm_debug.h b/systemservice/task_manager/server/include/tskm_debug.h
new file mode 100644
index 00000000..ae963a8f
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_debug.h
@@ -0,0 +1,208 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <native_service/ns_logger_if.h>
+#include "system_service/tskm_svc.h"
+
+#include "system_service/tskm_local_type.h"
+
+#define TSKM_STATIC static
+
+// for frameworkunifiedlog
+#define ZONE_INIT ZONEMASK(10) // Reserved for lib
+#define ZONE_FUNC ZONEMASK(11) // Reserved for lib
+#define ZONE_MEM ZONEMASK(12) // Reserved for lib
+#define ZONE_OUT ZONEMASK(13)
+#define ZONE_STATE ZONEMASK(14) // Basic state change
+#define ZONE_15 ZONEMASK(15)
+#define ZONE_16 ZONEMASK(16)
+#define ZONE_17 ZONEMASK(17)
+#define ZONE_18 ZONEMASK(18)
+#define ZONE_19 ZONEMASK(19)
+#define ZONE_20 ZONEMASK(20)
+#define ZONE_21 ZONEMASK(21)
+#define ZONE_22 ZONEMASK(22)
+#define ZONE_23 ZONEMASK(23)
+#define ZONE_24 ZONEMASK(24)
+#define ZONE_25 ZONEMASK(25)
+#define ZONE_26 ZONEMASK(26)
+#define ZONE_27 ZONEMASK(27)
+#define ZONE_28 ZONEMASK(28)
+#define ZONE_INFO ZONEMASK(29) // Reserved for lib
+#define ZONE_WARN ZONEMASK(30) // Reserved for lib
+#define ZONE_ERR ZONEMASK(31) // Reserved for lib
+
+#define ZONE_TEXT_10 "Init"
+#define ZONE_TEXT_11 "Function"
+#define ZONE_TEXT_12 "Memory"
+#define ZONE_TEXT_13 ""
+#define ZONE_TEXT_14 ""
+#define ZONE_TEXT_15 ""
+#define ZONE_TEXT_16 ""
+#define ZONE_TEXT_17 ""
+#define ZONE_TEXT_18 ""
+#define ZONE_TEXT_19 ""
+#define ZONE_TEXT_20 ""
+#define ZONE_TEXT_21 ""
+#define ZONE_TEXT_22 ""
+#define ZONE_TEXT_23 ""
+#define ZONE_TEXT_24 ""
+#define ZONE_TEXT_25 ""
+#define ZONE_TEXT_26 ""
+#define ZONE_TEXT_27 ""
+#define ZONE_TEXT_28 ""
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LPRINT|LMSGQ) // LPRINT , LMSGQ, LSLOGGER
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_OUT, ZONE_WARN, ZONE_ERR, ZONE_STATE, ZONE_PERFORMANCE, ZONE_SYSTEMDATA
+/*
+ ZONE_NS_FUNC,\
+ ZONE_NS_DIS,\
+ ZONE_NS__CWORD77_,\
+ ZONE_NS_IMP_INFO,\
+ ZONE_NS_SM_DEV_INFO,\
+ ZONE_NS_SM_USR_INFO,\
+ ZONE_NS_INFO,\
+ ZONE_NS_DEBUG_DUMP,\
+ ZONE_NS_WAR ,\
+ ZONE_NS_ERR ,\
+ ZONE_DEBUG_DUMP
+ */
+#endif
+
+#define TSKM_LOG_ERROR 0x00000001U
+#define TSKM_LOG_STATE 0x00000002U
+#define TSKM_LOG_DEBUG 0x00000004U
+#define TSKM_LOG_API 0x00000008U
+#define TSKM_LOG_PORTPF 0x00000010U
+#define TSKM_LOG_FUNC 0x00000020U
+#define TSKM_LOG_MSG 0x00000040U
+#define TSKM_LOG_WARN 0x00000080U
+#define TSKM_LOG_SVCSTATE 0x00000100U
+#define TSKM_LOG_SYSTEMDATA 0x00000200U
+
+// For debugging
+#define TSKM_LOG_CUSTUM (0 \
+ )
+/*
+ |TSKM_LOG_MSG \
+ |TSKM_LOG_DEBUG \
+ |TSKM_LOG_FUNC \
+ |TSKM_LOG_PORTPF \
+ */
+
+typedef enum {
+ TSKM_LOG_TYPE_TEXT,
+ TSKM_LOG_TYPE_PLACE,
+} TSKM_LOG_TYPE_t;
+
+#define TSKM_DEFAULT_PRINTF(flag, fmt, ...) { \
+ switch (flag) { \
+ case TSKM_LOG_SYSTEMDATA: \
+ FRAMEWORKUNIFIEDLOG(ZONE_SYSTEMDATA, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_API: \
+ case TSKM_LOG_STATE: \
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_ERROR: \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_WARN: \
+ FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_DEBUG: \
+ FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ case TSKM_LOG_MSG: \
+ case TSKM_LOG_FUNC: \
+ case TSKM_LOG_PORTPF: \
+ default: \
+ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, fmt, ##__VA_ARGS__); \
+ break; \
+ } \
+ }
+
+#define TSKM_PRINTF(flag, fmt, ...) { \
+ if (TSKM_LOG_SVCSTATE == flag) { \
+ /* Logs at startup and termination */ \
+ FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, fmt, ## __VA_ARGS__); \
+ } else if (TSKM_LOG_CUSTUM & flag) { \
+ /* Logging by STATE when CUSTUM is specified */ \
+ FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, fmt, ## __VA_ARGS__); \
+ } else { \
+ TSKM_DEFAULT_PRINTF(flag, fmt, ## __VA_ARGS__); \
+ } \
+ }
+
+#define TSKM_ASSERT(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT"); \
+ }
+
+#define TSKM_ASSERT_ERRNO(x) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT %d:%s", errno, strerror(errno)); \
+ }
+
+#define TSKM_ASSERT_PRINT(x, fmt, ...) \
+ if (!(x)) { \
+ FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "TSKM_ASSERT:" fmt, ## __VA_ARGS__); \
+ }
+
+#define TSKM_STATIC_ASSERT(expr) \
+ { \
+ char STATIC_ASSERTION_FAILED[(expr) ? 1 : -1]; \
+ (void)STATIC_ASSERTION_FAILED; \
+ }
+
+#define TSKM_DUMP(addr, size) { \
+ char* buf = (char*)addr; /* NOLINT (readability/casting) */ \
+ int ii; \
+ printf("[DUMP] %s:%d addr:%p size:%d", __FUNCTION__, __LINE__, addr, size); \
+ for (ii=0 ; ii < size ; ii++) { \
+ if (ii%16 == 0) printf(" "); \
+ if (ii%32 == 0) printf("\n"); \
+ printf("%02x", buf[ii]); \
+ } \
+ printf("\n"); \
+ }
+
+#define TSKM_FUNC_IN() TSKM_PRINTF(TSKM_LOG_FUNC, "%s:IN", __FUNCTION__)
+
+#define TSKM_FUNC_OUT() TSKM_PRINTF(TSKM_LOG_FUNC, "%s:OUT", __FUNCTION__)
+
+const char* tskm_convState2Str(TSKM_STATE_t state);
+const char* tskm_convLocalStep2Str(TSKM_LOCAL_STEP_t localStep);
+const char* tskm_convEvent2Str(TSKM_EVENT_t event);
+const char* tskm_convInitCompId2Str(uint64_t compId);
+const char* tskm_convTermCompId2Str(uint64_t compId);
+const char* tskm_convSvcState2Str(TSKM_SVC_STATE_t state);
+void tskm_svcsDump(TSKM_SVCS_CTX_t* p_svcs);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_DEBUG_H_
diff --git a/systemservice/task_manager/server/include/tskm_main.h b/systemservice/task_manager/server/include/tskm_main.h
new file mode 100644
index 00000000..24ba5f1f
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_main.h
@@ -0,0 +1,71 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
+
+#include <system_service/ss_boot_map.h>
+
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_local_type.h"
+#include "tskm_comm.h"
+#include "tskm_type_local.h"
+
+typedef struct {
+ // State
+ TSKM_BOOL_t isExec; // Executing flag
+ TSKM_STATE_t state; // TSKM state
+
+ // API
+ TSKM_BOOL_t inApi; // API running
+ TSKM_ERR_t apiRet; // API return
+ TSKM_BOOL_t isReboot; // REBOOT request
+
+ TSKM_BOOL_t isOnStartDone; // System start process completion flag
+ TSKM_BOOL_t isOnStopDone; // System stop process completion flag
+
+ // Communication
+ TSKM_SRV_SOCK_CTX_t sock; // priLib socket
+ int sigFd; // signalFd(process-termination-detection)
+ HANDLE hApp; // DispatcherHandle
+ int nsFd; // For receiving from the NSFW
+ int iFd; // inotify FDs
+ int resmFd; // EV FDs of RESM
+
+ // Non-volatile info
+ TSKM_NV_INFO_t nvInfo; // Non-volatile information
+
+ // Startup info
+ T_SS_SM_START_DataStructType bootInfo; // for Pri notification
+ T_SS_SM_START_ExtDataStructType extBootInfo; // for Pri notification
+
+ // Analysis support
+ STATEMGR__CWORD69_LOG* p__CWORD69_Log; // BUGBUG: Required or not
+
+ // Services management
+ TSKM_SVCS_CTX_t svcs;
+
+ // Gradual starting state management
+ TSKM_GSTEP_CTX_t wakeup;
+
+ // Gradual terminating state management
+ TSKM_GSTEP_CTX_t down;
+} TSKM_MAIN_CTX_t;
+
+EFrameworkunifiedStatus OnStart(const HANDLE hApp); // System start process
+TSKM_MAIN_CTX_t* tskm_getMainCtx(void);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_MAIN_H_
diff --git a/systemservice/task_manager/server/include/tskm_port_pf.h b/systemservice/task_manager/server/include/tskm_port_pf.h
new file mode 100644
index 00000000..31da5aba
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_port_pf.h
@@ -0,0 +1,46 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+
+#include <native_service/cl_process.h>
+
+#include "system_service/tskm_svc.h"
+#include "system_service/tskm_local_type.h"
+#include "tskm_main.h"
+
+int tskm_pf_sysInit();
+int tskm_pf_procInit();
+pid_t tskm_pf_createProc(TSKM_SVC_ATTR_t* p_svcAttr);
+int tskm_pf_cleanupProc(int sigFd, pid_t* p_pid, TSKM_ERR_t* p_err);
+int tskm_pf_terminateProcGroup(uint16_t pid);
+int tskm_pf_shmCreate(const char* name, int32_t size, void** p_addr);
+int tskm_pf_shmDelete(const char* name);
+int tskm_pf_createThread(void* (*threadFunc)(void*), void* prm,
+ uint32_t priority, const char* threadName,
+ pthread_t* p_thId);
+int tskm_pf_sendStopCompResp();
+int tskm_pf_abort();
+int tskm_pf_exit(int status);
+int tskm_pf_touch(char* path);
+int tskm_pf_mkTouchFileName(pid_t pid, char name[32]);
+int tskm_pf_nvFileInit(HANDLE hApp);
+int tskm_pf_nvFileRead(HANDLE hApp, TSKM_NV_INFO_t* p_nvInfo);
+int tskm_pf_nvFileWrite(const TSKM_NV_INFO_t* p_nvInfo);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_PF_H_
+
diff --git a/systemservice/task_manager/server/include/tskm_port_subsys.h b/systemservice/task_manager/server/include/tskm_port_subsys.h
new file mode 100644
index 00000000..3dc3565a
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_port_subsys.h
@@ -0,0 +1,42 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+
+#include "system_service/tskm_local_type.h"
+#include "tskm_main.h"
+
+typedef struct {
+ pid_t pid;
+ uint8_t type; // CL_MonitorType_t
+} TSKM_HUNG_INFO_t;
+
+int tskm_sub_init(void);
+int tskm_sub_term(void);
+void tskm_sub_reboot(const TSKM_ERROR_REBOOT_t* p_info);
+void tskm_sub_reboot_normal(void);
+void tskm_sub_logging(const TSKM_LOGGING_INFO_t* p_info);
+void tskm_sub_debugDumpRes(BOOL bIsNeedSvcName, const char *p_dumpMsg);
+int tskm_sub_getExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info);
+
+TSKM_HUNG_INFO_t *tskm_sub_searchHungSvcs();
+int tskm_sub_resmInit();
+int tskm_sub_resmRcv(TSKM_EVENT_INFO_t* p_ev);
+int tskm_sub_setWakeupOrder(const char* p_order);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_PORT_SUBSYS_H_
+
diff --git a/systemservice/task_manager/server/include/tskm_shutdown.h b/systemservice/task_manager/server/include/tskm_shutdown.h
new file mode 100644
index 00000000..bb76d3c5
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_shutdown.h
@@ -0,0 +1,27 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+
+#include "tskm_main.h"
+
+TSKM_ERR_t tskm_entryDown(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitDown(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleDown(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_SHUTDOWN_H_
+
diff --git a/systemservice/task_manager/server/include/tskm_state.h b/systemservice/task_manager/server/include/tskm_state.h
new file mode 100644
index 00000000..748d25e1
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_state.h
@@ -0,0 +1,36 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
+
+#include "system_service/tskm_local_type.h"
+#include "system_service/tskm_type.h"
+#include "tskm_main.h"
+
+#define TSKM_SUB_STATE_IS(p_main, subState) \
+ (((p_main)->state & subState) == subState) // NOLINT (runtime/references)
+
+// Public functions
+TSKM_ERR_t tskm_entryState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state);
+TSKM_ERR_t tskm_exitState(TSKM_MAIN_CTX_t* p_rec, TSKM_STATE_t state);
+TSKM_ERR_t tskm_stateTransit(TSKM_MAIN_CTX_t* p_main, TSKM_STATE_t srcState,
+ TSKM_STATE_t dstState);
+void tskm_handleEvent(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+TSKM_ERR_t tskm_handleAccon(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_STATE_H_
diff --git a/systemservice/task_manager/server/include/tskm_wakeup.h b/systemservice/task_manager/server/include/tskm_wakeup.h
new file mode 100644
index 00000000..d4a11932
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_wakeup.h
@@ -0,0 +1,26 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
+
+#include "tskm_main.h"
+
+TSKM_ERR_t tskm_entryWakeup(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_exitWakeup(TSKM_MAIN_CTX_t* p_main);
+TSKM_ERR_t tskm_handleWakeup(TSKM_MAIN_CTX_t* p_main, TSKM_EVENT_INFO_t* p_ev);
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_WAKEUP_H_
diff --git a/systemservice/task_manager/server/include/tskm_watch.h b/systemservice/task_manager/server/include/tskm_watch.h
new file mode 100644
index 00000000..d1aced57
--- /dev/null
+++ b/systemservice/task_manager/server/include/tskm_watch.h
@@ -0,0 +1,25 @@
+/*
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+#define TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+
+#include "tskm_main.h"
+
+int tskm_watch_startTimer();
+
+#endif // TASK_MANAGER_SERVER_INCLUDE_TSKM_WATCH_H_
+