summaryrefslogtreecommitdiffstats
path: root/systemservice/resource_manager/server/include
diff options
context:
space:
mode:
Diffstat (limited to 'systemservice/resource_manager/server/include')
-rw-r--r--systemservice/resource_manager/server/include/proc_watch.h25
-rw-r--r--systemservice/resource_manager/server/include/resm_cfg.h132
-rw-r--r--systemservice/resource_manager/server/include/resm_internal.h40
-rw-r--r--systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h82
-rw-r--r--systemservice/resource_manager/server/include/system_service/resm.h325
-rw-r--r--systemservice/resource_manager/server/include/system_service/resm_type.h85
-rw-r--r--systemservice/resource_manager/server/include/system_service/resource_manager.h43
7 files changed, 732 insertions, 0 deletions
diff --git a/systemservice/resource_manager/server/include/proc_watch.h b/systemservice/resource_manager/server/include/proc_watch.h
new file mode 100644
index 00000000..8a98afd0
--- /dev/null
+++ b/systemservice/resource_manager/server/include/proc_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 RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
+
+/**********************************************
+ * Prototype declaration
+ **********************************************/
+void *PRCW_main(void *p);
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_PROC_WATCH_H_
diff --git a/systemservice/resource_manager/server/include/resm_cfg.h b/systemservice/resource_manager/server/include/resm_cfg.h
new file mode 100644
index 00000000..e48cdcee
--- /dev/null
+++ b/systemservice/resource_manager/server/include/resm_cfg.h
@@ -0,0 +1,132 @@
+/*
+ * @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 name : resm_cfg.h
+******************************************************************************/
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
+
+/******************************************************************************
+Configuration
+******************************************************************************/
+/*************************************************
+ * Delay time from process start to monitoring start (sec)
+ * def:60 max:- min:0
+ * (0: stop timer)
+ *************************************************/
+#define MONITORING_START_DELAT_TIME (60)
+
+
+/*************************************************
+ * Delay time until authentication service monitoring start (sec)
+ * def:30 max:- min:0
+ * (0: stop timer)
+ * MONITORING_START_DELAT_TIME > set to this value
+ *************************************************/
+#define EUA_MONITORING_START_DELAT_TIME (30)
+
+
+/*************************************************
+ * Delay from drop_caches process startup (sec)
+ * def:20 max:- min:0
+ * (0: stop timer)
+ *************************************************/
+#define DROP_CACHES_START_DELAT_TIME (20)
+
+
+///*************************************************
+// * CPU load threshold (%)
+// * def:70 max:100 min:0
+// *************************************************/
+//#define CPU_LOAD_THRESHOLD (70)
+/*************************************************
+ * CPU load threshold(%:XX.X)
+ * threshold:875 max:1000 min:0
+ *************************************************/
+#define CPU_LOAD_THRESHOLD (875)
+
+
+/*************************************************
+ * Number of CPU overload processes to be logged (rows)
+ * def:5 max:- min:0
+ *************************************************/
+#define CPU_HIGH_LOAD_P_LOG_NUM (5)
+
+
+///*************************************************
+// * Log output frequency during CPU overload continuation (sec)
+// * def:30 max:- min:0
+// *
+// * Specify as a multiple of the polling interval(WTC_CPU_INTERVAL) for CPU load monitoring
+// *************************************************/
+//#define CPU_HIGH_LOAD_LOG_FREQ (30)
+/*************************************************
+ * Log output frequency during CPU overload continuation (sec)
+ * def:60 max:- min:0
+ *
+ * Specify as a multiple of the polling interval(WTC_CPU_INTERVAL) for CPU load monitoring
+ *************************************************/
+#define CPU_HIGH_LOAD_LOG_FREQ (60)
+
+
+/*************************************************
+ * perf Profiling/Measurement Processes
+ * def:1 max:- min:1
+ *************************************************/
+#define PERF_MAX_PROCS (1)
+
+/*************************************************
+ * perf profiling/Output rows (functions)
+ * def:5 max:- min:1
+ *************************************************/
+#define PERF_MAX_LINES (5)
+
+/*************************************************
+ * perf pofiling/perf-record running time (sec)
+ * def:1 max:- min:1
+ *************************************************/
+#define PERF_RECORD_SPAN (1)
+
+#define TOP_TIMEOUT (60)
+
+#define RESET_SEC (60)
+
+
+#define WTC_CPU_INTERVAL (6)
+
+#define TASK_STAT_THRESHOLD (70)
+#define FIFO_TIMER_LIMIT (6)
+#define TSS_TIMER_LIMIT (60)
+
+#define CPU_TASK_INIT (1)
+#define CPU_TASK_SHOW_BF (2)
+#define CPU_TASK_SHOW_AF (3)
+#define FIFO_TASK_SHOW (4)
+#define TSS_TASK_SHOW (5)
+#define CPU_FIFO_TASK_GET_ID (6)
+#define CPU_TSS_TASK_GET_ID (7)
+#define CPU_FIFO_TASK_GET_OCCUPANCY (8)
+#define CPU_TSS_TASK_GET_OCCUPANCY (9)
+
+#define STATUS_IDOL (1)
+#define STATUS_CHECK_CPU (2)
+#define STATUS_WATCH_PROCESS (3)
+
+#define TASK_STAT_RANK_NUM (5)
+
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_RESM_CFG_H_
diff --git a/systemservice/resource_manager/server/include/resm_internal.h b/systemservice/resource_manager/server/include/resm_internal.h
new file mode 100644
index 00000000..090814e4
--- /dev/null
+++ b/systemservice/resource_manager/server/include/resm_internal.h
@@ -0,0 +1,40 @@
+/*
+ * @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 RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
+
+#include <agldd/moduleid.h>
+#include <agldd/ev_common.h>
+
+#include <other_service/ev_lib.h>
+#include "system_service/resm_type.h"
+
+#define Resm_Flag_ID_Base EV_Flag_ID_Base(RESMGR_MID)
+
+/*******************************************************************************
+ * User defined
+ *******************************************************************************/
+#define MY_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+/***********************************************************
+ * Internal API definitions
+ ***********************************************************/
+RESM_ERR_t RESM_SV_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnld);
+RESM_ERR_t RESM_SV_Close(uint32_t ssnld);
+RESM_ERR_t RESM_SV_ChkSsnId(uint32_t ssnld);
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_RESM_INTERNAL_H_
diff --git a/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h b/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h
new file mode 100644
index 00000000..94c16b38
--- /dev/null
+++ b/systemservice/resource_manager/server/include/ss_resm_resourcemanagerlog.h
@@ -0,0 +1,82 @@
+/*
+ * @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 RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
+
+#include <native_service/ns_logger_if.h>
+
+#define ZONE_INIT ZONEMASK(10) // LIB common definition
+#define ZONE_FUNC ZONEMASK(11) // LIB common definition
+#define ZONE_MEM ZONEMASK(12) // LIB common definition
+#define ZONE_13 ZONEMASK(13)
+#define ZONE_14 ZONEMASK(14)
+#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_RESM_DEBUG ZONEMASK(28) // DEBUG
+#define ZONE_INFO ZONEMASK(29) // LIB common definition
+#define ZONE_WARN ZONEMASK(30) // LIB common definition
+#define ZONE_ERR ZONEMASK(31) // LIB common definition
+
+#define ZONE_SOC_TEMP ZONEMASK(104)
+
+#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 "ResmDebug"
+#define ZONE_TEXT_29 "Info"
+#define ZONE_TEXT_30 "Warning"
+#define ZONE_TEXT_31 "Error"
+
+#define ALL_ZONES_BUT_IPC_INFO 0xEFFFFFFF
+
+#ifndef FRAMEWORKUNIFIEDLOGOPTIONS
+#define FRAMEWORKUNIFIEDLOGOPTIONS (LSHAREDMEM) // LPRINT,LSHAREDMEM
+#endif
+
+#ifndef FRAMEWORKUNIFIEDLOGAPPZONES
+
+#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN, ZONE_ERR, ZONE_INFO
+// #define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_WARN,ZONE_ERR,ZONE_INFO,ZONE_RESM_DEBUG //DEBUG
+#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SS_RESM_RESOURCEMANAGERLOG_H_
diff --git a/systemservice/resource_manager/server/include/system_service/resm.h b/systemservice/resource_manager/server/include/system_service/resm.h
new file mode 100644
index 00000000..d3b8850c
--- /dev/null
+++ b/systemservice/resource_manager/server/include/system_service/resm.h
@@ -0,0 +1,325 @@
+/*
+ * @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 resm.h
+ * @brief \~english This file contains declaration of APIs for resm library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+
+#include "system_service/resm_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_Open
+/// \~english @par Summary
+/// Opens the session with resource manager.
+/// \~english @param [in] p_prim
+/// RESM_RSV_t* - Unused, NULL
+/// \~english @param [out] p_ssnId
+/// uint32_t* - Pointer to session ID
+/// \~english @par
+/// RESM_RSV_t Variables
+/// \~english @code
+/// #define RESM_RSV_t int32_t
+/// #define RESM_RSV_NULL (0x00) // NULL
+/// @endcode
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - Availability of ResourceManager must be TRUE.
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_ssnId is NULL. [RESM_E_PAR]
+/// - The global variable for getting RPC_ID of program (rpcId) is NULL. [RESM_E_NG]
+/// - The area for RPC ID(rpcId) is not gotten. [RESM_E_NG]
+/// - The number of the thread able to register in a process exceeds limit. [RESM_E_NG]
+/// - It failed to get the area for thread information. [RESM_E_NG]
+/// - It failed to get the area for ID information storage. [RESM_E_NG]
+/// - It failed to generate the datagram socket for API request receiving. [RESM_E_NG]
+/// - It failed to bind a socket. [RESM_E_NG]
+/// - It failed to get a socket name. [RESM_E_NG]
+/// - The number of sessions exceeds the maximum value. [RESM_E_NG]
+/// - There is no space in the thread information area for event registration. [RESM_E_NG]
+/// - It failed to get the thread information area for event registration. [RESM_E_NG]
+/// - The file descriptor for getting an event is created. [RESM_E_NG]
+/// - The generated session ID exists (EEXIST error at ioctl). [RESM_E_NG]
+/// - Any error occurred during registering an event flag (EEXIST error at ioctl). [RESM_E_NG]
+/// - Any error occurred during processing poling setting (error at ioctl). [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Opens a session. \n
+/// An application can use another API by using the gotten ssnID.
+/// \~english @see RESM_Close
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_Open(const RESM_RSV_t* p_prim, uint32_t* p_ssnld);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_Close
+/// \~english @par Summary
+/// Closes the session with resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Closes a session.
+/// \~english @see RESM_Open
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_Close(uint32_t ssnld);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_ReqEvent
+/// \~english @par Summary
+/// Requests to issue an event.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [in] p_reqEvent
+/// RESM_REQ_EVENT_t* - Pointer to event
+/// \~english @par
+/// RESM_REQ_EVENT_t Structure
+/// \~english @code
+/// typedef struct {
+/// RESM_EV_t reqEvent; /* Event flag necessary to report */
+/// struct {
+/// uint32_t restMemThresh; /* Threshold of the remaining capacity of system memory */
+/// } prm;
+/// }RESM_REQ_EVENT_t;
+/// @endcode
+/// \~english @par
+/// RESM_EV_t Variables
+/// \~english @code
+/// #define RESM_EV_t uint32_t
+/// #define RESM_EV_NOP (0x00)
+/// #define RESM_EV_MEM (0x01)
+/// #define RESM_EV_NAND_STATUS (0x02)
+/// @endcode
+/// \~english @par
+/// - RESM_EV_NOP : No event notification
+/// - RESM_EV_MEM : Event notification for memory
+/// - RESM_EV_NAND_STATUS : Eventnotification for NAND state
+/// \~english @par
+/// Notes
+/// - restMemThresh is valid only when RESM_EV_MEM is set to reqEvent. \n
+/// ResourceManager issues RESM_EV_MEM event at the timing
+/// when the remaining capacity of system memory fell below the value (unit is BYTE)
+/// which an application specifies.
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_reqEvent is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Requests to issue an event.
+/// This API is called from the RPC library.
+/// \~english @see RESM_GetEvent
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_ReqEvent(uint32_t ssnld, const RESM_REQ_EVENT_t* p_reqEvent);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetEventFd
+/// \~english @par Summary
+/// Gets FD of the event to receive from resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_fd
+/// int* - Pointer to file descriptor
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_fd is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - ssnId rewrites bit for an event flag decision by invalid values. [RESM_E_NG]
+/// - The file descriptor corresponding to ssnId is not found. [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Gets FD of the event to receive from resource manager. \n
+/// An application can do simultaneous wait of other events with the event of ResourceManager
+/// by oversighting the gotten FD by select,poll etc.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetEventFd(uint32_t ssnld, int* p_fd);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetEvent
+/// \~english @par Summary
+/// Gets the event from resource manager.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_evFlag
+/// RESM_EV_t* - Pointer to event
+/// \~english @par
+/// RESM_EV_t Variables
+/// \~english @code
+/// #define RESM_EV_t uint32_t
+/// #define RESM_EV_NOP (0x00)
+/// #define RESM_EV_MEM (0x01)
+/// #define RESM_EV_NAND_STATUS (0x02)
+/// @endcode
+/// \~english @par
+/// - RESM_EV_NOP : No event notification
+/// - RESM_EV_MEM : Event notification for memory
+/// - RESM_EV_NAND_STATUS : Event notification for NAND state
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_evFlag is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - ssnId rewrites bit for an event flag decision by invalid values. [RESM_E_NG]
+/// - The file descriptor corresponding to ssnId is not found. [RESM_E_NG]
+/// - The flag of ssnId is not registered. (The returned value of ioctl is EOENT.) [RESM_E_NG]
+/// - Any interruption occurred during getting an event. (The returned value of ioctl is EINTR.) [RESM_E_NG]
+/// - Any error occurred during getting an event. (The returned value of ioctl is the error value
+/// except for EOENT and EINTR.) [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// When an event flag is not set, this is blocked. \n
+/// If an event flag is set, this stores event contents to p_evFlag and this ends. \n
+/// If this ends, it clears all of event flags.
+/// \~english @see RESM_ReqEvent
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetEvent(uint32_t ssnld, RESM_EV_t* p_evFlag);
+
+/////////////////////////////////////////////////////////////////////////////////////
+/// \ingroup RESM_GetStatus
+/// \~english @par Summary
+/// Gets system state.
+/// \~english @param [in] ssnld
+/// uint32_t - Session ID
+/// \~english @param [out] p_status
+/// RESM_STATUS_t* - Pointer to system state
+/// \~english @par
+/// RESM_STATUS_t Structure
+/// \~english @code
+/// typedef struct {
+/// uint32_t restMemSize; /* Remaining memory length (KB) */
+/// RESM_NAND_WRITE_STATUS_t nandWriteStatus; /* Access permission / Prohibition state to NAND flash */
+/// RESM_INET_STATUS_t inetStatus; /* Network IF statistical information after start */
+/// } RESM_STATUS_t;
+/// @endcode
+/// \~english @par
+/// enum RESM_NAND_WRITE_STATUS_t Variables
+/// - RESM_NAND_WRITE_ENABLE : NAND access permission
+/// - RESM_NAND_WRITE_DISABLE : NAND access prohibition
+/// \~english @par
+/// Notes
+/// - When system records in NAND flash and it influences the lifetime of a device,
+/// STATUS(nandWriteStatus) becomes RESM_NAND_WRITE_DISABLE. It is not in the state where WRITE fails. \n
+/// \~english @par
+/// RESM_INET_STATUS_t Structure
+/// \~english @code
+/// typedef struct {
+/// uint32_t ifNum; /* Valid array at the number of interface and ifInfo */
+/// struct {
+/// char name[64]; /* Interface name */
+/// uint64_t rxSize; /* Receiving data length (KiB) */
+/// uint64_t txSize; /* Transmission data length (KiB) */
+/// uint8_t hwaddr[HWADDR_LEN]; /* Hardware address (MAC address) */
+/// } ifInfo[RESM_INET_IF_MAX];
+/// }RESM_INET_STATUS_t;
+/// @endcode
+/// \~english @retval RESM_E_OK Succeeded
+/// \~english @retval RESM_E_PAR %Parameter error
+/// \~english @retval RESM_E_NG Unexpected error
+/// \~english @par Preconditions
+/// - An application must finish getting a session ID by RESM_Open().
+/// \~english @par Change of the internal state
+/// - The internal state is not changed.
+/// \~english @par Causes of failures
+/// - p_evFlag is NULL. [RESM_E_PAR]
+/// - ssnId exceeds the maximum value (EV_MAX_IDS_IN_THREAD). [RESM_E_PAR]
+/// - The in-use flag of a global variable (g_resmgr.ssnInfo[ssnId].useFlag) is FALSE. [RESM_E_PAR]
+/// - It failed to open the device file for network. [RESM_E_NG]
+/// - The number of the gotten network IF is 0. [RESM_E_NG]
+/// \~english @par Classification
+/// Public
+/// \~english @par Type
+/// None
+/// \~english @par Detail
+/// Gets system state.
+/// This API is called from the RPC library.
+/// \~english @see None
+////////////////////////////////////////////////////////////////////////////////////
+RESM_ERR_t RESM_GetStatus(uint32_t ssnld, RESM_STATUS_t* p_status);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_H_
+
+/** @}*/ // end of ResourceManager
+/** @}*/ // end of SystemService
+/** @}*/ // end of BaseSystem
diff --git a/systemservice/resource_manager/server/include/system_service/resm_type.h b/systemservice/resource_manager/server/include/system_service/resm_type.h
new file mode 100644
index 00000000..1adbf37d
--- /dev/null
+++ b/systemservice/resource_manager/server/include/system_service/resm_type.h
@@ -0,0 +1,85 @@
+/*
+ * @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 resm_type.h
+ * @brief \~english This file contains declaration of common enum and structures for resm library
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+
+#include <agl_thread.h>
+
+#define NTFY_ResourceMgr_Availability MN_SS_RESOURCEMGR"/Availability"
+
+#define RESM_ERR_t int32_t
+#define RESM_E_OK (0)
+#define RESM_E_PAR (-1)
+#define RESM_E_NG (-2)
+
+// Event flags (bit pattern)
+#define RESM_EV_t uint32_t
+#define RESM_EV_NOP (0x00)
+#define RESM_EV_MEM (0x01)
+#define RESM_EV_NAND_STATUS (0x02)
+
+#define RESM_RSV_t int32_t
+
+typedef enum {
+ RESM_NAND_WRITE_ENABLE = 0,
+ RESM_NAND_WRITE_DISABLE = -1
+} RESM_NAND_WRITE_STATUS_t;
+
+typedef struct {
+ RESM_EV_t reqEvent;
+ struct {
+ uint32_t restMemThresh;
+ } prm;
+} RESM_REQ_EVENT_t;
+
+#define RESM_INET_IF_MAX 5 /* tentative */
+#define HWADDR_LEN (6)
+typedef struct {
+ uint32_t ifNum;
+ struct {
+ char name[64];
+ uint64_t rxSize;
+ uint64_t txSize;
+ uint8_t hwaddr[HWADDR_LEN];
+ } ifInfo[RESM_INET_IF_MAX];
+} RESM_INET_STATUS_t;
+
+typedef struct {
+ uint32_t restMemSize;
+ RESM_NAND_WRITE_STATUS_t nandWriteStatus;
+ RESM_INET_STATUS_t inetStatus;
+} RESM_STATUS_t;
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESM_TYPE_H_
+/** @}*/
+/** @}*/
+/** @}*/
diff --git a/systemservice/resource_manager/server/include/system_service/resource_manager.h b/systemservice/resource_manager/server/include/system_service/resource_manager.h
new file mode 100644
index 00000000..48c7a4cf
--- /dev/null
+++ b/systemservice/resource_manager/server/include/system_service/resource_manager.h
@@ -0,0 +1,43 @@
+/*
+ * @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 resource_manager.h
+ * @brief \~english include all resm_library head files
+ */
+
+/** @addtogroup BaseSystem
+ * @{
+ */
+/** @addtogroup system_service
+ * @ingroup BaseSystem
+ * @{
+ */
+/** @addtogroup resource_manager
+ * @ingroup system_service
+ * @{
+ */
+
+#ifndef RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+#define RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+
+#include "system_service/resm.h"
+#include "system_service/resm_type.h"
+
+#endif // RESOURCE_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_RESOURCE_MANAGER_H_
+/** @}*/
+/** @}*/
+/** @}*/