diff options
author | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2020-11-20 23:36:23 +0900 |
---|---|---|
committer | Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> | 2020-11-22 09:02:55 +0900 |
commit | 17cf21bcf8a2e29d2cbcf0a313474d2a4ee44f5d (patch) | |
tree | 582a9768558d9eaf261ca5df6136e9de54c95816 /service/system/task_manager/client | |
parent | 9e86046cdb356913ae026f616e5bf17f6f238aa5 (diff) |
Re-organized sub-directory by category
Since all the sub-directories were placed in the
first level, created sub-directories, "hal", "module",
and "service" for classification and relocated each component.
Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
Change-Id: Ifdf743ac0d1893bd8e445455cf0d2c199a011d5c
Diffstat (limited to 'service/system/task_manager/client')
31 files changed, 4801 insertions, 0 deletions
diff --git a/service/system/task_manager/client/Makefile b/service/system/task_manager/client/Makefile new file mode 100755 index 0000000..7d90745 --- /dev/null +++ b/service/system/task_manager/client/Makefile @@ -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. +# + +SUBDIRS = libtskmcfg ss_data_init libtskm libprimary + +VPATH = ../server/include/$(COMPONENT_NAME) + +######### install headers(*.h) ############# +INST_HEADERS = INI_API.h INI_API.hpp Primary_common.h tskm.h tskm_type.h tskm_local_type.h +INST_HEADERS += sysup_from.h sysup.h tskm_svc.h +INST_HEADERS += task_manager.h + +include ../../system_service.mk diff --git a/service/system/task_manager/client/libprimary/Makefile b/service/system/task_manager/client/libprimary/Makefile new file mode 100755 index 0000000..f58737c --- /dev/null +++ b/service/system/task_manager/client/libprimary/Makefile @@ -0,0 +1,37 @@ +# +# @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. +# +VPATH = ./src ./../../server/src +####################################### +INST_SHLIBS = libprimary + +libprimary_SRCS = pri_main.c pri_api.c tskm_port_pf.c tskm_comm.c tskm_debug.c +LDFLAGS += -Wl,--no-as-needed +######### linked library (dynamic) ############# +LDLIBS += -lpthread +LDLIBS += -lstdc++ +LDLIBS += -lrt +LDLIBS += -lSS_SystemIfUnified +LDLIBS += -lNS_FrameworkUnified +LDLIBS += -lcommon + +######### add library path ############# + + +CPPFLAGS = -I./include/ -I./../../include-share -I./../../server/include -I./../libtskmcfg/include + +CPPFLAGS += -fno-exceptions + +include ../../../system_service.mk diff --git a/service/system/task_manager/client/libprimary/include/pri_main.h b/service/system/task_manager/client/libprimary/include/pri_main.h new file mode 100755 index 0000000..c29a337 --- /dev/null +++ b/service/system/task_manager/client/libprimary/include/pri_main.h @@ -0,0 +1,48 @@ +/* + * @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_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_ +#define TASK_MANAGER_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_ + +#include <native_service/frameworkunified_types.h> + +#include "system_service/tskm_type.h" +#include "system_service/Primary_common.h" +#include "system_service/INI_API.hpp" + +int pri_main(T_PRIM_PRM* p_prm, int argc, char* argv[]); +void pri_exitStart(void* rsv); +void pri_exitDone(int status); +void* pri_getPrivate(); +HANDLE pri_getHandle(); +int32_t pri_setMonitorTimeout(uint32_t timeout); + +int32_t pri_stepForkComp(uint64_t id); +int32_t pri_accOffComp(uint64_t id); + +int32_t pri_getBootInfo(T_SS_SM_START_DataStructType *info); +int32_t pri_getExtBootInfo(T_SS_SM_START_ExtDataStructType *info); +void pri_sendDebugDumpRes(const char *buf); + +void pri_init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum, + int fdlist[INI_FD_MAX]); +BOOL pri_handler(fd_set* p_fds); +void pri_term(void); +int pri_setMonitorState(BOOL bIsRun, uint32_t timeout); +void pri_getAppHandle(void); + +#endif // TASK_MANAGER_CLIENT_LIBPRIMARY_INCLUDE_PRI_MAIN_H_ + diff --git a/service/system/task_manager/client/libprimary/libprimary.ver b/service/system/task_manager/client/libprimary/libprimary.ver new file mode 100755 index 0000000..bebdc98 --- /dev/null +++ b/service/system/task_manager/client/libprimary/libprimary.ver @@ -0,0 +1,22 @@ +/* + * @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. + */ + +{ + global: + INI_*; + _INI_DEBUGDUMP*; + local: *; +}; diff --git a/service/system/task_manager/client/libprimary/src/pri_api.cpp b/service/system/task_manager/client/libprimary/src/pri_api.cpp new file mode 100755 index 0000000..ca1b40e --- /dev/null +++ b/service/system/task_manager/client/libprimary/src/pri_api.cpp @@ -0,0 +1,224 @@ +/* + * @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. + */ + +#include "system_service/tskm_local_type.h" +#include "system_service/INI_API.hpp" +#include "tskm_debug.h" +#include "pri_main.h" + +BOOL __thread isMain = FALSE; // Check for accessibility from the main thread context + +TSKM_STATIC BOOL isInitPrmValid(const T_PRIM_PRM* p_prm) { + if (p_prm == NULL) { + TSKM_ASSERT(0); + return FALSE; + } else if (p_prm->shmTbl == NULL) { + TSKM_ASSERT(0); + return FALSE; + } else if (p_prm->wakeupExFuncTbl == NULL) { + TSKM_ASSERT(0); + return FALSE; + } else if (p_prm->downExFuncTbl == NULL) { + TSKM_ASSERT(0); + return FALSE; + } else if (p_prm->onInit == NULL) { + TSKM_ASSERT(0); + return FALSE; + } else if (p_prm->onDestory == NULL) { + TSKM_ASSERT(0); + return FALSE; + } else if (p_prm->onDebugDump == NULL) { + TSKM_ASSERT(0); + return FALSE; + } else if (p_prm->onTouch == NULL) { + TSKM_ASSERT(0); + return FALSE; + } + + return TRUE; +} + +/****************************************************************************** + * APIs for implementing the main thread on the service side + *******************************************************************************/ +/********************************************************* + * Primary library initialization + *********************************************************/ +int32_t INI_Init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum, + int fdlist[INI_FD_MAX]) { + isMain = TRUE; + if (isInitPrmValid(p_prm) == FALSE) { + TSKM_ASSERT(0); + return INI_FALSE; + } + pri_init(p_prm, argc, argv, fdNum, fdlist); + return INI_SUCCESS; +} + +/*********************************************************** + * Primary library / Event handler + * ret:TRUE Running + * ret:FALSE Finished (Terminated a process with INI_Term()) + ************************************************************/ +BOOL INI_Handler(fd_set* p_fds) { + if (!isMain || NULL == p_fds) { + TSKM_ASSERT(0); + return FALSE; + } + + return pri_handler(p_fds); +} + +/*********************************************************** + * Primary (Processing finished) + ************************************************************/ +void INI_Term(void) { + pri_term(); +} + +/*********************************************************** + * Primary (State setting for watching Services) + ************************************************************/ +int32_t INI_SetMonitorState(T_PRIM_MONITOR_PRM *p_prm) { + if (!p_prm) { + TSKM_ASSERT(0); + goto ERROR; + } + + return pri_setMonitorState(p_prm->bIsRun, p_prm->timeout); + ERROR: return INI_FALSE; +} + +/****************************************************************************** + * Hiding the Main Thread in the Primary Library + *******************************************************************************/ +/************************************ + * Startup FW MainLoop + ************************************/ +int INI_Main(T_PRIM_PRM* p_prm, int argc, char* argv[]) { + if (isInitPrmValid(p_prm) == FALSE) { // LCOV_EXCL_BR_LINE 6: Checked by Init() + TSKM_ASSERT(0); + return INI_FALSE; + } + + isMain = TRUE; + + return pri_main(p_prm, argc, argv); +} + +/****************************************************************************** + * Common API + *******************************************************************************/ +/************************************ + * Process termination + ************************************/ +void INI_ExitStart(void * rsv) { + static int isCalled = 0; + if (isCalled) { + return; + } + isCalled = 1; + pri_exitStart(rsv); +} + +void INI_ExitDone(int status) { + static int isCalled = 0; + if (isCalled) { + return; + } + isCalled = 1; + pri_exitDone(status); +} + +/************************************ + * Private Info Acquisition + ************************************/ +void* INI_GetPrivate() { + return pri_getPrivate(); +} + +/************************************ + * Applicastion Handle Aquisition + ************************************/ +HANDLE INI_GetHandle() { + return pri_getHandle(); +} + +/************************************ + * Timeout setting for service monitoring status setting + ************************************/ +int32_t INI_SetMonitorTimeout(uint32_t timeout) { + return pri_setMonitorTimeout(timeout); +} + +/************************************ + * Event completion notification at startup + ************************************/ +int32_t INI_StepForkComp(uint64_t compId) { + return pri_stepForkComp(compId); +} + +/************************************ + * Event completion notification at termination + ************************************/ +int32_t INI_AccOffComp(uint64_t compId) { + return pri_accOffComp(compId); +} + +/************************************ + * BOOT Info Acquisition + ************************************/ +int32_t INI_GetBootInfo(T_SS_SM_START_DataStructType *info) { + if (info == NULL) { + TSKM_ASSERT(0); + return INI_FALSE; + } + return pri_getBootInfo(info); +} + +/************************************ + * Extended BOOT Info Acquisition + ************************************/ +int32_t INI_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *info) { + if (info == NULL) { + TSKM_ASSERT(0); + return INI_FALSE; + } + return pri_getExtBootInfo(info); +} + +/************************************ + * DebugDump Responding + ************************************/ +void _INI_DEBUGDUMP(BOOL bIsNeedSvcName, PCSTR cFormat, ...) { // LCOV_EXCL_START 7: for debugging + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + va_list argList; + char buf[TSKM_EV_DEBUGDUMP_SIZE] = { 0 }; + + if (bIsNeedSvcName) { + snprintf(buf, TSKM_EV_DEBUGDUMP_SIZE, "%s/", + FrameworkunifiedGetAppName(pri_getHandle())); + } + + va_start(argList, cFormat); + vsnprintf(&buf[strlen(buf)], TSKM_EV_DEBUGDUMP_SIZE - strlen(buf), cFormat, + argList); + va_end(argList); + + return pri_sendDebugDumpRes(buf); +} +// LCOV_EXCL_STOP 7 + diff --git a/service/system/task_manager/client/libprimary/src/pri_main.cpp b/service/system/task_manager/client/libprimary/src/pri_main.cpp new file mode 100755 index 0000000..9c0dd95 --- /dev/null +++ b/service/system/task_manager/client/libprimary/src/pri_main.cpp @@ -0,0 +1,873 @@ +/* + * @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. + */ + +#include "pri_main.h" +#include <sys/eventfd.h> +#include <native_service/frameworkunified_dispatcher.h> +#include <system_service/ss_system_if.h> +#include <string.h> +#include <errno.h> +#include <pthread.h> +#include <stdlib.h> +#include "tskm_debug.h" +#include "tskm_comm.h" +#include "tskm_port_pf.h" +#include "tskm_port_subsys.h" +#include "tskm_util.h" + + +#define PRI_PROC_NAME_MAX 32 + +// Context +typedef struct { + T_PRIM_PRM prm; + + TSKM_SVCID_t svcId; // Set valid value by REQ_WAKEUP + char procName[PRI_PROC_NAME_MAX]; + // State + TSKM_BOOL_t isExec; + T_SS_SM_START_DataStructType bootInfo; + T_SS_SM_START_ExtDataStructType extBootInfo; TSKM_BOOL_t isDynamic; + uint32_t wakeupStepDone; // Performed Local Step + TSKM_BOOL_t shmDone; + uint32_t downStepDone; // Performed Local Step + TSKM_BOOL_t isExitStart; + +#define PRI_MONITOR_DEFAULT_TIMEOUT 50 + uint32_t timeout; // Service monitoring timeout period (valid only for the INI_Main type service) + + // Resources + int connFd; // TSKM communication sockets + int nsFd; // NSFW sockets + int pipeFd[2]; // For exitDone + HANDLE hApp; // appHandle +} PRI_CTX_t; + +static PRI_CTX_t g_pri; + +/********************************************* + * Create Shared Memory + *********************************************/ +TSKM_STATIC void shmMake(PRI_CTX_t* p_ctx) { + const PRIM_SHAREDATA_TBL* shmEntry; + for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0'; shmEntry++) { + int ret; + ret = tskm_pf_shmCreate(shmEntry->shmName, shmEntry->size, NULL); + if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + goto ERROR; + // LCOV_EXCL_STOP + } + } + p_ctx->shmDone = TSKM_TRUE; + return; + + // LCOV_EXCL_START 6: Checked by Death testing, but it is not reflected in the coverage and excluded + ERROR: + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + tskm_pf_abort(); + // LCOV_EXCL_STOP +} + +/********************************************* + * Call Backup Check CB + *********************************************/ +TSKM_STATIC uint32_t wakeupExFuncCallback(PRI_CTX_t* p_ctx, + TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) { + const PRIM_EXFUNC_TBL* funcEntry; + uint32_t maxStep = 0; + + for (funcEntry = p_ctx->prm.wakeupExFuncTbl; funcEntry->localStep != 0; + funcEntry++) { + if (funcEntry->localStep == p_prm->localStep) { + funcEntry->func(funcEntry->prm); + } + maxStep = TSKM_MAX(maxStep, funcEntry->localStep); + } + return maxStep; +} + +/********************************************* + * Gradual Start Request + *********************************************/ +TSKM_STATIC void wakeupRequest(PRI_CTX_t* p_ctx, + TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) { + TSKM_EV_PRI_REQ_WAKEUP_PRM_t prm = *p_prm; + uint32_t max = 0; + + // Execute one step at a time + for (prm.localStep = p_ctx->wakeupStepDone + 1; + (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_STEPFORK_MAX); + prm.localStep++) { + max = wakeupExFuncCallback(p_ctx, &prm); + } + + if (max <= p_prm->localStep) { + // Gradual start completed + p_ctx->wakeupStepDone = PRIM_STEPFORK_MAX; + } else { + p_ctx->wakeupStepDone = p_prm->localStep; + } +} + +/********************************************* + * All startup requests + *********************************************/ +TSKM_STATIC void allWakeup(PRI_CTX_t* p_ctx, + TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) { + if (!p_ctx->shmDone) { + shmMake(p_ctx); + } + + if (p_ctx->wakeupStepDone < PRIM_STEPFORK_MAX) { + wakeupRequest(p_ctx, p_prm); + } +} + +/********************************************* + * Startup request handle + *********************************************/ +TSKM_STATIC void wakeupRequestHandle(PRI_CTX_t* p_ctx, + TSKM_EV_PRI_REQ_WAKEUP_PRM_t* p_prm) { + TSKM_EVENT_INFO_t ev; + int ret; + + bzero(&ev, sizeof(ev)); + + p_ctx->svcId = p_prm->svcId; + memcpy(&p_ctx->bootInfo, &p_prm->bootInfo, sizeof(p_ctx->bootInfo)); + memcpy(&p_ctx->extBootInfo, &p_prm->extBootInfo, sizeof(p_ctx->extBootInfo)); + p_ctx->isDynamic = p_prm->isDynamic; + + if (p_prm->localStep == TSKM_LSTEP_ALL) { + allWakeup(p_ctx, p_prm); + } else if (p_prm->localStep == TSKM_LSTEP_LAST) { + wakeupRequest(p_ctx, p_prm); + } else if (p_prm->localStep == TSKM_LSTEP_SHM) { + shmMake(p_ctx); + } else { + wakeupRequest(p_ctx, p_prm); + } + + ev.prm.resWakeup.isShmDone = p_ctx->shmDone; + ev.prm.resWakeup.isStepDone = + (p_ctx->wakeupStepDone >= PRIM_STEPFORK_MAX) ? + TSKM_TRUE : TSKM_FALSE; + + // LCOV_EXCL_BR_START 6: Because it depends on the test order + if (ev.prm.resWakeup.isShmDone && ev.prm.resWakeup.isStepDone) { + // LCOV_EXCL_BR_STOP + ev.prm.resWakeup.isLast = TSKM_TRUE; + } + + ev.event = TSKM_EV_PRI_RES_WAKEUP; + ev.errCode = TSKM_E_OK; + ret = tskm_sockSend(p_ctx->connFd, &ev); + if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + tskm_pf_abort(); + // LCOV_EXCL_STOP + } +} + +/********************************************* + * Gradual Termination CALLBACK + *********************************************/ +TSKM_STATIC uint32_t downExFuncCallback(PRI_CTX_t* p_ctx, + TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) { + const PRIM_EXFUNC_TBL* funcEntry; + uint32_t maxStep = 0; + + for (funcEntry = p_ctx->prm.downExFuncTbl; funcEntry->localStep != 0; + funcEntry++) { + if (funcEntry->localStep == p_prm->localStep) { + funcEntry->func(funcEntry->prm); + } + maxStep = TSKM_MAX(maxStep, funcEntry->localStep); + } + return maxStep; +} + +/********************************************* + * Gradual Termination Request + *********************************************/ +TSKM_STATIC void downRequest(PRI_CTX_t* p_ctx, + TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) { + TSKM_EV_PRI_REQ_DOWN_PRM_t prm = *p_prm; + uint32_t max = 0; + + // Execute one step at a time + for (prm.localStep = p_ctx->downStepDone + 1; + (prm.localStep <= p_prm->localStep && prm.localStep < PRIM_ACCOFF_MAX); + prm.localStep++) { + max = downExFuncCallback(p_ctx, &prm); + } + + if (max <= p_prm->localStep) { + p_ctx->downStepDone = PRIM_ACCOFF_MAX; // Completed all steps + } else { + p_ctx->downStepDone = p_prm->localStep; + } +} + +TSKM_STATIC void downRequestHandle(PRI_CTX_t* p_ctx, + TSKM_EV_PRI_REQ_DOWN_PRM_t* p_prm) { + TSKM_EVENT_INFO_t ev; + int ret; + + bzero(&ev, sizeof(ev)); + + if (p_prm->localStep == TSKM_LSTEP_ALL || p_prm->localStep == TSKM_LSTEP_LAST) { + downRequest(p_ctx, p_prm); + } else if (p_prm->localStep == TSKM_LSTEP_SHM) { + TSKM_ASSERT(0); + } else if (p_prm->localStep == TSKM_LSTEP_BUPCHK) { + TSKM_ASSERT(0); + } else { + downRequest(p_ctx, p_prm); + } + + if (p_ctx->downStepDone >= PRIM_ACCOFF_MAX) { + /* It is not notified when the last function is executed, and it is left to the exitDone. + TSKM_PRINTF(TSKM_LOG_DEBUG,"ACCOFF DONE"); + ev.prm.resDown.isLast = TSKM_TRUE; + p_ctx->isExec = TSKM_FALSE; + ret = tskm_sockSend(p_ctx->connFd,&ev); + if(ret <= 0){ + TSKM_ASSERT(0); + tskm_pf_abort(); + } + */ + } else { + ev.event = TSKM_EV_PRI_RES_DOWN; + ev.errCode = TSKM_E_OK; + ret = tskm_sockSend(p_ctx->connFd, &ev); + if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + tskm_pf_abort(); + // LCOV_EXCL_STOP + } + } +} + +/********************************************* + * Termination completion is notified to the TSKM + *********************************************/ +TSKM_STATIC void sendLastDoneRes(PRI_CTX_t* p_ctx) { + int ret; + TSKM_EVENT_INFO_t ev; + + bzero(&ev, sizeof(ev)); + + ev.event = TSKM_EV_PRI_RES_DOWN; + ev.errCode = TSKM_E_OK; + ev.prm.resDown.isLast = TSKM_TRUE; + ret = tskm_sockSend(p_ctx->connFd, &ev); + if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: Termination completion is notified to the TSKM. + // LCOV_EXCL_START 5: Termination completion is notified to the TSKM. + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + tskm_pf_abort(); + // LCOV_EXCL_STOP + } +} + +/********************************************* + * Invocation of Touch CB + *********************************************/ +TSKM_STATIC void touchService(PRI_CTX_t* p_ctx) { + char touchName[32]; + + if (p_ctx->isExitStart) { + // If termination processing has already begun, the system does not respond Touch but TIMEOUT the processing for retrying. + return; + } + + p_ctx->prm.onTouch(p_ctx->hApp); + + tskm_pf_mkTouchFileName(getpid(), touchName); + + if ((access(touchName, F_OK) == 0)) { + // Synchronize by deleting files. + TSKM_PRINTF(TSKM_LOG_STATE, "del:%s", touchName); + unlink(touchName); + } else { + TSKM_ASSERT_PRINT(0, "%s", touchName); + } +} + +/********************************************* + * Invocation of Debugdump CB + *********************************************/ +TSKM_STATIC void callDebugDump(PRI_CTX_t* p_ctx) { + if (!p_ctx->prm.onDebugDump) { // LCOV_EXCL_BR_LINE 6: As NULL checked by INI_Init + // LCOV_EXCL_START 6: As NULL checked by INI_Init + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + // LCOV_EXCL_STOP + } else { + p_ctx->prm.onDebugDump(p_ctx->hApp); + } +} + +/********************************************* + * Invocation of LowMemory detection CB + *********************************************/ +TSKM_STATIC void callLowMem(PRI_CTX_t* p_ctx) { + if (!p_ctx->prm.onLowMem) { + TSKM_ASSERT(0); + } else if (!p_ctx->isExitStart) { + // Notify LowMemory only when the process is finished + p_ctx->prm.onLowMem(p_ctx->hApp); + } +} + +/********************************************* + * Event Handle + *********************************************/ +TSKM_STATIC void eventHandle(PRI_CTX_t* p_ctx, TSKM_EVENT_INFO_t* p_ev) { + // Processing according to the request + switch (p_ev->event) { + case TSKM_EV_PRI_REQ_WAKEUP: + wakeupRequestHandle(p_ctx, &p_ev->prm.reqWakeup); + break; + case TSKM_EV_PRI_REQ_DOWN: + downRequestHandle(p_ctx, &p_ev->prm.reqDown); + break; + case TSKM_EV_PRI_REQ_TOUCH: + touchService(p_ctx); + break; + case TSKM_EV_PRI_REQ_DEBUGDUMP: + callDebugDump(p_ctx); + break; + case TSKM_EV_PRI_REP_LOWMEM: + callLowMem(p_ctx); + break; + default: + TSKM_ASSERT(0); + break; + } +} + +/********************************************* + * Initialize Context + *********************************************/ +TSKM_STATIC void initCtx(T_PRIM_PRM* p_prm, PRI_CTX_t* p_ctx, int argc, + char* argv[]) { + FrameworkunifiedDefaultCallbackHandler cbFuncs; + + p_ctx->prm = *p_prm; + + cbFuncs.onInitilization = p_ctx->prm.onInit; + cbFuncs.onDestroy = p_ctx->prm.onDestory; + cbFuncs.onDebugDump = p_ctx->prm.onDebugDump; + cbFuncs.onStart = FrameworkunifiedOnStart; + cbFuncs.onStop = FrameworkunifiedOnStop; + cbFuncs.onPreStart = FrameworkunifiedOnPreStart; + cbFuncs.onPreStop = FrameworkunifiedOnPreStop; + cbFuncs.onBackgroundStart = FrameworkunifiedOnBackgroundStart; + cbFuncs.onBackgroundStop = FrameworkunifiedOnBackgroundStop; + cbFuncs.createStateMachine = FrameworkunifiedCreateStateMachine; + cbFuncs.ssFrameworkInterface = FrameworkunifiedSSFrameworkInterface; + + EFrameworkunifiedStatus taskmanagerRet; + taskmanagerRet = FrameworkunifiedCreateDispatcherWithoutLoop(p_ctx->prm.name, p_ctx->hApp, argc, + argv, &cbFuncs, FALSE); + if (eFrameworkunifiedStatusOK != taskmanagerRet) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet); + goto ERROR; + // LCOV_EXCL_STOP + } + + taskmanagerRet = FrameworkunifiedGetDispatcherFD(p_ctx->hApp, &p_ctx->nsFd); + if (taskmanagerRet != eFrameworkunifiedStatusOK) { + TSKM_ASSERT_PRINT(0, "%d", taskmanagerRet); + exit(EXIT_FAILURE); + } + + p_ctx->connFd = tskm_cliSockConnect(TSKM_SOCKET_NAME); + if (p_ctx->connFd < 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + goto ERROR; + // LCOV_EXCL_STOP + } + if (pipe(p_ctx->pipeFd) != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT_ERRNO(0); + goto ERROR; + // LCOV_EXCL_STOP + } + + return; + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + ERROR: + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + tskm_pf_abort(); + // LCOV_EXCL_STOP +} + +/********************************************* + * Destroy Context + *********************************************/ +TSKM_STATIC void termCtx(PRI_CTX_t* p_ctx) { + if (p_ctx->shmDone) { // LCOV_EXCL_BR_LINE 6: Since it has been set to True by INI_Handler and cannot be changed + const PRIM_SHAREDATA_TBL* shmEntry = p_ctx->prm.shmTbl; + for (shmEntry = p_ctx->prm.shmTbl; shmEntry->shmName[0] != '\0'; + shmEntry++) { + TSKM_ASSERT(0 == tskm_pf_shmDelete(shmEntry->shmName)); // LCOV_EXCL_BR_LINE 8: For processing in which only return value 0 is set + } + } + + if (p_ctx->connFd > 0) { // LCOV_EXCL_BR_LINE 6: As it is already set by INI_Init and cannot be changed + tskm_sockDestory(p_ctx->connFd); + } + + EFrameworkunifiedStatus taskmanagerRet; + taskmanagerRet = FrameworkunifiedDestroyDispatcherWithoutLoop(p_ctx->hApp); + TSKM_ASSERT(taskmanagerRet == eFrameworkunifiedStatusOK); + + if (p_ctx->isDynamic) { + TSKM_PRINTF(TSKM_LOG_STATE, "EXIT %s", p_ctx->procName); + } else { + // Hung up running services to prevent adversely affecting to system termination processing during process termination processing + sleep(TSKM_CFG_WAIT_SHUTDOWN); + } +} + +/******************************************************************* + * PRI Context Initialization + *******************************************************************/ +void pri_init(T_PRIM_PRM* p_prm, int argc, char* argv[], int *fdNum, + int fdlist[INI_FD_MAX]) { + int ret = 0; + PRI_CTX_t* p_ctx = &g_pri; + + strncpy(p_ctx->procName, basename(argv[0]), sizeof(p_ctx->procName) - 1); + + ret = tskm_pf_procInit(); + if (ret != 0) { // LCOV_EXCL_BR_LINE 6: Return value of 0 only + // LCOV_EXCL_START 6: Return value of 0 only + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + goto ERROR; + // LCOV_EXCL_STOP + } + + ret = tskm_comm_procInit(); + if (ret != 0) { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + goto ERROR; + // LCOV_EXCL_STOP + } + + initCtx(p_prm, p_ctx, argc, argv); + + *fdNum = 3; + fdlist[0] = p_ctx->connFd; + fdlist[1] = p_ctx->pipeFd[0]; + fdlist[2] = p_ctx->nsFd; + + p_ctx->svcId = TSKM_SVCID_NONE; + p_ctx->isExec = TSKM_TRUE; + + p_ctx->bootInfo.startupReason = epswfINVALID; + p_ctx->bootInfo.isUserModeOn = FALSE; + p_ctx->bootInfo.dataResetMode = e_SS_SM_DATA_RESET_MODE_NONE; + p_ctx->bootInfo.securityStatus = epsssINVALID; + p_ctx->bootInfo.wakeupType = epsstINVALID; + p_ctx->bootInfo.dramBackupStatus = e_SS_SM_DRAM_BACKUP_UNSET; + p_ctx->bootInfo.resetStatus = e_SS_SM_RESET_STATUS_UNSET; + + memset(&p_ctx->extBootInfo, 0, sizeof(p_ctx->extBootInfo)); + + p_ctx->timeout = PRI_MONITOR_DEFAULT_TIMEOUT; + + return; + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + ERROR: + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + tskm_pf_abort(); // ABORT + // LCOV_EXCL_STOP +} + +/******************************************************************* + * Primary Library Handler + *******************************************************************/ +BOOL pri_handler(fd_set* p_fds) { + PRI_CTX_t* p_ctx = &g_pri; + + if (FD_ISSET(p_ctx->connFd, p_fds)) { + int ret; + TSKM_EVENT_INFO_t ev; + ret = tskm_sockRcv(p_ctx->connFd, &ev); + // LCOV_EXCL_BR_START 5: Condition is true. False condition is checked in Death tests, but not reflected in coverage and excluded + if (ret > 0) { + // LCOV_EXCL_BR_STOP + eventHandle(p_ctx, &ev); + } else { // LCOV_EXCL_BR_LINE 5: Checked by Death testing, but it is not reflected in the coverage and excluded + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + goto ERROR; + // LCOV_EXCL_STOP + } + } + + if (FD_ISSET(p_ctx->pipeFd[0], p_fds)) { + // only use exitDone + uint32_t tmp; + TSKM_ASSERT(sizeof(tmp) == read(p_ctx->pipeFd[0], &tmp, sizeof(tmp))); + TSKM_ASSERT(p_ctx->downStepDone == PRIM_ACCOFF_MAX); // Check if all exit functions are complete + if (p_ctx->isDynamic) { + // A nonresident service completes its termination processing by terminating the process. + // (because the SIGNAL will overtake the sockets) + } else { + // The resident service is a termination notice and completes termination processing. + // (Do not terminate processes to reduce the impact on system termination) + sendLastDoneRes(p_ctx); + } + p_ctx->isExec = TSKM_FALSE; + } + + if (FD_ISSET(p_ctx->nsFd, p_fds)) { + FrameworkunifiedDispatchProcessWithoutLoop(p_ctx->hApp); + } + return p_ctx->isExec; + + // LCOV_EXCL_START 5: Checked by Death testing, but it is not reflected in the coverage and excluded + ERROR: + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + tskm_pf_abort(); // ABORT + return 0; + // LCOV_EXCL_STOP +} + +/******************************************************************* + * Process termination + *******************************************************************/ +void pri_term(void) { + PRI_CTX_t* p_ctx = &g_pri; + termCtx(p_ctx); +} + +/******************************************************************* + * Service Monitoring Status Setting + *******************************************************************/ +int pri_setMonitorState(BOOL bIsRun, uint32_t timeout) { + PRI_CTX_t* p_ctx = &g_pri; + int ret = INI_SUCCESS; + + if (TSKM_SVCID_NONE == p_ctx->svcId) { + // Ignore requests until svcId is acquired. + } else if ((TRUE == bIsRun) && (0 == timeout)) { + // When RUN is specified with timeout = 0, monitoring is disabled. + } else { + ret = tskm_comm_setSvcWatchState(p_ctx->svcId, bIsRun, timeout); + if (INI_SUCCESS != ret) { + TSKM_ASSERT(0); + } + } + + return ret; +} + +/******************************************************************* + * MAIN Function + *******************************************************************/ +int pri_main(T_PRIM_PRM* p_prm, int argc, char* argv[]) { + int mainRet = -1; + int fdlist[INI_FD_MAX]; + int fdNum; + int ii; + BOOL isExec = TRUE; + + pri_init(p_prm, argc, argv, &fdNum, fdlist); + + while (isExec) { + PRI_CTX_t* p_ctx = &g_pri; + int maxFd = 0; + fd_set fds; + int ret; + + FD_ZERO(&fds); + + for (ii = 0; ii < fdNum; ii++) { + FD_SET(fdlist[ii], &fds); + maxFd = TSKM_MAX(fdlist[ii], maxFd); + } + + TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(FALSE, 0)); + ret = select(maxFd + 1, &fds, NULL, NULL, NULL); + TSKM_ASSERT(INI_SUCCESS == pri_setMonitorState(TRUE, p_ctx->timeout)); + if (ret < 1) { + // LCOV_EXCL_START 5: Select's Error-Handling Process + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + if (errno != EINTR) { + TSKM_ASSERT(0); + } + continue; + // LCOV_EXCL_STOP + } + + isExec = pri_handler(&fds); + } + + mainRet = 0; + + pri_term(); + return mainRet; +} + +/******************************************************************* + * Termination Request + *******************************************************************/ +void pri_exitStart(void *rsv) { + int ret; + PRI_CTX_t* p_ctx = &g_pri; + TSKM_EVENT_INFO_t ev; + + bzero(&ev, sizeof(ev)); + p_ctx->isExitStart = TRUE; + ev.event = TSKM_EV_PRI_REQ_EXIT; + ev.errCode = TSKM_E_OK; + + ret = tskm_sockSend(p_ctx->connFd, &ev); + if (ret <= 0) { // LCOV_EXCL_BR_LINE 5: The caller's external API does not execute the second or subsequent processing and cannot be checked. + // LCOV_EXCL_START 5: The caller's external API does not execute the second or subsequent processing and cannot be checked. + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); + goto ERROR; + // LCOV_EXCL_STOP + } + + return; + // LCOV_EXCL_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked. + ERROR: + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + tskm_pf_abort(); + // LCOV_EXCL_STOP +} + +void pri_exitDone(int status) { + PRI_CTX_t* p_ctx = &g_pri; + uint32_t l_status = (uint32_t) status; + + if (p_ctx->pipeFd[1] > 0) { // LCOV_EXCL_BR_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked + // LCOV_EXCL_BR_START 6: The caller's external API does not execute the second or subsequent processing and cannot be checked + TSKM_ASSERT_ERRNO( + write(p_ctx->pipeFd[1], &l_status, sizeof(l_status)) + == sizeof(l_status)); + // LCOV_EXCL_BR_STOP + } else { + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + TSKM_ASSERT(0); // LCOV_EXCL_LINE 6: The caller's external API does not execute the second or subsequent processing and cannot be checked. + } +} + +/******************************************************************* + * Event completion notification at startup + *******************************************************************/ +int32_t pri_stepForkComp(uint64_t id) { + int ret; + PRI_CTX_t* p_ctx = &g_pri; + TSKM_EVENT_INFO_t ev; + + bzero(&ev, sizeof(ev)); + ev.event = TSKM_EV_PRI_REP_WAKEUP_COMP; + ev.errCode = TSKM_E_OK; + ev.prm.repWakeupComp.compId = id; + ret = tskm_sockSend(p_ctx->connFd, &ev); + if (ret <= 0) { + TSKM_ASSERT(0); + goto ERROR; + } + return INI_SUCCESS; + ERROR: return INI_FALSE; +} + +/******************************************************************* + * Event completion notification at termination + *******************************************************************/ +int32_t pri_accOffComp(uint64_t id) { + int ret; + PRI_CTX_t* p_ctx = &g_pri; + TSKM_EVENT_INFO_t ev; + + bzero(&ev, sizeof(ev)); + + ev.event = TSKM_EV_PRI_REP_DOWN_COMP; + ev.errCode = TSKM_E_OK; + ev.prm.repDownComp.compId = id; + ret = tskm_sockSend(p_ctx->connFd, &ev); + if (ret <= 0) { + TSKM_ASSERT(0); + goto ERROR; + } + return INI_SUCCESS; + ERROR: return INI_FALSE; +} + +/******************************************************************* + * Private Information Acquisition + *******************************************************************/ +void* +pri_getPrivate() { + PRI_CTX_t* p_ctx = &g_pri; + return p_ctx->prm.priv; +} + +/******************************************************************* + * App Handle Acquisition + *******************************************************************/ +HANDLE pri_getHandle() { + PRI_CTX_t* p_ctx = &g_pri; + return p_ctx->hApp; +} + +/******************************************************************* + * Timeout setting for Service monitoring status setting + *******************************************************************/ +int32_t pri_setMonitorTimeout(uint32_t timeout) { + PRI_CTX_t* p_ctx = &g_pri; + p_ctx->timeout = timeout; + return INI_SUCCESS; +} + +/******************************************************************* + * BOOT Info Acquisition + *******************************************************************/ +int32_t pri_getBootInfo(T_SS_SM_START_DataStructType *info) { + PRI_CTX_t* p_ctx = &g_pri; + + if (p_ctx->bootInfo.startupReason == epswfINVALID) { + TSKM_ASSERT(0); + return INI_FALSE; + } + + *info = p_ctx->bootInfo; + + return INI_SUCCESS; +} + +/******************************************************************* + * Extended BOOT Info Acquisition + *******************************************************************/ +int32_t pri_getExtBootInfo(T_SS_SM_START_ExtDataStructType *info) { + PRI_CTX_t* p_ctx = &g_pri; + + if (p_ctx->bootInfo.startupReason == epswfINVALID) { + TSKM_ASSERT(0); + return INI_FALSE; + } + + *info = p_ctx->extBootInfo; + + return INI_SUCCESS; +} + +/******************************************************************* + * DebugDump Responding + *******************************************************************/ +void pri_sendDebugDumpRes(const char *buf) { // LCOV_EXCL_START 7: for debugging + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + int ret; + PRI_CTX_t* p_ctx = &g_pri; + TSKM_EVENT_INFO_t ev; + TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *p_prm; + + ev.event = TSKM_EV_PRI_RES_DEBUGDUMP; + ev.errCode = TSKM_E_OK; + ev.hasExtend = TSKM_TRUE; + + ev.extendPrm = malloc(sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t)); + if (!ev.extendPrm) { + TSKM_ASSERT(0); + goto ERROR; + } + + ev.extendSize = sizeof(TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t); + + p_prm = (TSKM_EV_PRI_EX_RES_DEBUGDUMP_PRM_t *) ev.extendPrm; // NOLINT ( ) + snprintf(p_prm->dumpMsg, TSKM_EV_DEBUGDUMP_SIZE, "%s", buf); + + ret = tskm_sockSend(p_ctx->connFd, &ev); + if (ret <= 0) { + TSKM_ASSERT(0); + } + + ERROR: return; +} +// LCOV_EXCL_STOP +/************************************************* + * Empty functions implemented for building software + **************************************************/ +EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} +// LCOV_EXCL_STOP +EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} +// LCOV_EXCL_STOP +EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eFrameworkunifiedStatusOK; +} +EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eFrameworkunifiedStatusOK; +} +EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eFrameworkunifiedStatusOK; +} +EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) { + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return eFrameworkunifiedStatusOK; +} +EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 6: Because the condition cannot be set + AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert + EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); + FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); + return l_eStatus; +} +// LCOV_EXCL_STOP diff --git a/service/system/task_manager/client/libtskm/Makefile b/service/system/task_manager/client/libtskm/Makefile new file mode 100755 index 0000000..b0f7e2f --- /dev/null +++ b/service/system/task_manager/client/libtskm/Makefile @@ -0,0 +1,35 @@ +# +# @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. +# + +VPATH = ./ ./src + +INST_SHLIBS = libtskm + +RPC_API := TSKM + +libtskm_SRCS = tskm_api_stub.c +libtskm_SRCS += tskm_api_lib.cpp + +CPPFLAGS += -I. -I../../include-share -I./ -I../../server/include -I./../libtskmcfg/include + +######## add compile option ######## +CPPFLAGS += -fno-exceptions +LDFLAGS += -Wl,--no-as-needed +######### linked library (dynamic) ############# +LDLIBS += -lrpc +LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified + +include ../../../system_service.mk diff --git a/service/system/task_manager/client/libtskm/TSKM.api b/service/system/task_manager/client/libtskm/TSKM.api new file mode 100755 index 0000000..023f53b --- /dev/null +++ b/service/system/task_manager/client/libtskm/TSKM.api @@ -0,0 +1,9 @@ +INCLUDE <system_service/tskm.h> + +RPC_Result _TSKM_SvcCtl(TSKM_SVCID_t svcId,const TSKM_SVC_CTL_t* ctl); +RPC_Result TSKM_SvcGetInfo(TSKM_SVCID_t svcId,TSKM_SVC_INFO_t* svcInfo); +RPC_Result _TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info); +RPC_Result TSKM_Reboot(const TSKM_RSV_t * p_rsv); +RPC_Result TSKM_Logging(const TSKM_LOGGING_INFO_t* p_info); +RPC_Result TSKM_SetWakeupOrder(const TSKM_WAKEUP_ORDER_t* p_order); + diff --git a/service/system/task_manager/client/libtskm/libtskm.ver b/service/system/task_manager/client/libtskm/libtskm.ver new file mode 100755 index 0000000..4d68cee --- /dev/null +++ b/service/system/task_manager/client/libtskm/libtskm.ver @@ -0,0 +1,21 @@ +/* + * @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. + */ + +{ + global: + TSKM_*; + local: *; +}; diff --git a/service/system/task_manager/client/libtskm/src/tskm_api_lib.cpp b/service/system/task_manager/client/libtskm/src/tskm_api_lib.cpp new file mode 100755 index 0000000..625b639 --- /dev/null +++ b/service/system/task_manager/client/libtskm/src/tskm_api_lib.cpp @@ -0,0 +1,90 @@ +/* + * @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. + */ + +#include <unistd.h> +#include <signal.h> + +#include <native_service/frameworkunified_framework_if.h> + +#include "tskm_debug.h" +#include "tskm_api.h" + +TSKM_ERR_t TSKM_SvcCtl(TSKM_SVCID_t svcId, const TSKM_SVC_CTL_t* ctl) { + TSKM_ERR_t tskmRet; + int ii; + + for (ii = 0; ii < 3; ii++) { + // Retry three times + tskmRet = _TSKM_SvcCtl(svcId, ctl); + if (tskmRet == TSKM_E_RETRY) { + usleep(300 * 1000); // 300ms wait + } else { + break; + } + } + + return tskmRet; +} + +TSKM_ERR_t TSKM_ErrorReboot(const TSKM_ERROR_REBOOT_t* p_info) { + TSKM_ERR_t tskmRet = TSKM_E_OK; + RPC_Result rpcRet; + + rpcRet = _TSKM_ErrorReboot(p_info); + if (RPC_OK != rpcRet) { + tskmRet = TSKM_E_PAR; + } + + return tskmRet; +} + +TSKM_ERR_t TSKM_DataInit(HANDLE hApp, const TSKM_DATAINIT_t *p_info) { + TSKM_ERR_t tskmRet = TSKM_E_NG; + TSKM_PRINTF(TSKM_LOG_API, "%s()", __FUNCTION__) + + if (!p_info || !hApp || (p_info->type != TSKM_DATAINIT_TYPE_USER) + || !(p_info->onCompInit)) { + TSKM_ASSERT(0); + return TSKM_E_PAR; + } + + // LCOV_EXCL_BR_START 10: Due to compiler dependency + EFrameworkunifiedStatus l_eStatus = FrameworkunifiedAttachCallbackToDispatcher(hApp, + SS_TASK_MANAGER, + TSKM_DATAINIT_RESP, + p_info->onCompInit); + // LCOV_EXCL_BR_STOP + if (eFrameworkunifiedStatusOK != l_eStatus) { + TSKM_ASSERT(0); + } else { + HANDLE hSvc = FrameworkunifiedOpenService(hApp, SS_TASK_MANAGER); + if (hSvc == NULL) { + TSKM_ASSERT(0); + tskmRet = TSKM_E_STATE; + } else { + if (eFrameworkunifiedStatusOK != FrameworkunifiedSendMsg(hSvc, TSKM_DATAINIT_REQ, 0, NULL)) { + TSKM_ASSERT(0); + } else { + tskmRet = TSKM_E_OK; + } + } + + TSKM_ASSERT(eFrameworkunifiedStatusOK == FrameworkunifiedCloseService(hApp, hSvc)); + } + + return tskmRet; +} // LCOV_EXCL_BR_LINE 10: Final line + diff --git a/service/system/task_manager/client/libtskmcfg/Makefile b/service/system/task_manager/client/libtskmcfg/Makefile new file mode 100755 index 0000000..9fe2ed3 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/Makefile @@ -0,0 +1,93 @@ +# +# @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. +# + +WAKESHUTCONF_DIR=./conf + +VPATH = ./src ./include/$(COMPONENT_NAME) + +INST_SHLIBS = libtskmcfg +INST_HEADERS = tskm_xml_data.h tskm_svcid.h task_manager_libtskmcfg.h +libtskmcfg_SRCS = tskm_xml_data.cpp + + +CPPFLAGS = -I./ -I./include -I./../../include-share -I./../../server/include +LDFLAGS += -Wl,--no-as-needed +LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified + + +#============ XML PARSE ============ +XMLOUTFILE= tskm_auto_build.h + +CLEAN_FILES+=$(XMLOUTFILE) $(PARSEXMLCMD) $(CONFIG_FILES) top.xml + +#TOOLS +HOST_CPP=cpp +XMLCHECKER=xmllint +XMLCHECKEROPT=--noout --valid +PARSEXMLCMD=parsexml +HOSTCC=gcc +XMLFILETOP=tskm_cfg.xml + +install:install-pre install-pre-header +build-lib:install-pre install-pre-header +install-lib:install-pre install-pre-header +install-pre: + install -d -m 775 $(DESTDIR)/usr/agl/conf/BS/ss/task_manager/rodata;\ + install -m 644 -t $(DESTDIR)/usr/agl/conf/BS/ss/task_manager/rodata $(WAKESHUTCONF_DIR)/tskm_launch.xml;\ + +CONFIG_FILES:=tskm_wakeup.xml tskm_shutdown.xml tskm_wakeup_vup.xml tskm_shutdown_vup.xml tskm_launch.xml tskm_svcid.h agl_thread.h + +#install-header:$(XMLOUTFILE) +install-pre-header:$(XMLOUTFILE) + +#TOPFILE +top.xml:$(XMLFILETOP) + ln -fs $< $@ + +#CONFIG RULES +tskm_wakeup.xml:$(WAKESHUTCONF_DIR)/tskm_wakeup.xml + ln -fs $< $@ + +tskm_shutdown.xml:$(WAKESHUTCONF_DIR)/tskm_shutdown.xml + ln -fs $< $@ + +tskm_wakeup_vup.xml:$(WAKESHUTCONF_DIR)/tskm_wakeup_vup.xml + ln -fs $< $@ + +tskm_shutdown_vup.xml:$(WAKESHUTCONF_DIR)/tskm_shutdown_vup.xml + ln -fs $< $@ + +#tskm_svcid.h:$(SVCONF_DIR)/tskm_svcid.h +# ln -fs $< $@ + +agl_thread.h:$(WAKESHUTCONF_DIR)/agl_thread.h + ln -fs $< $@ + + +tskm_launch.xml:$(WAKESHUTCONF_DIR)/tskm_launch.xml agl_thread.h + $(HOST_CPP) -P -include agl_thread.h $< > $@ +#tskm_launch.xml:$(SVCONF_DIR)/tskm_launch.xml $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h +# $(HOST_CPP) -P -include agl_thread.h $< > $@ + +$(XMLOUTFILE):top.xml $(PARSEXMLCMD) $(CONFIG_FILES) + $(XMLCHECKER) $(XMLCHECKEROPT) $< + ./$(PARSEXMLCMD) $< + +$(PARSEXMLCMD):$(PARSEXMLCMD).c + $(HOSTCC) -o $@ $< -lexpat + +include ../../../system_service.mk + diff --git a/service/system/task_manager/client/libtskmcfg/conf/agl_thread.h b/service/system/task_manager/client/libtskmcfg/conf/agl_thread.h new file mode 100755 index 0000000..83ac087 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/conf/agl_thread.h @@ -0,0 +1,1377 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + */ + +#ifndef __AGL_THREAD_H__ +#define __AGL_THREAD_H__ + +//MACRO +#define PR_TSS_S "0" +#define PR_TSS 0 + +/* + Main thread name. It need to be same as service name in sm_launch.xml or tskm_launch.xml + Max name length is 15 + #define MN_XXXXX "MainName" + + Thread name + Max name length is 15 + #define TN_XXXXX "ThreadName" + + Thread priority 0:TSS 1-99:FIFO + #define PR_XXXXX_S "(0-99)" //for xml + #define PR_XXXXX 0-99 //for program +*/ + +#define MN_SS_SYSMANAGER "SS_SysManager" +#define PR_SS_SYSMANAGER_S "20" +#define PR_SS_SYSMANAGER (20) + + #define TN_SMHEARTBEAT "SM.Heartbeat" + #define PR_SMHEARTBEAT_S "20" + #define PR_SMHEARTBEAT (20) + + #define TN_SMPROCLAUNCH "SM.ProcLaunch" + #define PR_SMPROCLAUNCH_S "20" + #define PR_SMPROCLAUNCH (20) + + #define TN_SMLOWMEMMON "SM.LowMemMon" + #define PR_SMLOWMEMMON_S "20" + #define PR_SMLOWMEMMON (20) + + #define TN_LOGGERRTIME "LoggerRtime" + #define PR_LOGGERRTIME_S PR_TSS_S + #define PR_LOGGERRTIME PR_TSS + + +//======= exec from system manager ============= +#define MN_NS_SHAREDMEM "NS_SharedMem" +#define PR_NS_SHAREDMEM_S "25" +#define PR_NS_SHAREDMEM (25) + + +#define MN_NS_NPPSERVICE "NS_NPPService" +#define PR_NS_NPPSERVICE_S "25" +#define PR_NS_NPPSERVICE (25) + + #define TN_NS_NPPREADWKR "NS_NPPReadWkr" + #define PR_NS_NPPREADWKR_S "25" + #define PR_NS_NPPREADWKR (25) + + #define TN_NS_NPPWRITEWKR "NS_NPPWriteWkr" + #define PR_NS_NPPWRITEWKR_S "25" + #define PR_NS_NPPWRITEWKR (25) + + #define TN_NS_NPPIPWKR "NS_NPPIPWkr" + #define PR_NS_NPPIPWKR_S "25" + #define PR_NS_NPPIPWKR (25) + +#define MN_NS_BACKUPMGR "NS_BackupMgr" +#define PR_NS_BACKUPMGR_S "25" +#define PR_NS_BACKUPMGR (25) + + #define TN_NS_BKUPNAND "NS_BkupNAND" + #define PR_NS_BKUPNAND_S "25" + #define PR_NS_BKUPNAND (25) + + #define TN_NS_BKUPDELAY "NS_BkupDelay" + #define PR_NS_BKUPDELAY_S "25" + #define PR_NS_BKUPDELAY (25) + +#define MN_SS_DEVDETECTSRV "SS_DevDetectSrv" +#define PR_SS_DEVDETECTSRV_S "20" +#define PR_SS_DEVDETECTSRV (20) + + #define TN_SS_DETECT_USB "SS_Detect_USB" + #define PR_SS_DETECT_USB_S "20" + #define PR_SS_DETECT_USB (20) + + #define TN_SS_DETECT_SD "SS_Detect_SD" + #define PR_SS_DETECT_SD_S "20" + #define PR_SS_DETECT_SD (20) + + #define TN_SS_MONITOR_OVC "SS_Monitor_OVC" + #define PR_SS_MONITOR_OVC_S "20" + #define PR_SS_MONITOR_OVC (20) + +#define MN_SS_LOGGERSRV "SS_LoggerSrv" +#define PR_SS_LOGGERSRV_S PR_TSS_S +#define PR_SS_LOGGERSRV PR_TSS + + #define TN_PDGLOGQUER "pdg.LogQueR" + #define PR_PDGLOGQUER_S PR_TSS_S + #define PR_PDGLOGQUER PR_TSS + + #define TN_PDGTRANSQUER "pdg.TransQueR" + #define PR_PDGTRANSQUER_S PR_TSS_S + #define PR_PDGTRANSQUER PR_TSS + + #define TN_PDGEVNTLOGQUE "pdg.EvntLogQue" + #define PR_PDGEVNTLOGQUE_S PR_TSS_S + #define PR_PDGEVNTLOGQUE PR_TSS + + #define TN_SSLOGGERSTRAGE "SSLoggerStrage" + #define PR_SSLOGGERSTRAGE_S PR_TSS_S + #define PR_SSLOGGERSTRAGE PR_TSS + + #define TN_PFDRECTHREAD "PFDRECThread" + #define PR_PFDRECTHREAD_S PR_TSS_S + #define PR_PFDRECTHREAD PR_TSS + +#define MN_PS_LOGGERSHADOW "PS_LoggerShadow" + #define PR_PSLOGGERSHADOW_S PR_TSS_S + #define PR_PSLOGGERSHADOW PR_TSS + +#define MN_UDEVD "udevd" +#define PR_UDEVD_S "1" +#define PR_UDEVD (1) + +#define MN_COMMUNICATION "Communication" +#define PR_COMMUNICATION_S "30" +#define PR_COMMUNICATION (30) + + #define TN_DEV_SYSCOM_TMR "DEV_SYSCOM_TMR" + #define PR_DEV_SYSCOM_TMR_S "30" + #define PR_DEV_SYSCOM_TMR (30) + + #define TN_DEV_SYSCOM_RCV "DEV_SYSCOM_RCV" + #define PR_DEV_SYSCOM_RCV_S "30" + #define PR_DEV_SYSCOM_RCV (30) + + #define TN_DEV_SYSCOM_MAIN "DEV_SYSCOM_MAIN" + #define PR_DEV_SYSCOM_MAIN_S "30" + #define PR_DEV_SYSCOM_MAIN (30) + + #define TN_TGWCOM "TGWCOM" + #define PR_TGWCOM_S "30" + #define PR_TGWCOM (30) + + #define TN_ICM "ICM" + #define PR_ICM_S "30" + #define PR_ICM (30) + + #define TN_CAN_COM_PROT "CAN_COM_PROT" + #define PR_CAN_COM_PROT_S "30" + #define PR_CAN_COM_PROT (30) + +#define MN_PS_PSMSHADOW "PS_PSMShadow" +#define PR_PS_PSMSHADOW_S "30" +#define PR_PS_PSMSHADOW (30) + +#define MN_COMMSH4A "CommSH4A" +#define PR_COMMSH4A_S "30" +#define PR_COMMSH4A (30) + + #define TN_DEV_SH4A_SND "DEV_SH4ACOM_SND" + #define PR_DEV_SH4A_SND_S "30" + #define PR_DEV_SH4A_SND (30) + + #define TN_DEV_SH4A_RCV "DEV_SH4ACOM_RCV" + #define PR_DEV_SH4A_RCV_S "30" + #define PR_DEV_SH4A_RCV (30) + + #define TN_DEV_SH4A_MON "DEV_SH4ACOM_MON" + #define PR_DEV_SH4A_MON_S "30" + #define PR_DEV_SH4A_MON (30) + +#define MN_PS_COMMUSB "PS_CommUSB" +#define PR_PS_COMMUSB_S "30" +#define PR_PS_COMMUSB (30) + + #define TN_COMMUSB_RCV "COMMUSB_RCV" + #define PR_COMMUSB_RCV_S "30" + #define PR_COMMUSB_RCV (30) + + #define TN_COMMUSB_DIAG "COMMUSB_DIAG" + #define PR_COMMUSB_DIAG_S "30" + #define PR_COMMUSB_DIAG (30) + +#define MN_PS_CANGW_M "CANGW_M" +#define PR_PS_CANGW_M_S PR_TSS_S +#define PR_PS_CANGW_M PR_TSS + + #define TN_CANGW_M_RCV "CANGW_M_RCV" + #define PR_CANGW_M_RCV_S PR_TSS_S + #define PR_CANGW_M_RCV PR_TSS + + #define TN_CANGW_M_DIAG "CANGW_M_DIAG" + #define PR_CANGW_M_DIAG_S PR_TSS_S + #define PR_CANGW_M_DIAG PR_TSS + +#define MN_PS_CANGW_S "CANGW_S" +#define PR_PS_CANGW_S_S PR_TSS_S +#define PR_PS_CANGW_S PR_TSS + + #define TN_CANGW_S_SND "CANGW_S_SND" + #define PR_CANGW_S_SND_S PR_TSS_S + #define PR_CANGW_S_SND PR_TSS + + #define TN_CANGW_S_DIAG "CANGW_S_DIAG" + #define PR_CANGW_S_DIAG_S PR_TSS_S + #define PR_CANGW_S_DIAG PR_TSS + +#define MN_LANSERVER "LanServer" +#define PR_LANSERVER_S "20" +#define PR_LANSERVER (20) + +#define MN_PS_CDR "ps_cdr" +#define PR_PS_CDR_S PR_TSS_S +#define PR_PS_CDR PR_TSS + + #define TN_PS_CDR_NBD "ps_cdr_nbd" + #define PR_PS_CDR_NBD_S PR_TSS_S + #define PR_PS_CDR_NBD PR_TSS + + #define TN_PS_CDR_DOIT "ps_cdr_doit" + #define PR_PS_CDR_DOIT_S PR_TSS_S + #define PR_PS_CDR_DOIT PR_TSS + + #define TN_PS_CDR_READ "ps_cdr_read" + #define PR_PS_CDR_READ_S PR_TSS_S + #define PR_PS_CDR_READ PR_TSS + +#define MN_POSITIONING "Positioning" +#define PR_POSITIONING_S PR_TSS_S +#define PR_POSITIONING PR_TSS + + #define TN_POSITIONING_GPS_MAIN "POS_Main" + #define PR_POSITIONING_GPS_MAIN_S PR_TSS_S + #define PR_POSITIONING_GPS_MAIN PR_TSS + + #define TN_POSITIONING_GPS_RECV "POS_Gps_Recv" + #define PR_POSITIONING_GPS_RECV_S PR_TSS_S + #define PR_POSITIONING_GPS_RECV PR_TSS + + #define TN_POSITIONING_GPS "POS_Gps" + #define PR_POSITIONING_GPS_S PR_TSS_S + #define PR_POSITIONING_GPS PR_TSS + + #define TN_POSITIONING_SENS "POS_Sens" + #define PR_POSITIONING_SENS_S PR_TSS_S + #define PR_POSITIONING_SENS PR_TSS + + #define TN_POSITIONING_GPS_ROLOVR "POS_Gps_Rolovr" + #define PR_POSITIONING_GPS_ROLOVR_S PR_TSS_S + #define PR_POSITIONING_GPS_ROLOVR PR_TSS + +#define MN_CLOCK "clock" +#define PR_CLOCK_S "20" +#define PR_CLOCK (20) + + #define TN_CLOCK_MNG "ClockMng" + #define PR_CLOCK_MNG_S "20" + #define PR_CLOCK_MNG (20) + +#define MN_VEHICLE "vehicle" +#define PR_VEHICLE_S "20" +#define PR_VEHICLE (20) + + #define TN_VEHICLE_SENS "VehicleSens" + #define PR_VEHICLE_SENS_S "20" + #define PR_VEHICLE_SENS (20) + + #define TN_LINE_SENS_DRV "LineSensDrv" + #define PR_LINE_SENS_DRV_S "20" + #define PR_LINE_SENS_DRV (20) + +#define MN_SS_POWERSERVICE "SS_PowerService" +#define PR_SS_POWERSERVICE_S "30" +#define PR_SS_POWERSERVICE (30) + +#define MN_SS_TASKMANAGER "SS_TaskManager" +#define PR_SS_TASKMANAGER_S "20" +#define PR_SS_TASKMANAGER (20) + + #define TN_SS_TSKMTIMER "SS_TskmTimer" + #define PR_SS_TSKMTIMER_S "20" + #define PR_SS_TSKMTIMER (20) + +#define MN_SOUND "Sound" +#define PR_SOUND_S "45" +#define PR_SOUND (45) + + #define TN_VG_SNDSRCMGR "VG_SNDSRCMGR" + #define PR_VG_SNDSRCMGR_S "40" + #define PR_VG_SNDSRCMGR (40) + + #define TN_SND_INPUTCTRL "SND_INPUTCTRL" + #define PR_SND_INPUTCTRL_S "40" + #define PR_SND_INPUTCTRL (40) + + #define TN_SND_DEVCTRL "SND_DEVCTRL" + #define PR_SND_DEVCTRL_S "40" + #define PR_SND_DEVCTRL (40) + + #define TN_SND_VCETRFCTRL "SND_VCETRFCTRL" + #define PR_SND_VCETRFCTRL_S "45" + #define PR_SND_VCETRFCTRL (45) + + #define TN_SND_VCETRFWRT1 "SND_VCETRFWRT1" + #define PR_SND_VCETRFWRT1_S "45" + #define PR_SND_VCETRFWRT1 (45) + + #define TN_SND_VCETRFWRT2 "SND_VCETRFWRT2" + #define PR_SND_VCETRFWRT2_S "45" + #define PR_SND_VCETRFWRT2 (45) + + #define TN_VG_SNDCTRL_BSCF "VG_SNDCTRL_BSCF" + #define PR_VG_SNDCTRL_BSCF_S "25" + #define PR_VG_SNDCTRL_BSCF (25) + + #define TN_VG_SNDCTRL_BSCR "VG_SNDCTRL_BSCR" + #define PR_VG_SNDCTRL_BSCR_S "25" + #define PR_VG_SNDCTRL_BSCR (25) + + #define TN_VG_SNDCTRL_ITRT "VG_SNDCTRL_ITRT" + #define PR_VG_SNDCTRL_ITRT_S "25" + #define PR_VG_SNDCTRL_ITRT (25) + + #define TN_CVRS_OPRT_OUT_1 "CVRS_OPRT_OUT_1" + #define PR_CVRS_OPRT_OUT_1_S "45" + #define PR_CVRS_OPRT_OUT_1 (45) + + #define TN_CVRS_OPRT_OUT_2 "CVRS_OPRT_OUT_2" + #define PR_CVRS_OPRT_OUT_2_S "45" + #define PR_CVRS_OPRT_OUT_2 (45) + + #define TN_CVRS_OPRT_OUT_3 "CVRS_OPRT_OUT_3" + #define PR_CVRS_OPRT_OUT_3_S "45" + #define PR_CVRS_OPRT_OUT_3 (45) + + #define TN_CVRS_OPRT_OUT_4 "CVRS_OPRT_OUT_4" + #define PR_CVRS_OPRT_OUT_4_S "45" + #define PR_CVRS_OPRT_OUT_4 (45) + + #define TN_CVRS_OPRT_IN_1 "CVRS_OPRT_IN_1" + #define PR_CVRS_OPRT_IN_1_S "45" + #define PR_CVRS_OPRT_IN_1 (45) + + #define TN_CVRS_OPRT_IN_2 "CVRS_OPRT_IN_2" + #define PR_CVRS_OPRT_IN_2_S "45" + #define PR_CVRS_OPRT_IN_2 (45) + + #define TN_CVRS_OPRT_IN_3 "CVRS_OPRT_IN_3" + #define PR_CVRS_OPRT_IN_3_S "45" + #define PR_CVRS_OPRT_IN_3 (45) + + #define TN_CVRS_OPRT_IN_4 "CVRS_OPRT_IN_4" + #define PR_CVRS_OPRT_IN_4_S "45" + #define PR_CVRS_OPRT_IN_4 (45) + + #define TN_CVRS_OPRT_IN_5 "CVRS_OPRT_IN_5" + #define PR_CVRS_OPRT_IN_5_S "45" + #define PR_CVRS_OPRT_IN_5 (45) + + #define TN_CVRS_OPRT_IN_6 "CVRS_OPRT_IN_6" + #define PR_CVRS_OPRT_IN_6_S "45" + #define PR_CVRS_OPRT_IN_6 (45) + + #define TN_CVRS_OPRT_IN_7 "CVRS_OPRT_IN_7" + #define PR_CVRS_OPRT_IN_7_S "45" + #define PR_CVRS_OPRT_IN_7 (45) + + #define TN_CVRS_OPRT_IN_8 "CVRS_OPRT_IN_8" + #define PR_CVRS_OPRT_IN_8_S "45" + #define PR_CVRS_OPRT_IN_8 (45) + + #define TN_CVRS_OPRT_BS_I "CVRS_OPRT_BS_I" + #define PR_CVRS_OPRT_BS_I_S "45" + #define PR_CVRS_OPRT_BS_I (45) + + #define TN_VR_NVR_RECO "VR_NVR_RECO" + #define PR_VR_NVR_RECO_S "20" + #define PR_VR_NVR_RECO (20) + + #define TN_SND_ECNR "SND_ECNR" + #define PR_SND_ECNR_S "40" + #define PR_SND_ECNR (40) + + #define TN_SNDAGENT_000 "SNDAGENT_000" + #define PR_SNDAGENT_000_S "45" + #define PR_SNDAGENT_000 (45) + + #define TN_SNDAGENT_001 "SNDAGENT_001" + #define PR_SNDAGENT_001_S "45" + #define PR_SNDAGENT_001 (45) + + #define TN_SNDAGENT_002 "SNDAGENT_002" + #define PR_SNDAGENT_002_S "45" + #define PR_SNDAGENT_002 (45) + + #define TN_SNDAGENT_003 "SNDAGENT_003" + #define PR_SNDAGENT_003_S "45" + #define PR_SNDAGENT_003 (45) + + #define TN_SNDAGENT_004 "SNDAGENT_004" + #define PR_SNDAGENT_004_S "45" + #define PR_SNDAGENT_004 (45) + + #define TN_SNDAGENT_005 "SNDAGENT_005" + #define PR_SNDAGENT_005_S "45" + #define PR_SNDAGENT_005 (45) + + #define TN_SNDAGENT_006 "SNDAGENT_006" + #define PR_SNDAGENT_006_S "45" + #define PR_SNDAGENT_006 (45) + + #define TN_SNDAGENT_007 "SNDAGENT_007" + #define PR_SNDAGENT_007_S "45" + #define PR_SNDAGENT_007 (45) + + #define TN_SNDAGENT_008 "SNDAGENT_008" + #define PR_SNDAGENT_008_S "45" + #define PR_SNDAGENT_008 (45) + + #define TN_SNDAGENT_009 "SNDAGENT_009" + #define PR_SNDAGENT_009_S "45" + #define PR_SNDAGENT_009 (45) + + #define TN_SNDAGENT_010 "SNDAGENT_010" + #define PR_SNDAGENT_010_S "45" + #define PR_SNDAGENT_010 (45) + + #define TN_SNDAGENT_011 "SNDAGENT_011" + #define PR_SNDAGENT_011_S "45" + #define PR_SNDAGENT_011 (45) + + #define TN_SNDAGENT_012 "SNDAGENT_012" + #define PR_SNDAGENT_012_S "45" + #define PR_SNDAGENT_012 (45) + + #define TN_SNDAGENT_013 "SNDAGENT_013" + #define PR_SNDAGENT_013_S "45" + #define PR_SNDAGENT_013 (45) + + #define TN_SNDAGENT_014 "SNDAGENT_014" + #define PR_SNDAGENT_014_S "45" + #define PR_SNDAGENT_014 (45) + + #define TN_SNDAGENT_015 "SNDAGENT_015" + #define PR_SNDAGENT_015_S "45" + #define PR_SNDAGENT_015 (45) + + #define TN_SNDAGENT_016 "SNDAGENT_016" + #define PR_SNDAGENT_016_S "45" + #define PR_SNDAGENT_016 (45) + + #define TN_SNDAGENT_017 "SNDAGENT_017" + #define PR_SNDAGENT_017_S "45" + #define PR_SNDAGENT_017 (45) + + #define TN_SNDAGENT_018 "SNDAGENT_018" + #define PR_SNDAGENT_018_S "45" + #define PR_SNDAGENT_018 (45) + + #define TN_SNDAGENT_019 "SNDAGENT_019" + #define PR_SNDAGENT_019_S "45" + #define PR_SNDAGENT_019 (45) + + #define TN_SNDAGENT_020 "SNDAGENT_020" + #define PR_SNDAGENT_020_S "45" + #define PR_SNDAGENT_020 (45) + + #define TN_SNDAGENT_021 "SNDAGENT_021" + #define PR_SNDAGENT_021_S "45" + #define PR_SNDAGENT_021 (45) + + #define TN_SNDAGENT_022 "SNDAGENT_022" + #define PR_SNDAGENT_022_S "45" + #define PR_SNDAGENT_022 (45) + + #define TN_SNDAGENT_023 "SNDAGENT_023" + #define PR_SNDAGENT_023_S "45" + #define PR_SNDAGENT_023 (45) + + #define TN_SNDAGENT_024 "SNDAGENT_024" + #define PR_SNDAGENT_024_S "45" + #define PR_SNDAGENT_024 (45) + + #define TN_SNDAGENT_025 "SNDAGENT_025" + #define PR_SNDAGENT_025_S "45" + #define PR_SNDAGENT_025 (45) + +#define MN_SS_RESOURCEMGR "SS_ResourceMgr" +#define PR_SS_RESOURCEMGR_S "49" +#define PR_SS_RESOURCEMGR (49) + + #define TN_RESOURCEHWDT "ResourceHWDT" + #define PR_RESOURCEHWDT_S "1" + #define PR_RESOURCEHWDT (1) + +#define MN_AS_AUDIOMANAGER "AS_AudioManager" +#define PR_AS_AUDIOMANAGER_S PR_TSS_S +#define PR_AS_AUDIOMANAGER PR_TSS + + #define TN_AS_SOUNDBEEP "AS_SoundBeep" + #define PR_AS_SOUNDBEEP_S PR_TSS_S + #define PR_AS_SOUNDBEEP PR_TSS + +#define MN_GRAPHICS "Graphics" +#define PR_GRAPHICS_S "4" +#define PR_GRAPHICS (4) + + #define TN_GR_MAIN_CTRL "Graphics_main" + #define PR_GR_MAIN_CTRL_S PR_TSS_S + #define PR_GR_MAIN_CTRL PR_TSS + + #define TN_GR_SEQ_CTRL "Graphics_seq" + #define PR_GR_SEQ_CTRL_S PR_TSS_S + #define PR_GR_SEQ_CTRL PR_TSS + + #define TN_GR_DEV_RCV_CTRL "Graphics_rcv" + #define PR_GR_DEV_RCV_CTRL_S PR_TSS_S + #define PR_GR_DEV_RCV_CTRL PR_TSS + + #define TN_GR_VCAP1_CTRL "Graphics_cap1" + #define PR_GR_VCAP1_CTRL_S "4" + #define PR_GR_VCAP1_CTRL (4) + + #define TN_GR_VCAP2_CTRL "Graphics_cap2" + #define PR_GR_VCAP2_CTRL_S "4" + #define PR_GR_VCAP2_CTRL (4) + +#define MN_VUPSERVICE "vupservice" +#define PR_VUPSERVICE_S PR_TSS_S +#define PR_VUPSERVICE PR_TSS + +#define MN_SS_UPDATESERVICE "UpdateService" +#define PR_SS_UPDATESERVICE_S PR_TSS_S +#define PR_SS_UPDATESERVICE PR_TSS + + #define TN_UPSERVICE_VERI "t_update_veri" + #define PR_UPSERVICE_VERI_S PR_TSS_S + #define PR_UPSERVICE_VERI PR_TSS + +#define MN_NW_MICSERVICE "NW_MicService" +#define PR_NW_MICSERVICE_S PR_TSS_S +#define PR_NW_MICSERVICE PR_TSS + +#define MN_NS_LOCKMGR "LockMgr" +#define PR_NS_LOCKMGR_S PR_TSS_S +#define PR_NS_LOCKMGR PR_TSS + +#define MN_PS_SWITCHHANDLER "SwitchHandler" +#define PR_PS_SWITCHHANDLER_S "30" +#define PR_PS_SWITCHHANDLER (30) + +#define MN_SS_WINSYS "SS_WinSys" +#define PR_SS_WINSYS_S "5" +#define PR_SS_WINSYS 5 + +#define MN_MODEMANAGER "modemanager" +#define PR_MODEMANAGER_S PR_TSS_S +#define PR_MODEMANAGER PR_TSS + +#define MN_BTSTACKMAIN "btstackmain" +#define PR_BTSTACKMAIN_S PR_TSS_S +#define PR_BTSTACKMAIN PR_TSS + +#define MN_MEDIASERVICE "MediaService" +#define PR_MEDIASERVICE_S PR_TSS_S +#define PR_MEDIASERVICE PR_TSS + +// REPRO START +#define MN_REPROSERVICE "ReproService" +#define PR_REPROSERVICE_S PR_TSS_S +#define PR_REPROSERVICE PR_TSS + + #define TN_REPROSEQUENCER "RPRS_Sequencer" + #define PR_REPROSEQUENCER_S PR_TSS_S + #define PR_REPROSEQUENCER PR_TSS + + #define TN_REPROCTRL "RPRS_Control" + #define PR_REPROCTRL_S PR_TSS_S + #define PR_REPROCTRL PR_TSS + + #define TN_REPROCENTERCOMM "RPRS_CenterComm" + #define PR_REPROCENTERCOMM_S PR_TSS_S + #define PR_REPROCENTERCOMM PR_TSS + + #define TN_REPROUNITCOMM "RPRS_UnitComm" + #define PR_REPROUNITCOMM_S PR_TSS_S + #define PR_REPROUNITCOMM PR_TSS + + #define TN_REPROWEBDAVMGR "RPRS_WebDAVMgr" + #define PR_REPROWEBDAVMGR_S PR_TSS_S + #define PR_REPROWEBDAVMGR PR_TSS + +#define MN_REPROAENDTEST "Repro_Testpro_Sender" +#define PR_REPROAENDTEST_S PR_TSS_S +#define PR_REPROAENDTEST PR_TSS + + #define TN_REPROAENDTESTTN "Repro_TestproT" + #define PR_REPROAENDTESTTN_S PR_TSS_S + #define PR_REPROAENDTESTTN PR_TSS + +#define MN_REPROBACKVUP "BackVupCtrl" +#define PR_REPROBACKVUP_S PR_TSS_S +#define PR_REPROBACKVUP PR_TSS + +#define MN_REPRODEVELOP "DevReproService" +#define PR_REPRODEVELOP_S PR_TSS_S +#define PR_REPRODEVELOP PR_TSS +// REPRO END + + #define TN_MED_MMCOM_PLAY "mmcom_play" + #define PR_MED_MMCOM_PLAY_S PR_TSS_S + #define PR_MED_MMCOM_PLAY PR_TSS + + #define TN_MED_MMCOM_MEDIA "mmcom_media" + #define PR_MED_MMCOM_MEDIA_S PR_TSS_S + #define PR_MED_MMCOM_MEDIA PR_TSS + + #define TN_MED_MMCOM_DB "mmcom_db" + #define PR_MED_MMCOM_DB_S PR_TSS_S + #define PR_MED_MMCOM_DB PR_TSS + + #define TN_MED_MMCOM_LIST "mmcom_list" + #define PR_MED_MMCOM_LIST_S PR_TSS_S + #define PR_MED_MMCOM_LIST PR_TSS + + #define TN_MED_MMCOM_DBUSB "mmcom_dbusb" + #define PR_MED_MMCOM_DBUSB_S PR_TSS_S + #define PR_MED_MMCOM_DBUSB PR_TSS + + #define TN_MED_MMCOM_DBSD "mmcom_dbsd" + #define PR_MED_MMCOM_DBSD_S PR_TSS_S + #define PR_MED_MMCOM_DBSD PR_TSS + + #define TN_MED_MMCOM_DBCD "mmcom_dbcd" + #define PR_MED_MMCOM_DBCD_S PR_TSS_S + #define PR_MED_MMCOM_DBCD PR_TSS + + #define TN_MED_MMCOM_PLAYRCV "mmcom_playrcv" + #define PR_MED_MMCOM_PLAYRCV_S PR_TSS_S + #define PR_MED_MMCOM_PLAYRCV PR_TSS + + #define TN_MED_RIPCOM_MNG "MngRipComm" + #define PR_MED_RIPCOM_MNG_S PR_TSS_S + #define PR_MED_RIPCOM_MNG PR_TSS + + #define TN_MED_RIPCOM_EXE01 "ExeRipComm01" + #define PR_MED_RIPCOM_EXE01_S PR_TSS_S + #define PR_MED_RIPCOM_EXE01 PR_TSS + + #define TN_MED_RIPCOM_EXE02 "ExeRipComm02" + #define PR_MED_RIPCOM_EXE02_S PR_TSS_S + #define PR_MED_RIPCOM_EXE02 PR_TSS + + #define TN_MED_DISCCOM_MAIN "disccom_main" + #define PR_MED_DISCCOM_MAIN_S PR_TSS_S + #define PR_MED_DISCCOM_MAIN PR_TSS + + #define TN_MED_DISCCOM_DB "disccom_db" + #define PR_MED_DISCCOM_DB_S PR_TSS_S + #define PR_MED_DISCCOM_DB PR_TSS + +#define MN_PLAYBACKSERVICE "PlaybackService" +#define PR_PLAYBACKSERVICE_S PR_TSS_S +#define PR_PLAYBACKSERVICE PR_TSS + + #define TN_PLAYSRV_AUDIO "playsrv_audio" + #define PR_PLAYSRV_AUDIO_S PR_TSS_S + #define PR_PLAYSRV_AUDIO PR_TSS + + #define TN_PLAYSRV_RIP "playsrv_rip" + #define PR_PLAYSRV_RIP_S PR_TSS_S + #define PR_PLAYSRV_RIP PR_TSS + + #define TN_PLAYSRV_PLAY "playsrv_play" + #define PR_PLAYSRV_PLAY_S PR_TSS_S + #define PR_PLAYSRV_PLAY PR_TSS + + #define TN_PLAYSRV_DISC "playsrv_disc" + #define PR_PLAYSRV_DISC_S PR_TSS_S + #define PR_PLAYSRV_DISC PR_TSS + + #define TN_PLAYSRV_ARTWORK "playsrv_artwork" + #define PR_PLAYSRV_ARTWORK_S PR_TSS_S + #define PR_PLAYSRV_ARTWORK PR_TSS + +#define MN_DISCSERVICE "DiscService" +#define PR_DISCSERVICE_S PR_TSS_S +#define PR_DISCSERVICE PR_TSS + +#define MN_RADIOSERVICE "RadioService" +#define PR_RADIOSERVICE_S PR_TSS_S +#define PR_RADIOSERVICE PR_TSS + +#define MN_RADIOHDARBITER "RadioHDArbiter" +#define PR_RADIOHDARBITER_S "20" +#define PR_RADIOHDARBITER (20) + +#define MN_HRDS_MANAGER "hrds_manager" +#define PR_HRDS_MANAGER_S PR_TSS_S +#define PR_HRDS_MANAGER PR_TSS + + #define TN_HRDS_HDMNG "hrds_hdmng" + #define PR_HRDS_HDMNG_S PR_TSS_S + #define PR_HRDS_HDMNG PR_TSS + + #define TN_HRDS_HDDEC "hrds_hddec" + #define PR_HRDS_HDDEC_S PR_TSS_S + #define PR_HRDS_HDDEC PR_TSS + + #define TN_HRDS_WEBMNG "hrds_webmng" + #define PR_HRDS_WEBMNG_S PR_TSS_S + #define PR_HRDS_WEBMNG PR_TSS + + #define TN_HRDS_WEBCOM "hrds_webcom" + #define PR_HRDS_WEBCOM_S PR_TSS_S + #define PR_HRDS_WEBCOM PR_TSS + +#define MN_BT_CONNECTIONSERVICE "BT_CnctSrv" +#define PR_BT_CONNECTIONSERVICE_S PR_TSS_S +#define PR_BT_CONNECTIONSERVICE PR_TSS + +#define MN_BT_PHONESERVICE "BT_PhoneSrv" +#define PR_BT_PHONESERVICE_S PR_TSS_S +#define PR_BT_PHONESERVICE PR_TSS + +#define MN_BT_PHONEBOOKSERVICE "BT_PbkSrv" +#define PR_BT_PHONEBOOKSERVICE_S PR_TSS_S +#define PR_BT_PHONEBOOKSERVICE PR_TSS + +#define MN_BT_MESSAGINGSERVICE "BT_MsgSrv" +#define PR_BT_MESSAGINGSERVICE_S PR_TSS_S +#define PR_BT_MESSAGINGSERVICE PR_TSS + +#define MN_BT_BLLSERVICE "TEL_BLLSrv" +#define PR_BT_BLLSERVICE_S PR_TSS_S +#define PR_BT_BLLSERVICE PR_TSS + +#define MN_BT_DCMPHONESERVICE "DCM_PhoneSrv" +#define PR_BT_DCMPHONESERVICE_S PR_TSS_S +#define PR_BT_DCMPHONESERVICE PR_TSS + + #define TN_BT_CONSRV_HFPMULTIQ1 "HFPMultiQ1" + #define PR_TN_BT_CONSRV_HFPMULTIQ1_S PR_TSS_S + #define PR_TN_BT_CONSRV_HFPMULTIQ1 PR_TSS + + #define TN_BT_CONSRV_HFPMULTIQ2 "HFPMultiQ2" + #define PR_TN_BT_CONSRV_HFPMULTIQ2_S PR_TSS_S + #define PR_TN_BT_CONSRV_HFPMULTIQ2 PR_TSS + + #define TN_BT_PBKSRV_DATABASE "BTPB_Database" + #define PR_TN_BT_PBKSRV_DATABASE_S PR_TSS_S + #define PR_TN_BT_PBKSRV_DATABASE PR_TSS + + #define TN_BT_PBKSRV_LOCALPBINST "LocalPBINST" + #define PR_TN_BT_PBKSRV_LOCALPBINST_S PR_TSS_S + #define PR_TN_BT_PBKSRV_LOCALPBINST PR_TSS + + #define TN_BT_PBKSRV_RESOLVENAME "ResolveName" + #define PR_TN_BT_PBKSRV_RESOLVENAME_S PR_TSS_S + #define PR_TN_BT_PBKSRV_RESOLVENAME PR_TSS + + #define TN_BT_PBKSRV_PBAPMULTIQ1 "PBAPMultiQ1" + #define PR_TN_BT_PBKSRV_PBAPMULTIQ1_S PR_TSS_S + #define PR_TN_BT_PBKSRV_PBAPMULTIQ1 PR_TSS + + #define TN_BT_PBKSRV_OPPMULTI "OPPMulti" + #define PR_TN_BT_PBKSRV_OPPMULTI_S PR_TSS_S + #define PR_TN_BT_PBKSRV_OPPMULTI PR_TSS + + #define TN_BT_PBKSRV_VCARDPARSER "VCardParser" + #define PR_TN_BT_PBKSRV_VCARDPARSER_S PR_TSS_S + #define PR_TN_BT_PBKSRV_VCARDPARSER PR_TSS + + #define TN_BT_MSGSRV_MSGCNTRLTHREAD0 "MsgCntrlThread0" + #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0_S PR_TSS_S + #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD0 PR_TSS + + #define TN_BT_MSGSRV_MSGCNTRLTHREAD1 "MsgCntrlThread1" + #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1_S PR_TSS_S + #define PR_TN_BT_MSGSRV_MSGCNTRLTHREAD1 PR_TSS + + #define TN_BT_MSGSRV_MAPMULTI "MapMulti" + #define PR_TN_BT_MSGSRV_MAPMULTI_S PR_TSS_S + #define PR_TN_BT_MSGSRV_MAPMULTI PR_TSS + +#define MN_DTVSERVICE "DtvService" +#define PR_DTVSERVICE_S PR_TSS_S +#define PR_DTVSERVICE PR_TSS + + #define TN_DTVTNC_TX "dtvtnc_tx" + #define PR_DTVTNC_TX_S PR_TSS_S + #define PR_DTVTNC_TX PR_TSS + + #define TN_DTVTNC_RCV "dtvtnc_rcv" + #define PR_DTVTNC_RCV_S PR_TSS_S + #define PR_DTVTNC_RCV PR_TSS + + #define TN_DTVTNC_TIMER "dtvtnc_timer" + #define PR_DTVTNC_TIMER_S PR_TSS_S + #define PR_DTVTNC_TIMER PR_TSS + + #define TN_DTVTNC_CTL "dtvtnc_ctl" + #define PR_DTVTNC_CTL_S PR_TSS_S + #define PR_DTVTNC_CTL PR_TSS + +#define MN_DTVVUPSERVICE "DtvVupService" +#define PR_DTVVUPSERVICE_S PR_TSS_S +#define PR_DTVVUPSERVICE PR_TSS + +#define MN_SETTINGSERVICE "SettingService" +#define PR_SETTINGSERVICE_S PR_TSS_S +#define PR_SETTINGSERVICE PR_TSS + +#define MN_INFOSETTINGSRV "InfoSettingSrv" +#define PR_INFOSETTINGSRV_S PR_TSS_S +#define PR_INFOSETTINGSRV PR_TSS + + #define TN_INFS_UIC "infs_uic" + #define PR_INFS_UIC_S PR_TSS_S + #define PR_INFS_UIC PR_TSS + +#define MN_DELPERSONALSRV "DelPersonalSrv" +#define PR_DELPERSONALSRV_S PR_TSS_S +#define PR_DELPERSONALSRV PR_TSS + +#define MN_MENUSERVICE "MenuService" +#define PR_MENUSERVICE_S PR_TSS_S +#define PR_MENUSERVICE PR_TSS + +#define MN_NAVIPROXY "NaviProxy" +#define PR_NAVIPROXY_S PR_TSS_S +#define PR_NAVIPROXY PR_TSS + +#define MN_AWBPROXY "AwbProxy" +#define PR_AWBPROXY_S PR_TSS_S +#define PR_AWBPROXY PR_TSS + +#define MN_TFFPROXY "TFFProxy" +#define PR_TFFPROXY_S PR_TSS_S +#define PR_TFFPROXY PR_TSS + +#define MN_TFFPROXYSLAVE "TFFProxySlave" +#define PR_TFFPROXYSLAVE_S PR_TSS_S +#define PR_TFFPROXYSLAVE PR_TSS + +#define MN_AWNPRIMARY "AwnPrimary" +#define PR_AWNPRIMARY_S PR_TSS_S +#define PR_AWNPRIMARY PR_TSS + +#define MN_AWBPRIMARY "AwbPrimary" +#define PR_AWBPRIMARY_S PR_TSS_S +#define PR_AWBPRIMARY PR_TSS + +#define MN_AWMPRIMARY "AwmPrimary" +#define PR_AWMPRIMARY_S PR_TSS_S +#define PR_AWMPRIMARY PR_TSS + +#define MN_AWTPRIMARY "AwtPrimary" +#define PR_AWTPRIMARY_S PR_TSS_S +#define PR_AWTPRIMARY PR_TSS + +#define MN_MISINKSERVICE "MisinkService" +#define PR_MISINKSERVICE_S PR_TSS_S +#define PR_MISINKSERVICE PR_TSS + +#define MN_TEXTCONVERTER "TextConverter" +#define PR_TEXTCONVERTER_S PR_TSS_S +#define PR_TEXTCONVERTER PR_TSS + +#define MN_HANDWRITING "HandWriting" +#define PR_HANDWRITING_S PR_TSS_S +#define PR_HANDWRITING PR_TSS + +#define MN_EXTUNITAUTH_D "EXTUNITAUTH_D" +#define PR_EXTUNITAUTH_D_S "29" +#define PR_EXTUNITAUTH_D 29 + + #define TN_VPSVC__CWORD84_ "VPSVC_D" + #define PR_VPSVC__CWORD84__S PR_TSS_S + #define PR_VPSVC__CWORD84_ PR_TSS + +#define MN_PROXYSERVICE "ProxyService" +#define PR_PROXYSERVICE_S PR_TSS_S +#define PR_PROXYSERVICE PR_TSS + +#define MN_FUELSERVICE "VS_FUCSrv" +#define PR_FUELSERVICE_S PR_TSS_S +#define PR_FUELSERVICE PR_TSS + +#define MN_ENERGYSERVICE "VS_ENMSrv" +#define PR_ENERGYSERVICE_S PR_TSS_S +#define PR_ENERGYSERVICE PR_TSS + +#define MN_CUSTOMIZESERVICE "VS_VSDSrv" +#define PR_CUSTOMIZESERVICE_S PR_TSS_S +#define PR_CUSTOMIZESERVICE PR_TSS + +#define MN_DMSSERVICE "VS_DMSSrv" +#define PR_DMSSERVICE_S PR_TSS_S +#define PR_DMSSERVICE PR_TSS + +#define MN_AIRCONSERVICE "VS_ACNSrv" +#define PR_AIRCONSERVICE_S PR_TSS_S +#define PR_AIRCONSERVICE PR_TSS + +#define MN_SEATSERVICE "VS_NMSSrv" +#define PR_SEATSERVICE_S PR_TSS_S +#define PR_SEATSERVICE PR_TSS + +#define MN_CAMERASERVICE "VS_CMRSrv" +#define PR_CAMERASERVICE_S PR_TSS_S +#define PR_CAMERASERVICE PR_TSS + + #define TN_CAMERAQUICKRVC "QuickRVCThread" + #define PR_CAMERAQUICKRVC_S PR_TSS_S + #define PR_CAMERAQUICKRVC PR_TSS + +#define MN_METSERVICE "VS_METSrv" +#define PR_METSERVICE_S PR_TSS_S +#define PR_METSERVICE PR_TSS + +#define MN_TMCSERVICE "VS_TMCSrv" +#define PR_TMCSERVICE_S PR_TSS_S +#define PR_TMCSERVICE PR_TSS + +#define MN_DASSERVICE "VS_DASSrv" +#define PR_DASSERVICE_S PR_TSS_S +#define PR_DASSERVICE PR_TSS + +#define MN_EXTUNITAUTH_M "EXTUNITAUTH_M" +#define PR_EXTUNITAUTH_M_S "29" +#define PR_EXTUNITAUTH_M 29 + +#define MN_DUMMYREAD "DummyRead" +#define PR_DUMMYREAD_S PR_TSS_S +#define PR_DUMMYREAD PR_TSS + +#define MN_SSTSERVICE "storage_access" +#define PR_SSTSERVICE_S PR_TSS_S +#define PR_SSTSERVICE PR_TSS + +#define MN_CCSAUDITD "ccs-auditd" +#define PR_CCSAUDITD_S PR_TSS_S +#define PR_CCSAUDITD PR_TSS + +//exec from task manager +#define MN_ACTIVITYMANAGER "ActivityManager" +#define PR_ACTIVITYMANAGER_S PR_TSS_S +#define PR_ACTIVITYMANAGER PR_TSS + +#define MN_RESIDENT_SVC "RESIDENT_SVC" +#define PR_RESIDENT_SVC_S PR_TSS_S +#define PR_RESIDENT_SVC PR_TSS + +#define MN_TRANSIENT_SVC "TRANSIENT_SVC" +#define PR_TRANSIENT_SVC_S PR_TSS_S +#define PR_TRANSIENT_SVC PR_TSS + +#define MN_WLANSERVICE "wlan_ctrl_0700" +#define PR_WLANSERVICE_S PR_TSS_S +#define PR_WLANSERVICE PR_TSS + +#define MN_WLANEVTTHR "WlanEvtThr" +#define PR_WLANEVTTHR_S PR_TSS_S +#define PR_WLANEVTTHR PR_TSS + +#define MN_WLANMIDDLESERVICE "WlanMiddle" +#define PR_WLANMIDDLESERVICE_S PR_TSS_S +#define PR_WLANMIDDLESERVICE PR_TSS + + #define TN_WLANMIDDLESERVICE0 "WM_MsgCtrlTh0" + #define PR_WLANMIDDLESERVICE0_S PR_TSS_S + #define PR_WLANMIDDLESERVICE0 PR_TSS + + #define TN_WLANMIDDLESERVICE1 "WM_MsgCtrlTh1" + #define PR_WLANMIDDLESERVICE1_S PR_TSS_S + #define PR_WLANMIDDLESERVICE1 PR_TSS + + #define TN_WLANMIDDLESERVICE2 "WM_MsgCtrlTh2" + #define PR_WLANMIDDLESERVICE2_S PR_TSS_S + #define PR_WLANMIDDLESERVICE2 PR_TSS + +#define MN_WLANSERVICE2 "wlan_ctrl_0701" +#define PR_WLANSERVICE2_S PR_TSS_S +#define PR_WLANSERVICE2 PR_TSS + +#define MN_WLANEVTTHR2 "WlanEvtThr2" +#define PR_WLANEVTTHR2_S PR_TSS_S +#define PR_WLANEVTTHR2 PR_TSS + +//exec from task manager, Test for vup +#define MN_PS__CWORD52_VUP "_CWORD52_vup" +#define PR_PS__CWORD52_VUP_S PR_TSS_S +#define PR_PS__CWORD52_VUP PR_TSS + +#define MN_PS_SYSVUP "sysvup" +#define PR_PS_SYSVUP_S PR_TSS_S +#define PR_PS_SYSVUP PR_TSS + +#define MN_SS_ROOTFSVUP "rootfsvup" +#define PR_SS_ROOTFSVUP_S PR_TSS_S +#define PR_SS_ROOTFSVUP PR_TSS + +#define MN_SS_VUPPROGUI "vupprogressui" +#define PR_SS_VUPPROGUI_S PR_TSS_S +#define PR_SS_VUPPROGUI PR_TSS + +#define MN_SS_NORVUP "norvup" +#define PR_SS_NORVUP_S PR_TSS_S +#define PR_SS_NORVUP PR_TSS + +// OUTER_UPDATE START +#define MN_XMVUPSERVICE "radio_xm_update" +#define PR_XMVUPSERVICE_S PR_TSS_S +#define PR_XMVUPSERVICE PR_TSS +// OUTER_UPDATE END + +#define MN_BTPHONESRV "BT_PhoneSrv" +#define PR_BTPHONESRV_S PR_TSS_S +#define PR_BTPHONESRV PR_TSS + +#define MN_BTPBKSRV "BT_PbkSrv" +#define PR_BTPBKSRV_S PR_TSS_S +#define PR_BTPBKSRV PR_TSS + +#define MN_BTMSGSRV "BT_MsgSrv" +#define PR_BTMSGSRV_S PR_TSS_S +#define PR_BTMSGSRV PR_TSS + +// NON-resident, exec from task manager, Repro update +#define MN_PS_SYSUPDATE "sysupdate" +#define PR_PS_SYSUPDATE_S PR_TSS_S +#define PR_PS_SYSUPDATE PR_TSS + +#define MN_SS_NANDUPDATE "nandupdate" +#define PR_SS_NANDUPDATE_S PR_TSS_S +#define PR_SS_NANDUPDATE PR_TSS + + #define TN_NANDUPDATE_CLD "t_nandcld" + #define PR_NANDUPDATE_CLD_S PR_TSS_S + #define PR_NANDUPDATE_CLD PR_TSS + +#define MN_BTPHONESRV "BT_PhoneSrv" +#define PR_BTPHONESRV_S PR_TSS_S +#define PR_BTPHONESRV PR_TSS + +#define MN_BTPBKSRV "BT_PbkSrv" +#define PR_BTPBKSRV_S PR_TSS_S +#define PR_BTPBKSRV PR_TSS + +#define MN_BTMSGSRV "BT_MsgSrv" +#define PR_BTMSGSRV_S PR_TSS_S +#define PR_BTMSGSRV PR_TSS + +//exec from diag +#define MN_DIAGSERVICE "DiagService" +#define PR_DIAGSERVICE_S PR_TSS_S +#define PR_DIAGSERVICE PR_TSS + +#define MN_DIAGWORKERTSK "diagworker_tsk" +#define PR_DIAGWORKERTSK_S PR_TSS_S +#define PR_DIAGWORKERTSK PR_TSS + +#define MN_DIAGTSK "diag_tsk" +#define PR_DIAGTSK_S PR_TSS_S +#define PR_DIAGTSK PR_TSS + +#define MN_DIAGMCTSK "diagmc_tsk" +#define PR_DIAGMCTSK_S PR_TSS_S +#define PR_DIAGMCTSK PR_TSS + +#define MN_DIAGUTCOL "diagutCol_tsk" +#define PR_DIAGUTCOL_S PR_TSS_S +#define PR_DIAGUTCOL PR_TSS + +#define MN_DIAGUTUPD "diagutUpd_tsk" +#define PR_DIAGUTUPD_S PR_TSS_S +#define PR_DIAGUTUPD PR_TSS + +//exec from Connectivity for _CWORD57_ +#define MN__CWORD57_UTILSERVICE "_CWORD57_UtilService" +#define PR__CWORD57_UTILSERVICE_S PR_TSS_S +#define PR__CWORD57_UTILSERVICE PR_TSS + + #define TN_CON_IPUT_DETECT "iputsrv_detect" + #define PR_CON_IPUT_DETECT_S PR_TSS_S + #define PR_CON_IPUT_DETECT PR_TSS + + #define TN_CON_IPUT_AUTH "iputsrv_auth" + #define PR_CON_IPUT_AUTH_S PR_TSS_S + #define PR_CON_IPUT_AUTH PR_TSS + + #define TN_CON_IPUT_SERIAL "iputsrv_serial" + #define PR_CON_IPUT_SERIAL_S PR_TSS_S + #define PR_CON_IPUT_SERIAL PR_TSS + + #define TN_CON_IPUT_USB_1 "iputsrv_usb1" + #define PR_CON_IPUT_USB_1_S PR_TSS_S + #define PR_CON_IPUT_USB_1 PR_TSS + + #define TN_CON_IPUT_USB_2 "iputsrv_usb2" + #define PR_CON_IPUT_USB_2_S PR_TSS_S + #define PR_CON_IPUT_USB_2 PR_TSS + + #define TN_CON_IPUT_SPP "iputsrv_spp" + #define PR_CON_IPUT_SPP_S PR_TSS_S + #define PR_CON_IPUT_SPP PR_TSS + +#define MN__CWORD57_DTSERVICE "_CWORD57_DTService" +#define PR__CWORD57_DTSERVICE_S PR_TSS_S +#define PR__CWORD57_DTSERVICE PR_TSS + + #define TN_CON_IPDT_SERIAL "ipdtsrv_serial" + #define PR_CON_IPDT_SERIAL_S PR_TSS_S + #define PR_CON_IPDT_SERIAL PR_TSS + + #define TN_CON_IPDT_USB_1 "ipdtsrv_usb1" + #define PR_CON_IPDT_USB_1_S PR_TSS_S + #define PR_CON_IPDT_USB_1 PR_TSS + + #define TN_CON_IPDT_USB_2 "ipdtsrv_usb2" + #define PR_CON_IPDT_USB_2_S PR_TSS_S + #define PR_CON_IPDT_USB_2 PR_TSS + + #define TN_CON_IPDT_SPP "ipdtsrv_spp" + #define PR_CON_IPDT_SPP_S PR_TSS_S + #define PR_CON_IPDT_SPP PR_TSS + +#define MN_WEBDAVMGR "webdavmgr" +#define PR_WEBDAVMGR_S PR_TSS_S +#define PR_WEBDAVMGR PR_TSS + +#define MN_DISPLAYSERVICE "DisplayService" +#define PR_DISPLAYSERVICE_S PR_TSS_S +#define PR_DISPLAYSERVICE PR_TSS + +#define MN_ENFORMSERVICE "EnformService" +#define PR_ENFORMSERVICE_S PR_TSS_S +#define PR_ENFORMSERVICE PR_TSS + +#define MN_CONNUTIL "ConnUtil" +#define PR_CONNUTIL_S PR_TSS_S +#define PR_CONNUTIL PR_TSS + +#define MN_CONNUTILSLAVE "ConnUtilSlave" +#define PR_CONNUTILSLAVE_S PR_TSS_S +#define PR_CONNUTILSLAVE PR_TSS + +#define MN_CONNMGR "ConnMgr" +#define PR_CONNMGR_S PR_TSS_S +#define PR_CONNMGR PR_TSS + +#define MN_SERVICEFLAGMGR "ServiceFlagMgr" +#define PR_SERVICEFLAGMGR_S PR_TSS_S +#define PR_SERVICEFLAGMGR PR_TSS + +//exec from VR +#define MN_VRMANAGER "vrmanager" +#define PR_VRMANAGER_S PR_TSS_S +#define PR_VRMANAGER PR_TSS + + #define TN_VR_WORKER "VrWorkerThread" + #define PR_VR_WORKER_S PR_TSS_S + #define PR_VR_WORKER PR_TSS + + #define TN_VBT_PROPDISPATCH "PropDispatchThread" + #define PR_VBT_PROPDISPATCH_S PR_TSS_S + #define PR_VBT_PROPDISPATCH PR_TSS + + #define TN_VBT_PROPRESPONSE "PropResponseThread" + #define PR_VBT_PROPRESPONSE_S PR_TSS_S + #define PR_VBT_PROPRESPONSE PR_TSS + + #define TN_VBT_PROPAUDIOPLAY "PropAudioPlayThread" + #define PR_VBT_PROPAUDIOPLAY_S PR_TSS_S + #define PR_VBT_PROPAUDIOPLAY PR_TSS + + #define TN_VBT_PROPAUDIORECORD "PropAudioRecordThread" + #define PR_VBT_PROPAUDIORECORD_S PR_TSS_S + #define PR_VBT_PROPAUDIORECORD PR_TSS + + #define TN_VBT_MAINTHREADPRIO "MainThreadPriority" + #define PR_VBT_MAINTHREADPRIO_S PR_TSS_S + #define PR_VBT_MAINTHREADPRIO PR_TSS + + #define TN_VBT_ASRMANAGERGRAMMAR "AsrManagerGrammarGenerationThread" + #define PR_VBT_ASRMANAGERGRAMMAR_S PR_TSS_S + #define PR_VBT_ASRMANAGERGRAMMAR PR_TSS + + #define TN_VBT_ASRVOCONRECO "AsrVoconRecoProcessThread" + #define PR_VBT_ASRVOCONRECO_S PR_TSS_S + #define PR_VBT_ASRVOCONRECO PR_TSS + + #define TN_VBT_BROADCASTREAD "BroadCastReadThread" + #define PR_VBT_BROADCASTREAD_S PR_TSS_S + #define PR_VBT_BROADCASTREAD PR_TSS + + #define TN_VBT_FILEAGGREGATOR "FileAggregatorDecompressThread" + #define PR_VBT_FILEAGGREGATOR_S PR_TSS_S + #define PR_VBT_FILEAGGREGATOR PR_TSS + + #define TN_VBT_HTTPCURLREQUEST "HttpCurlRequestThread" + #define PR_VBT_HTTPCURLREQUEST_S PR_TSS_S + #define PR_VBT_HTTPCURLREQUEST PR_TSS + + #define TN_VBT_HTTPDRIVERREQUEST "HttpDriverRequestThread" + #define PR_VBT_HTTPDRIVERREQUEST_S PR_TSS_S + #define PR_VBT_HTTPDRIVERREQUEST PR_TSS + + #define TN_VBT_HTTPREQUESTSESSION "HttpRequestSessionStateThread" + #define PR_VBT_HTTPREQUESTSESSION_S PR_TSS_S + #define PR_VBT_HTTPREQUESTSESSION PR_TSS + + #define TN_VBT_PLAYMGRSTOPASYNC "PlayMgrStopAsyncStreamThread" + #define PR_VBT_PLAYMGRSTOPASYNC_S PR_TSS_S + #define PR_VBT_PLAYMGRSTOPASYNC PR_TSS + + #define TN_VBT_RESOURCEMGRQUEUE "ResourceMgrQueueHandlerThread" + #define PR_VBT_RESOURCEMGRQUEUE_S PR_TSS_S + #define PR_VBT_RESOURCEMGRQUEUE PR_TSS + + #define TN_VBT_SMURFDRIVERTIMEOUT "SmurfDriverTimeoutThread" + #define PR_VBT_SMURFDRIVERTIMEOUT_S PR_TSS_S + #define PR_VBT_SMURFDRIVERTIMEOUT PR_TSS + + #define TN_NVR_NVRMAIN "NvrMainThread" + #define PR_NVR_NVRMAIN_S PR_TSS_S + #define PR_NVR_NVRMAIN PR_TSS + + #define TN_NVR_NVRRECO "NvrRecoThread" + #define PR_NVR_NVRRECO_S PR_TSS_S + #define PR_NVR_NVRRECO PR_TSS + + #define TN_NVR_NVRDICT "NvrDictThread" + #define PR_NVR_NVRDICT_S PR_TSS_S + #define PR_NVR_NVRDICT PR_TSS + + #define TN_NVR_NVRENC "NvrEncThread" + #define PR_NVR_NVRENC_S PR_TSS_S + #define PR_NVR_NVRENC PR_TSS + +//exec from VehicleInfo +#define MN_VEHICLEINFOSERVICE "VehicleInfoSrv" +#define PR_VEHICLEINFOSERVICE_S PR_TSS_S +#define PR_VEHICLEINFOSERVICE PR_TSS + +//exec from _CWORD76_ +#define MN__CWORD76_SERVICE "_CWORD76_Service" +#define PR__CWORD76_SERVICE_S PR_TSS_S +#define PR__CWORD76_SERVICE PR_TSS + + #define TN_APPDOWNLOADER "AppDownloader" + #define PR_APPDOWNLOADER_S PR_TSS_S + #define PR_APPDOWNLOADER PR_TSS + +//exec from _CWORD76_(_CWORD58_) +#define MN__CWORD58_SERVICE "_CWORD58_Service" +#define PR__CWORD58_SERVICE_S PR_TSS_S +#define PR__CWORD58_SERVICE PR_TSS + +#define MN__CWORD8_SRV "_CWORD8_Srv" +#define PR__CWORD8_SRV_S PR_TSS_S +#define PR__CWORD8_SRV PR_TSS + +#define MN_SPCSERVICE "SPCService" +#define PR_SPCSERVICE_S PR_TSS_S +#define PR_SPCSERVICE PR_TSS + +#define MN_LOCALSERVERPROXY "LSP" +#define PR_LOCALSERVERPROXY_S PR_TSS_S +#define PR_LOCALSERVERPROXY PR_TSS + +#define MN_EOMSERVICE "eOMService" +#define PR_EOMSERVICE_S PR_TSS_S +#define PR_EOMSERVICE PR_TSS + +//exec from NetworkManager +#define MN_NETWORKMANAGER "NetworkManager" +#define PR_NETWORKMANAGER_S PR_TSS_S +#define PR_NETWORKMANAGER PR_TSS + + #define TN_NWM_TH_CMDRCV "NWM_Th_CmdRcv" + #define PR_NWM_TH_CMDRCV_S PR_TSS_S + #define PR_NWM_TH_CMDRCV PR_TSS + + #define TN_NWM_TH_PROCMGR "NWM_Th_ProcMgr" + #define PR_NWM_TH_PROCMGR_S PR_TSS_S + #define PR_NWM_TH_PROCMGR PR_TSS + + #define TN_NWM_TH_CMDPROC "NWM_Th_CmdProc" + #define PR_NWM_TH_CMDPROC_S PR_TSS_S + #define PR_NWM_TH_CMDPROC PR_TSS + + #define TN_NWM_TH_DNSMGR "NWM_Th_DnsMgr" + #define PR_NWM_TH_DNSMGR_S PR_TSS_S + #define PR_NWM_TH_DNSMGR PR_TSS + + #define TN_NWM_TH_DHCPD "NWM_Th_Dhcpd" + #define PR_NWM_TH_DHCPD_S PR_TSS_S + #define PR_NWM_TH_DHCPD PR_TSS + +// DCM Service +#define MN_DCMSERVICE "DCMService" +#define PR_DCMSERVICE_S PR_TSS_S +#define PR_DCMSERVICE PR_TSS + + #define TN_DCM_TH_CMDRCV "DCM_Th_CmdRcv" + #define PR_DCM_TH_CMDRCV_S PR_TSS_S + #define PR_DCM_TH_CMDRCV PR_TSS + + #define TN_DCM_TH_MSGRCV "DCM_Th_MsgRcv" + #define PR_DCM_TH_MSGRCV_S PR_TSS_S + #define PR_DCM_TH_MSGRCV PR_TSS + + #define TN_DCM_TH_TIMER "DCM_Th_Timer" + #define PR_DCM_TH_TIMER_S PR_TSS_S + #define PR_DCM_TH_TIMER PR_TSS + +// HELP Service +#define MN_HELPSERVICE "HELPService" +#define PR_HELPSERVICE_S PR_TSS_S +#define PR_HELPSERVICE PR_TSS + +//exec from RemoteService +#define MN_REMOTESERVICE "RemoteService" +#define PR_REMOTESERVICE_S PR_TSS_S +#define PR_REMOTESERVICE PR_TSS + + #define TN_RS_TH_CANCTRL "RS_Th_CANCtrl" + #define PR_RS_TH_CANCTRL_S PR_TSS_S + #define PR_RS_TH_CANCTRL PR_TSS + + #define TN_RS_TH_DISPCTRL "RS_Th_DispCtrl" + #define PR_RS_TH_DISPCTRL_S PR_TSS_S + #define PR_RS_TH_DISPCTRL PR_TSS + + #define TN_RS_TH_PARTSCTRL "RS_Th_PartsCtrl" + #define PR_RS_TH_PARTSCTRL_S PR_TSS_S + #define PR_RS_TH_PARTSCTRL PR_TSS + + #define TN_RS_TH_HTTPPROC "RS_Th_HttpProc" + #define PR_RS_TH_HTTPPROC_S PR_TSS_S + #define PR_RS_TH_HTTPPROC PR_TSS + +//exec from VR +#define MN_CONTENTSMGR "contentsmgr" +#define PR_CONTENTSMGR_S PR_TSS_S +#define PR_CONTENTSMGR PR_TSS + + #define TN_CDB_CONTENDB "contendbThread" + #define PR_CDB_CONTENDB_S PR_TSS_S + #define PR_CDB_CONTENDB PR_TSS + +/* COMARB Service */ +#define MN_NW_COMARB "ComArbService" +#define PR_NW_COMARB_S PR_TSS_S +#define PR_NW_COMARB PR_TSS + +/* ASND_FRthread */ +#define MN_ASND_FRTH "ASND_FRthread" +#define PR_ASND_FRTH_S PR_SND_VCETRFCTRL_S +#define PR_ASND_FRTH PR_SND_VCETRFCTRL + +/* MLINK Service */ +#define MN_MLINKSERVICE "MlinkService" +#define PR_MLINKSERVICE_S PR_TSS_S +#define PR_MLINKSERVICE PR_TSS + +#define MN__CWORD74_SERVICE "_CWORD74_Service" +#define PR__CWORD74_SERVICE_S PR_TSS_S +#define PR__CWORD74_SERVICE PR_TSS +#endif //__AGL_THREAD_H__ diff --git a/service/system/task_manager/client/libtskmcfg/conf/tskm_launch.xml b/service/system/task_manager/client/libtskmcfg/conf/tskm_launch.xml new file mode 100755 index 0000000..d4ab06c --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/conf/tskm_launch.xml @@ -0,0 +1,106 @@ +<service_list> + <service + svcid="TSKM_SVCID_ACTIVITYMGR" + name=MN_ACTIVITYMANAGER + path="/usr/agl/bin/acmsrv" + prio=PR_ACTIVITYMANAGER_S + policy="tss" + life_cycle="always" + user="" + shutdown_wait="yes" /> + + <service + svcid="TSKM_SVCID_TE_RESIDENT" + name=MN_RESIDENT_SVC + path="/usr/agl/bin/resident" + prio=PR_RESIDENT_SVC_S + policy="tss" + life_cycle="always" + user="" + shutdown_wait="no" /> + + <service + svcid="TSKM_SVCID_TE_TRANSIENT" + name =MN_TRANSIENT_SVC + path="/usr/agl/bin/transient" + prio=PR_TRANSIENT_SVC_S + policy="tss" + user="" + shutdown_wait="no" /> + + + <service + svcid="TSKM_SVCID__CWORD58_" + name =MN__CWORD58_SERVICE + path="/usr/agl/bin/_CWORD58_Service" + prio=PR__CWORD58_SERVICE_S + policy="tss" + retry_cnt="-1" + user="" + shutdown_wait="yes" /> + + <service + svcid="TSKM_SVCID_SYSUPDATE" + name =MN_PS_SYSUPDATE + path="/usr/bin/sysupdate" + prio=PR_PS_SYSUPDATE_S + policy="tss" + user="" + shutdown_wait="no" /> + + <service + svcid="TSKM_SVCID_NANDUPDATE" + name =MN_SS_NANDUPDATE + path="/usr/bin/nandupdate" + prio=PR_SS_NANDUPDATE_S + policy="tss" + user="" + shutdown_wait="no" /> + + <service + svcid="TSKM_SVCID_XMVUPSRV" + name =MN_XMVUPSERVICE + path="/usr/agl/bin/radio_xm_update" + prio=PR_XMVUPSERVICE_S + policy="tss" + user="" + shutdown_wait="no" /> + + <service + svcid="TSKM_SVCID_BTPHONESRV" + name =MN_BTPHONESRV + path="/usr/agl/bin/BT_PhoneSrv" + prio=PR_BTPHONESRV_S + policy="tss" + user="" + shutdown_wait="no" /> + + <service + svcid="TSKM_SVCID_BTPBKSRV" + name =MN_BTPBKSRV + path="/usr/agl/bin/BT_PbkSrv" + prio=PR_BTPBKSRV_S + policy="tss" + user="" + shutdown_wait="no" /> + + <service + svcid="TSKM_SVCID_BTMSGSRV" + name =MN_BTMSGSRV + path="/usr/agl/bin/BT_MsgSrv" + prio=PR_BTMSGSRV_S + policy="tss" + user="" + shutdown_wait="no" /> + + <service + svcid="TSKM_SVCID_DTVVUPSRV" + name =MN_DTVVUPSERVICE + path="/usr/agl/bin/DtvVupService" + prio=PR_DTVVUPSERVICE_S + policy="tss" + user="" + shutdown_wait="no" /> + +</service_list> + diff --git a/service/system/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml b/service/system/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml new file mode 100755 index 0000000..4f724f7 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/conf/tskm_shutdown.xml @@ -0,0 +1,11 @@ +<normal_shutdown> + <global_step> + <request_list> + <request svcid="TSKM_SVCID_TE_RESIDENT" local_step="last" /> + <!-- <request svcid="TSKM_SVCID_ACTIVITYMGR" local_step="last" /> --> + </request_list> + + <next_trans_condition cond="INI_TERMCOMP_TRANSIENT" /> + </global_step> +</normal_shutdown> + diff --git a/service/system/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml b/service/system/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml new file mode 100755 index 0000000..71a30c8 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/conf/tskm_shutdown_vup.xml @@ -0,0 +1,6 @@ +<vup_shutdown> + <global_step> + <next_trans_condition cond="INI_TERMCOMP_TRANSIENT" /> + </global_step> +</vup_shutdown> + diff --git a/service/system/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml b/service/system/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml new file mode 100755 index 0000000..aeb3548 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/conf/tskm_wakeup.xml @@ -0,0 +1,8 @@ +<normal_wakeup> + <global_step> + <next_trans_condition cond="INI_INITCOMP_ON_START" /> + </global_step> + <global_step> + <next_trans_condition cond="INI_INITCOMP_NVM_ACCESS" /> + </global_step> +</normal_wakeup> diff --git a/service/system/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml b/service/system/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml new file mode 100755 index 0000000..7162fdf --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/conf/tskm_wakeup_vup.xml @@ -0,0 +1,5 @@ +<vup_wakeup> + <global_step> + <next_trans_condition cond="INI_INITCOMP_NVM_ACCESS" /> + </global_step> +</vup_wakeup> diff --git a/service/system/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h b/service/system/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h new file mode 100755 index 0000000..c042fc8 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/include/system_service/task_manager_libtskmcfg.h @@ -0,0 +1,40 @@ +/* + * @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_libtskmcfg.h + * @brief \~english This file include tskm_svcid.h file and tskm_xml_data.h file + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup task_manager + * @ingroup system_service + * @{ + */ +#ifndef SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_ // NOLINT(build/header_guard) +#define SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_ + +#include "system_service/tskm_svcid.h" +#include "system_service/tskm_xml_data.h" + +#endif // SYSTEMSERVICE_TASKMNAGERLIBTASKMCFG_H_ +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h b/service/system/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.h new file mode 100755 index 0000000..d8f3e3d --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/include/system_service/tskm_svcid.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. + */ +/** + * @file tskm_svcid.h + * @brief \~english This file contains declaration of TSKM_SVC ID + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup task_manager + * @ingroup system_service + * @{ + */ +/* + * Service ID + */ +#ifndef TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_ +#define TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_ + + +#define TSKM_SVCID_NONE 0x00000000U +#define TSKM_SVCID_TE_RESIDENT 0x00000001U // for test +#define TSKM_SVCID_TE_TRANSIENT 0x00000002U // for test +#define TSKM_SVCID_ACTIVITYMGR 0x00000003U +#define TSKM_SVCID_SYSVUP 0x00000004U // for vup +#define TSKM_SVCID__CWORD52_VUP 0x00000005U // for vup +#define TSKM_SVCID_ROOTFSVUP 0x00000006U // for vup +#define TSKM_SVCID_VUPPROGUI 0x00000007U // for vup +#define TSKM_SVCID_NORVUP 0x00000008U // for vup +#define TSKM_SVCID__CWORD58_ 0x00000009U // for _CWORD76_ +#define TSKM_SVCID_SYSUPDATE 0x0000000AU // for repro vup +#define TSKM_SVCID_NANDUPDATE 0x0000000BU // for repro vup +#define TSKM_SVCID_BTPHONESRV 0x0000000CU +#define TSKM_SVCID_BTPBKSRV 0x0000000DU +#define TSKM_SVCID_BTMSGSRV 0x0000000EU +#define TSKM_SVCID_DTVVUPSRV 0x0000000FU // fot peaks vup +#define TSKM_SVCID_XMVUPSRV 0x00000020U // fot XM_outer_update vup + +#endif // TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_SVCID_H_ +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h b/service/system/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h new file mode 100755 index 0000000..0c8b75b --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/include/system_service/tskm_xml_data.h @@ -0,0 +1,173 @@ +/* + * @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_xml_data.h + * @brief \~english This file provide api to operating task manager with XML data + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup task_manager + * @ingroup system_service + * @{ + */ +#ifndef TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_ +#define TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_ + +#include "system_service/tskm_type.h" +#include "system_service/tskm_svc.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup tskm_initServiceList + /// \~english @par Summary + /// init started services list + /// \~english @param [out] p_svcs + /// p_svcs - pointer of service list + /// \~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] iFd + /// iFd - the file descriptor return by inotify_init1(). + /// \~english @par + /// p_svcs int + /// \~english @retval 0 Success + /// \~english @retval -1 Failed + /// \~english @par Preconditions + /// - called in the ctxCreate() + /// \~english @par Change of the internal state + /// - The internal state is not changed. + /// \~english @par Causes of failures + /// - if srvId in serviceList greater than TSKM_SVC_ID_MAX_SIZE. [-1] + /// \~english @par Classification + /// - public + /// \~english @par Type + /// - sync only + /// \~english @par Detail + /// Init started services list\n + /// Get the started services list from static variable serviceList and init by input parameter iFd\n + /// If envirment is NFS, change the path after /tmp to CAP path.\n + /// + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// +int tskm_initServiceList(TSKM_SVCS_CTX_t* p_svcs, int iFd); + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup tskm_initWakeupCtx + /// \~english @par Summary + /// Get state of started step. + /// \~english @param [out] p_wakeup + /// p_wakeup - pointer of TSKM_GSTEP_CTX_t + /// \~english @par + /// p_wakeup TSKM_GSTEP_CTX_t* + /// \~english @code + /// typedef struct { + /// uint32_t gstepIdx; // step Index + /// uint32_t gstepNum; // number of step + /// TSKM_GSTEP_t* gstep; // step start/stop info + /// uint64_t compState; + /// } TSKM_GSTEP_CTX_t; + /// @endcode + /// \~english @param [in] isVupMode + /// isVupMode - version up flag + /// \~english @par + /// isVupMode BOOL + /// TRUE version up mode + /// FALSE not versoin up mode + /// \~english @retval void + /// + /// \~english @par Preconditions + /// - called in ctxCreate() + /// \~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 + /// - sync only + /// \~english @par Detail + /// Get state of started step.\n + /// if version up mode is TRUE, retrun the wakeupGstepVup.\n + /// if version up mode is FALSE, return the wakeupGstep.\n + /// + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// +void tskm_initWakeupCtx(TSKM_GSTEP_CTX_t* p_wakeup, BOOL isVupMode); + + + ///////////////////////////////////////////////////////////////////////////////////// + /// \ingroup tskm_initDownCtx + /// \~english @par Summary + /// Get state of down step. + /// \~english @param [out] p_down + /// p_down - pointer of TSKM_GSTEP_CTX_t + /// \~english @par + /// p_wakeup TSKM_GSTEP_CTX_t* + /// \~english @code + /// typedef struct { + /// uint32_t gstepIdx; // step Index + /// uint32_t gstepNum; // number of step + /// TSKM_GSTEP_t* gstep; // step start/stop info + /// uint64_t compState; + /// } TSKM_GSTEP_CTX_t; + /// @endcode + /// \~english @param [in] isVupMode + /// isVupMode - version up mode flag + /// \~english @par + /// isVupMode BOOL + /// TRUE version up mode + /// FALSE not versoin up mode + /// \~english @retval + /// \~english @par Preconditions + /// - called in ctxCreate(). + /// \~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 + /// - sync only + /// \~english @par Detail + /// Get state of down step.\n + /// if version up mode is TRUE, retrun the downGstepVup.\n + /// if version up mode is FALSE, return the downGstep.\n + /// \~english @see None + //////////////////////////////////////////////////////////////////////////////////// +void tskm_initDownCtx(TSKM_GSTEP_CTX_t* p_down, BOOL isVupMode); + +#ifdef __cplusplus +} +#endif + +#endif // TASK_MANAGER_CLIENT_LIBTSKMCFG_INCLUDE_SYSTEM_SERVICE_TSKM_XML_DATA_H_ +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/task_manager/client/libtskmcfg/libtskmcfg.ver b/service/system/task_manager/client/libtskmcfg/libtskmcfg.ver new file mode 100755 index 0000000..c7bb97b --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/libtskmcfg.ver @@ -0,0 +1,21 @@ +/* + * @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. + */ + +{ + global: + tskm_init*; + local: *; +}; diff --git a/service/system/task_manager/client/libtskmcfg/src/parsexml.c b/service/system/task_manager/client/libtskmcfg/src/parsexml.c new file mode 100755 index 0000000..7cb3929 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/src/parsexml.c @@ -0,0 +1,879 @@ +/* + * @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. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <libgen.h> + +#include <expat.h> + +#define BUFSIZE 4096 +#define OUTFILE "tskm_auto_build.h" +#define TMPFILE "parsexml.tmp" + +typedef uint32_t ELE_STATE_t; +#define ELE_NONE 0x00000000U +#define ELE_TSKM_CFG 0x10000000U +#define ELE_SERVICE_LIST 0x11000000U +#define ELE_SERVICE 0x11100000U +#define ELE_SUBGID_LIST 0x11110000U + +#define ELE_COMMON_GSTEP 0x00100000U +#define ELE_COMMON_EXEC 0x00010000U +#define ELE_COMMON_REQ 0x00020000U + +#define ELE_NORMAL_WAKEUP 0x12000000U +#define ELE_NORMAL_W_GSTEP (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP) +#define ELE_NORMAL_W_EXEC (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_EXEC) +#define ELE_NORMAL_W_REQ (ELE_NORMAL_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_REQ) + +#define ELE_NORMAL_SHUTDOWN 0x13000000U +#define ELE_NORMAL_D_GSTEP (ELE_NORMAL_SHUTDOWN|ELE_COMMON_GSTEP) +#define ELE_NORMAL_D_REQ (ELE_NORMAL_SHUTDOWN|ELE_COMMON_GSTEP|ELE_COMMON_REQ) + +#define ELE_VUP_WAKEUP 0x14000000U +#define ELE_VUP_W_GSTEP (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP) +#define ELE_VUP_W_EXEC (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_EXEC) +#define ELE_VUP_W_REQ (ELE_VUP_WAKEUP|ELE_COMMON_GSTEP|ELE_COMMON_REQ) + +#define ELE_VUP_SHUTDOWN 0x15000000U +#define ELE_VUP_D_GSTEP (ELE_VUP_SHUTDOWN|ELE_COMMON_GSTEP) +#define ELE_VUP_D_REQ (ELE_VUP_SHUTDOWN|ELE_COMMON_GSTEP|ELE_COMMON_REQ) + + +#define ELE_MASK0 0xF0000000U +#define ELE_MASK1 0x0F000000U +#define ELE_MASK2 0x00F00000U +#define ELE_MASK3 0x000F0000U + +#define PARSE_ASSERT_EXIT(x) \ + if(!(x)){ \ + printf("ASSERT %s:%s:%d\n",__FILE__,__FUNCTION__,__LINE__); \ + exit(-1); \ + } + +#define VALUE_NAME_MAX 255 +typedef struct { + int step; + char gstepIdStr[VALUE_NAME_MAX]; + int execSvcNum; + int reqNum; + char nextStepCondStr[VALUE_NAME_MAX]; + char execSvcName[VALUE_NAME_MAX]; + char reqTableName[VALUE_NAME_MAX]; +} PARSE_GSTEP_t; + + +typedef struct { + char svcid[VALUE_NAME_MAX]; + char name[VALUE_NAME_MAX]; + char path[VALUE_NAME_MAX]; + char type[VALUE_NAME_MAX]; + char life_cycle[VALUE_NAME_MAX]; + char retry_cnt[VALUE_NAME_MAX]; + char cpu_assign[VALUE_NAME_MAX]; + char prio[VALUE_NAME_MAX]; + char policy[VALUE_NAME_MAX]; + char user[VALUE_NAME_MAX]; + char runtime_limit[VALUE_NAME_MAX]; + char cpu_limit[VALUE_NAME_MAX]; + char mem_limit[VALUE_NAME_MAX]; + int subgidNum; + char args[VALUE_NAME_MAX]; + char shutdown_wait[VALUE_NAME_MAX]; +} PARSE_SVC_t; + +/*************************************** + * Context + **************************************/ +typedef struct { + FILE* fp; // Output file pointer + FILE* tmpFp; // Temporary file + ELE_STATE_t state; + + PARSE_SVC_t svc; + + int svcNum; // Number of services + PARSE_GSTEP_t gstep; +} PARSE_CTX_t; + + +/*************************************** + * entryTskmCfg + **************************************/ +void +entryTskmCfg(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state = ELE_TSKM_CFG; +} + +/*************************************** + * exitTskmCfg + **************************************/ +void +exitTskmCfg(PARSE_CTX_t* p_ctx) { + p_ctx->state = ELE_NONE; +} + + +/*************************************** + * entryServiceList + **************************************/ +void +entryServiceList(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state = ELE_SERVICE_LIST; + + p_ctx->tmpFp = fopen(TMPFILE,"w"); + + fprintf(p_ctx->tmpFp, + "static TSKM_SVC_ATTR_t serviceAttr[]={" + "\n"); +} + +/*************************************** + * exitServiceList + **************************************/ +void +exitServiceList(PARSE_CTX_t* p_ctx) { + fprintf(p_ctx->tmpFp, + "};" + "\n\n"); + + fprintf(p_ctx->tmpFp, "#define TSKM_SVC_NUM (%d) \n\n",p_ctx->svcNum); + + fprintf(p_ctx->tmpFp, "static TSKM_SVC_CTX_t serviceList[TSKM_SVC_NUM]; \n\n"); + + fclose(p_ctx->tmpFp); + + fprintf(p_ctx->fp,"\n\n"); + + p_ctx->state = ELE_TSKM_CFG; +} + +/*************************************** + * handleServiceList + **************************************/ +void +entryService(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) { + PARSE_ASSERT_EXIT(strcmp(name,"service") == 0); + int ii; + char* tp; + p_ctx->state = ELE_SERVICE; + + memset(&p_ctx->svc,0,sizeof(p_ctx->svc)); + + for(ii=0; atts[ii]; ii+=2) { + const char* attr = atts[ii]; + const char* value = atts[ii+1]; + if(strcmp(attr,"svcid")==0) { + strcpy(p_ctx->svc.svcid,value); + } else if(strcmp(attr,"name")==0) { + strcpy(p_ctx->svc.name,value); + } else if(strcmp(attr,"path")==0) { + strcpy(p_ctx->svc.path,value); + } else if(strcmp(attr,"type")==0) { + const char* typeName = (strcmp(value,"native")==0) ? "TSKM_SVC_TYPE_NATIVE" : "TSKM_SVC_TYPE_UNKNONW"; + strcpy(p_ctx->svc.type,typeName); + } else if(strcmp(attr,"prio")==0) { + strcpy(p_ctx->svc.prio,value); + } else if(strcmp(attr,"policy")==0) { + const char* polName = (strcmp(value,"fifo")==0) ? "TSKM_SVC_POLICY_FIFO" : + (strcmp(value,"tss")==0) ? "TSKM_SVC_POLICY_TSS" : + (strcmp(value,"rr")==0) ? "TSKM_SVC_POLICY_RR" : "ERROR"; + strcpy(p_ctx->svc.policy,polName); + } else if(strcmp(attr,"life_cycle")==0) { + const char* lcName = (strcmp(value,"always")==0) ? "TSKM_SVC_LC_ALWAYS" : + (strcmp(value,"always_recoverable")==0) ? "TSKM_SVC_LC_ALWAYS_RECOVERABLE" : + (strcmp(value,"dynamic")==0) ? "TSKM_SVC_LC_DYNAMIC" : "ERROR"; + strcpy(p_ctx->svc.life_cycle,lcName); + } else if(strcmp(attr,"retry_cnt")==0) { + strcpy(p_ctx->svc.retry_cnt,value); + } else if(strcmp(attr,"cpu_assign")==0) { + const char* caName = (strcmp(value,"cpu0")==0) ? "TSKM_SVC_ASSIGN_CPU_0" : + (strcmp(value,"cpu1")==0) ? "TSKM_SVC_ASSIGN_CPU_1" : + (strcmp(value,"auto")==0) ? "TSKM_SVC_ASSIGN_CPU_AUTO" : "ERROR"; + strcpy(p_ctx->svc.cpu_assign,caName); + } else if(strcmp(attr,"user")==0) { + strcpy(p_ctx->svc.user,value); + } else if(strcmp(attr,"runtime_limit")==0) { + strcpy(p_ctx->svc.runtime_limit,value); + } else if(strcmp(attr,"cpu_limit")==0) { + strcpy(p_ctx->svc.cpu_limit,value); + } else if(strcmp(attr,"mem_limit")==0) { + strcpy(p_ctx->svc.mem_limit,value); + } else if(strcmp(attr,"args")==0) { + strcpy(p_ctx->svc.args,value); + } else if(strcmp(attr,"shutdown_wait")==0) { + const char* swStr = (strcmp(value,"yes")==0) ? "TSKM_TRUE" : + (strcmp(value,"no")==0) ? "TSKM_FALSE" : "ERROR"; + strcpy(p_ctx->svc.shutdown_wait,swStr); + } + } + + fprintf(p_ctx->fp,"char const *svcArgs%d[] = {",p_ctx->svcNum); + fprintf(p_ctx->fp,"\"%s\",",p_ctx->svc.path); + + // Output arguments + tp = strtok(p_ctx->svc.args," "); + while(tp != NULL) { + fprintf(p_ctx->fp,"\"%s\",",tp); + tp = strtok(NULL," "); + } + + fprintf(p_ctx->fp,"NULL"); + fprintf(p_ctx->fp,"};\n"); +} + +/*************************************** + * exitService + **************************************/ +void +exitService(PARSE_CTX_t* p_ctx) { + uint32_t ii; + fprintf(p_ctx->tmpFp,"{" ); + + fprintf(p_ctx->tmpFp,"%s",p_ctx->svc.svcid); + fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.name); + fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.path); + fprintf(p_ctx->tmpFp,", (char**)svcArgs%d",p_ctx->svcNum); + fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.type); + fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.prio); + fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.policy); + fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.life_cycle); + fprintf(p_ctx->tmpFp,", (uint32_t)%s",p_ctx->svc.retry_cnt); + fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.cpu_assign); + fprintf(p_ctx->tmpFp,", (const char *)\"%s\"",p_ctx->svc.user); + fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.runtime_limit[0] != '\0') ? p_ctx->svc.runtime_limit : "0"); + fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.cpu_limit[0] != '\0') ? p_ctx->svc.cpu_limit : "0"); + fprintf(p_ctx->tmpFp,", %s",(p_ctx->svc.mem_limit[0] != '\0') ? p_ctx->svc.mem_limit : "0"); + fprintf(p_ctx->tmpFp,", %s",p_ctx->svc.shutdown_wait); + fprintf(p_ctx->tmpFp,", %d",p_ctx->svc.subgidNum); + if(p_ctx->svc.subgidNum) { + fprintf(p_ctx->tmpFp,", subgidList%d",p_ctx->svcNum); + } else { + fprintf(p_ctx->tmpFp,", NULL"); + } + + fprintf(p_ctx->tmpFp,"},\n"); + + p_ctx->svcNum++; + + p_ctx->state = ELE_SERVICE_LIST; +} + +/*************************************** + * entrySubgidList + **************************************/ +void +entrySubgidList(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state = ELE_SUBGID_LIST; + + fprintf(p_ctx->fp,"static gid_t subgidList%d[] = {",p_ctx->svcNum); + + +} + +/*************************************** + * handleSubgidList + **************************************/ +void +handleSubgidList(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) { + PARSE_ASSERT_EXIT(strcmp(name,"subgid") == 0); + int32_t ii; + + if(p_ctx->svc.subgidNum > 0) { + fprintf(p_ctx->fp,","); + } + for(ii=0; atts[ii]; ii+=2) { + const char* attr = atts[ii]; + const char* value = atts[ii+1]; + if(strcmp(attr,"gid")==0) { + fprintf(p_ctx->fp,"%s",value); + } else { + PARSE_ASSERT_EXIT(0); + } + } + p_ctx->svc.subgidNum++; +} + +/*************************************** + * exitSubgidList + **************************************/ +void +exitSubgidList(PARSE_CTX_t* p_ctx) { + + fprintf(p_ctx->fp,"};\n"); + + p_ctx->state = ELE_SERVICE; +} + + +/*************************************** + * entryNormalWakeup + **************************************/ +void +entryNormalWakeup(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state = ELE_NORMAL_WAKEUP; + memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep)); + + sprintf(p_ctx->gstep.reqTableName,"wakeupReqList"); + sprintf(p_ctx->gstep.execSvcName,"wakeupExecSvcId"); + p_ctx->tmpFp = fopen(TMPFILE,"a"); + PARSE_ASSERT_EXIT(p_ctx->tmpFp); + + fprintf(p_ctx->tmpFp,"TSKM_GSTEP_t wakeupGstep[]={\n"); +} + +/*************************************** + * exitNormalWakeup + **************************************/ +void +exitNormalWakeup(PARSE_CTX_t* p_ctx) { + fprintf(p_ctx->tmpFp,"};\n\n"); + fclose(p_ctx->tmpFp); + + p_ctx->state = ELE_TSKM_CFG; +} + +/*************************************** + * entryVupWakeup + **************************************/ +void +entryVupWakeup(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state = ELE_VUP_WAKEUP; + memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep)); + + sprintf(p_ctx->gstep.reqTableName,"wakeupReqListVup"); + sprintf(p_ctx->gstep.execSvcName,"wakeupExecSvcIdVup"); + p_ctx->tmpFp = fopen(TMPFILE,"a"); + PARSE_ASSERT_EXIT(p_ctx->tmpFp); + + fprintf(p_ctx->tmpFp,"TSKM_GSTEP_t wakeupGstepVup[]={\n"); +} + +/*************************************** + * exitVupWakeup + **************************************/ +void +exitVupWakeup(PARSE_CTX_t* p_ctx) { + fprintf(p_ctx->tmpFp,"};\n\n"); + fclose(p_ctx->tmpFp); + + p_ctx->state = ELE_TSKM_CFG; +} + +void +entryGstep(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + + p_ctx->state &= ~ELE_MASK2; + p_ctx->state |= ELE_COMMON_GSTEP; + + PARSE_GSTEP_t *p_gstep = &p_ctx->gstep; + + if(atts[0] && strcmp(atts[0],"stepid") == 0) { + sprintf(p_gstep->gstepIdStr,"%s",atts[1]); + } else { + sprintf(p_gstep->gstepIdStr,"TSKM_GSTEP_NONE"); + } + p_gstep->execSvcNum = 0; + p_gstep->reqNum = 0; + sprintf(p_gstep->nextStepCondStr,"INI_INITCOMP_NONE"); +} + +void +handleGstep(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) { + PARSE_ASSERT_EXIT(strcmp(name,"next_trans_condition") == 0); + PARSE_GSTEP_t *p_gstep = &p_ctx->gstep; + + if(atts[0] && strcmp(atts[0],"cond") == 0) { + sprintf(p_gstep->nextStepCondStr,"%s",atts[1]); + } else { + PARSE_ASSERT_EXIT(0); + } +} + +void +exitGstep(PARSE_CTX_t* p_ctx) { + PARSE_GSTEP_t *p_gstep = &p_ctx->gstep; + + fprintf(p_ctx->tmpFp,"{"); + fprintf(p_ctx->tmpFp,"%s,",p_gstep->gstepIdStr); + fprintf(p_ctx->tmpFp,"%d,",p_gstep->execSvcNum); + if(p_gstep->execSvcNum) { + fprintf(p_ctx->tmpFp,"%s%d,",p_gstep->execSvcName,p_gstep->step); + } else { + fprintf(p_ctx->tmpFp,"NULL,"); + } + fprintf(p_ctx->tmpFp,"%d,",p_gstep->reqNum); + if(p_gstep->reqNum) { + fprintf(p_ctx->tmpFp,"%s%d,",p_gstep->reqTableName,p_gstep->step); + } else { + fprintf(p_ctx->tmpFp,"NULL,"); + } + fprintf(p_ctx->tmpFp,"%s",p_gstep->nextStepCondStr); + fprintf(p_ctx->tmpFp,"},\n"); + + p_gstep->step++; + + p_ctx->state &= ~ELE_MASK2; +} + +void +entryExec(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state &= ~ELE_MASK3; + p_ctx->state |= ELE_COMMON_EXEC; + + PARSE_GSTEP_t *p_gstep = &p_ctx->gstep; + fprintf(p_ctx->fp, + "static TSKM_SVCID_t %s%d[] = {",p_gstep->execSvcName,p_gstep->step); +} +void +handleExec(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) { + PARSE_ASSERT_EXIT(strcmp(name,"exec_svc") == 0); + PARSE_GSTEP_t *p_gstep = &p_ctx->gstep; + int ii; + + if(p_gstep->execSvcNum > 0) { + fprintf(p_ctx->fp,","); + } + + for(ii=0; atts[ii]; ii+=2) { + const char* attr = atts[ii]; + const char* value = atts[ii+1]; + PARSE_ASSERT_EXIT(strcmp(attr,"svcid") == 0); + fprintf(p_ctx->fp,"%s",value); + } + p_gstep->execSvcNum++; +} +void +exitExec(PARSE_CTX_t* p_ctx) { + fprintf(p_ctx->fp,"};\n\n"); + p_ctx->state &= ~ELE_MASK3; +} + +void +entryReq(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state &= ~ELE_MASK3; + p_ctx->state |= ELE_COMMON_REQ; + PARSE_GSTEP_t *p_gstep = &p_ctx->gstep; + + fprintf(p_ctx->fp,"static TSKM_GSTEP_REQ_INFO_t %s%d[] ={",p_gstep->reqTableName,p_gstep->step); +} +void +handleReq(PARSE_CTX_t* p_ctx,const XML_Char *name,const XML_Char* atts[]) { + PARSE_GSTEP_t *p_gstep = &p_ctx->gstep; + PARSE_ASSERT_EXIT(strcmp(name,"request") == 0); + int ii; + + fprintf(p_ctx->fp," {"); + + for(ii=0; atts[ii]; ii+=2) { + const char* attr = atts[ii]; + const char* value = atts[ii+1]; + if(strcmp(attr,"local_step") == 0) { + if(strcmp(value,"shm") == 0) { + fprintf(p_ctx->fp,"TSKM_LSTEP_SHM"); + } else if(strcmp(value,"bupchk") == 0) { + fprintf(p_ctx->fp,"TSKM_LSTEP_BUPCHK"); + } else if(strcmp(value,"last") == 0) { + fprintf(p_ctx->fp,"TSKM_LSTEP_LAST"); + } else if(strcmp(value,"all") == 0) { + fprintf(p_ctx->fp,"TSKM_LSTEP_ALL"); + } else { + fprintf(p_ctx->fp,"%s",value); + } + } else { + fprintf(p_ctx->fp,"%s",value); // Output of "," + } + fprintf(p_ctx->fp,"%s",(atts[ii+2])?",":""); // Outoput of "," + } + fprintf(p_ctx->fp,"},"); + p_gstep->reqNum++; +} +void +exitReq(PARSE_CTX_t* p_ctx) { + fprintf(p_ctx->fp,"};\n\n"); + p_ctx->state &= ~ELE_MASK3; +} + +/*************************************** + * entryNormalShutdown + **************************************/ +void +entryNormalShutdown(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state = ELE_NORMAL_SHUTDOWN; + + memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep)); + sprintf(p_ctx->gstep.reqTableName,"downReqList"); + p_ctx->tmpFp = fopen(TMPFILE,"a"); + PARSE_ASSERT_EXIT(p_ctx->tmpFp); + + fprintf(p_ctx->tmpFp,"static TSKM_GSTEP_t downGstep[]={\n"); +} + +/*************************************** + * exitNormalShutdown + **************************************/ +void +exitNormalShutdown(PARSE_CTX_t* p_ctx) { + + fprintf(p_ctx->tmpFp,"};\n\n"); + fclose(p_ctx->tmpFp); + + p_ctx->state = ELE_TSKM_CFG; +} + +/*************************************** + * entryVupShutdown + **************************************/ +void +entryVupShutdown(PARSE_CTX_t* p_ctx,const XML_Char* atts[]) { + p_ctx->state = ELE_VUP_SHUTDOWN; + memset(&p_ctx->gstep,0,sizeof(p_ctx->gstep)); + + sprintf(p_ctx->gstep.reqTableName,"downReqListVup"); + p_ctx->tmpFp = fopen(TMPFILE,"a"); + PARSE_ASSERT_EXIT(p_ctx->tmpFp); + + fprintf(p_ctx->tmpFp,"static TSKM_GSTEP_t downGstepVup[]={\n"); +} + +/*************************************** + * exitVupShutdown + **************************************/ +void +exitVupShutdown(PARSE_CTX_t* p_ctx) { + fprintf(p_ctx->tmpFp,"};\n\n"); + fclose(p_ctx->tmpFp); + + p_ctx->state = ELE_TSKM_CFG; +} + +/*************************************** + * elementStart + **************************************/ +void +elementStart(void *userData, const XML_Char *name, const XML_Char *atts[]) { + PARSE_CTX_t *p_ctx = (PARSE_CTX_t*)userData; +#if 0 + int ii; + printf("[ELEMENT] %s Start!\n", name); + for(ii=0; atts[ii]; ii+=2) { + printf(" %s:%s \n", atts[ii],atts[ii+1]); + } +#endif + switch(p_ctx->state) { + case ELE_NONE: + if(strcmp(name,"tskm_cfg") == 0) { + entryTskmCfg(p_ctx,atts); + } else { + PARSE_ASSERT_EXIT(0); + } + break; + case ELE_TSKM_CFG: + if(strcmp(name,"service_list") == 0) { + entryServiceList(p_ctx,atts); + } else if(strcmp(name,"normal_wakeup") == 0) { + entryNormalWakeup(p_ctx,atts); + } else if(strcmp(name,"normal_shutdown") == 0) { + entryNormalShutdown(p_ctx,atts); + } else if(strcmp(name,"vup_wakeup") == 0) { + entryVupWakeup(p_ctx,atts); + } else if(strcmp(name,"vup_shutdown") == 0) { + entryVupShutdown(p_ctx,atts); + } else { + PARSE_ASSERT_EXIT(0); + } + break; + case ELE_SERVICE_LIST: + if(strcmp(name,"service") == 0) { + entryService(p_ctx,name,atts); + } + break; + case ELE_SERVICE: + if(strcmp(name,"subgid_list") == 0) { + entrySubgidList(p_ctx,atts); + } + break; + case ELE_SUBGID_LIST: + handleSubgidList(p_ctx,name,atts); + break; + case ELE_NORMAL_WAKEUP: + case ELE_NORMAL_SHUTDOWN: + case ELE_VUP_WAKEUP: + case ELE_VUP_SHUTDOWN: + if(strcmp(name,"global_step") == 0) { + entryGstep(p_ctx,atts); + } else { + PARSE_ASSERT_EXIT(0); + } + break; + case ELE_NORMAL_W_GSTEP: + case ELE_NORMAL_D_GSTEP: + case ELE_VUP_W_GSTEP: + case ELE_VUP_D_GSTEP: + if(strcmp(name,"exec_list") == 0) { + entryExec(p_ctx,atts); + } else if(strcmp(name,"request_list") == 0) { + entryReq(p_ctx,atts); + } else { + handleGstep(p_ctx,name,atts); + } + break; + case ELE_NORMAL_W_EXEC: + case ELE_VUP_W_EXEC: + handleExec(p_ctx,name,atts); + break; + case ELE_NORMAL_W_REQ: + case ELE_NORMAL_D_REQ: + case ELE_VUP_W_REQ: + case ELE_VUP_D_REQ: + handleReq(p_ctx,name,atts); + break; + } +} + + +/*************************************** + * elementEnd + **************************************/ +void +elementEnd(void *userData, const XML_Char *name) { + PARSE_CTX_t *p_ctx = (PARSE_CTX_t*)userData; + switch(p_ctx->state) { + case ELE_NONE: + PARSE_ASSERT_EXIT(0); + break; + case ELE_TSKM_CFG: + if(strcmp(name,"tskm_cfg") == 0) { + exitTskmCfg(p_ctx); + } else { + PARSE_ASSERT_EXIT(0); + } + break; + case ELE_SERVICE_LIST: + if(strcmp(name,"service_list") == 0) { + exitServiceList(p_ctx); + } + break; + case ELE_SERVICE: + if(strcmp(name,"service") == 0) { + exitService(p_ctx); + } + break; + case ELE_SUBGID_LIST: + if(strcmp(name,"subgid_list") == 0) { + exitSubgidList(p_ctx); + } + break; + case ELE_NORMAL_WAKEUP: + if(strcmp(name,"normal_wakeup") == 0) { + exitNormalWakeup(p_ctx); + } + break; + case ELE_NORMAL_SHUTDOWN: + if(strcmp(name,"normal_shutdown") == 0) { + exitNormalShutdown(p_ctx); + } + break; + case ELE_VUP_WAKEUP: + if(strcmp(name,"vup_wakeup") == 0) { + exitVupWakeup(p_ctx); + } + break; + case ELE_VUP_SHUTDOWN: + if(strcmp(name,"vup_shutdown") == 0) { + exitVupShutdown(p_ctx); + } + break; + case ELE_NORMAL_D_GSTEP: + case ELE_NORMAL_W_GSTEP: + case ELE_VUP_D_GSTEP: + case ELE_VUP_W_GSTEP: + if(strcmp(name,"global_step") == 0) { + exitGstep(p_ctx); + } + break; + case ELE_NORMAL_W_EXEC: + case ELE_VUP_W_EXEC: + if(strcmp(name,"exec_list") == 0) { + exitExec(p_ctx); + } + break; + case ELE_NORMAL_D_REQ: + case ELE_NORMAL_W_REQ: + case ELE_VUP_D_REQ: + case ELE_VUP_W_REQ: + if(strcmp(name,"request_list") == 0) { + exitReq(p_ctx); + } + break; + } +} +/*************************************** + * parseXmlFile + **************************************/ +int +parseXmlFile(const char* file,XML_Parser parser) { + int ret = -1; + FILE* fp = fopen(file, "r"); + if (fp == NULL) { + goto ERROR; + } + + while(1) { + char *buf = (char*) XML_GetBuffer(parser, BUFSIZE); + if (!buf) { + goto ERROR; + } + + size_t nread = fread(buf, sizeof(char), BUFSIZE, fp); + if (ferror(fp)) { + goto ERROR; + } + + if (!XML_ParseBuffer(parser, nread, feof(fp))) { + goto ERROR; + } + + if (feof(fp)) { + break; + } + } + ret = 0; +ERROR: + if(fp) { + fclose(fp); + } + return ret; +} + +/*************************************** + * externalHandler + **************************************/ +int +externalHandler(XML_Parser parser, + const XML_Char* content, const XML_Char* base, + const XML_Char* systemId, const XML_Char* publicId) { + printf("parse %s \n",systemId); + + int ret = XML_ERROR_EXTERNAL_ENTITY_HANDLING; + XML_Parser extparser = NULL; + + extparser = XML_ExternalEntityParserCreate(parser, content, NULL); + if(extparser ==NULL) { + goto ERROR; + } + + if(parseXmlFile(systemId,extparser) != 0) { + goto ERROR; + } + ret = XML_STATUS_OK; +ERROR: + if(extparser) { + XML_ParserFree(extparser); + } + return ret; +} + +/*************************************** + * usage + **************************************/ +void +usage(const char* cmd) { + printf("usage:%s xmlfile\n",cmd); +} + +/*************************************** + * main + **************************************/ +int +main (int argc, char *argv[]) { + struct stat statinfo; + int ret=-1; + int xmlRet; + const char* inpath; + char tmpstr1[255]; + char tmpstr2[255]; + const char* workdir; + const char* infile; + XML_Parser parser; + PARSE_CTX_t ctx; + + if(argc < 2) { + usage(argv[0]); + goto ERROR; + } + + inpath = argv[1]; + if(0 != stat(inpath,&statinfo)) { + fprintf(stderr, "%s:%s",strerror(errno),inpath); + goto ERROR; + } + memset(&ctx,0,sizeof(ctx)); + + strcpy(tmpstr1,inpath); + strcpy(tmpstr2,inpath); + workdir=dirname(tmpstr1); + infile=basename(tmpstr2); + + if(0 != chdir(workdir)) { + fprintf(stderr, "%s:%s",strerror(errno),workdir); + goto ERROR; + } + + ctx.fp = fopen(OUTFILE, "w"); + if (ctx.fp == NULL) { + goto ERROR; + } + fprintf(ctx.fp,"//This file is created automatically from %s.\n",inpath); + fprintf(ctx.fp,"//So you shall not modify this file immediately.\n"); + + /* create XML parser */ + if ((parser = XML_ParserCreate(NULL)) == NULL) { + fprintf(stderr, "parser creation error\n"); + goto ERROR; + } + XML_SetUserData(parser,&ctx); + XML_SetParamEntityParsing(parser,XML_PARAM_ENTITY_PARSING_ALWAYS); // Allow External Entities + XML_SetExternalEntityRefHandler(parser,externalHandler); + XML_SetElementHandler(parser, elementStart, elementEnd); + + if(parseXmlFile(infile,parser) != 0) { + goto ERROR; + } + ret = 0; + +ERROR: + if(parser) { + XML_ParserFree(parser); + } + if(ctx.fp) { + fclose(ctx.fp); + } + char buf[255]; + sprintf(buf,"cat %s >> %s",TMPFILE,OUTFILE); + printf("%s\n",buf); + system(buf); + unlink(TMPFILE); + return ret; +} + diff --git a/service/system/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp b/service/system/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp new file mode 100755 index 0000000..531b701 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/src/tskm_xml_data.cpp @@ -0,0 +1,138 @@ +/* + * @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. + */ + +#include "system_service/tskm_xml_data.h" + +#include <boost/algorithm/string.hpp> +#include <fstream> +#include <iostream> +#include <string> +#include <list> + +#include "system_service/tskm_svc.h" + +#include "system_service/tskm_svcid.h" +#include "tskm_debug.h" +#include "tskm_comm.h" +#include "tskm_auto_build.h" // Generated data from XML + +// This size depends on the size of the TM area of CL_Monitor +#define TSKM_SVC_ID_MAX_SIZE 1024 + +/*********************************************************************** + * tskm_initServiceList + ***********************************************************************/ +int tskm_initServiceList(TSKM_SVCS_CTX_t* p_svcs, int iFd) { + uint32_t ii; + + p_svcs->svcNum = sizeof(serviceList) / sizeof(TSKM_SVC_CTX_t); + p_svcs->svcList = serviceList; + + // It is initialized with the Inotify floppy disk. + for (ii = 0; ii < p_svcs->svcNum; ii++) { + serviceList[ii].attr = &serviceAttr[ii]; + serviceList[ii].iFd = iFd; + if (serviceList[ii].attr->svcId >= TSKM_SVC_ID_MAX_SIZE) { + TSKM_ASSERT(0); + return -1; + } + } + + const char* nfsenv = getenv("AGL_NFS"); + bool isNfs = (nfsenv && strcmp(nfsenv, "y") == 0) ? true : false; + + // For NFS environments, replace the PATH with CAP with /tmp + if (isNfs) { + std::list<std::string> capFiles; + const std::string capPath("/usr/debug/share/target/cap.lst"); + std::ifstream fin(capPath.c_str()); + std::string line; + while (fin && std::getline(fin, line)) { + std::list<std::string> strList; + try { // throw exception by boost::split + boost::split(strList, line, boost::is_any_of("|")); + if (!strList.empty()) { + if (strList.front()[0] == '/') { // Only character strings beginning with '/' are considered PATH + capFiles.push_back(strList.front().c_str()); + } + } + } catch (...) { + TSKM_ASSERT(0); + } + } + + for (ii = 0; ii < p_svcs->svcNum; ii++) { + std::string binPath(serviceList[ii].attr->path); + + for (std::list<std::string>::iterator ite = capFiles.begin(); + ite != capFiles.end(); ite++) { + if (binPath == *ite) { + std::list<std::string> nodes; + try { // throw exception by boost::split + boost::split(nodes, binPath, boost::is_any_of("/")); + std::string *p_newPath = new std::string("/tmp/"); // Intent not to free up memory + *p_newPath += nodes.back(); + TSKM_PRINTF(TSKM_LOG_STATE, "EXCHG %s", p_newPath->c_str()); + serviceList[ii].attr->path = p_newPath->c_str(); + break; + } catch (...) { + TSKM_ASSERT(0); + } + } + } + } + } + + // If there is no socket resource equal to the number of services + 1 (internal control connection), a compilation error occurs + TSKM_STATIC_ASSERT(TSKM_COMM_CONNECT_MAX >= (TSKM_SVC_NUM+1)); + + return 0; +} + +/*********************************************************************** + * tskm_initWakeupCtx + ***********************************************************************/ +void tskm_initWakeupCtx(TSKM_GSTEP_CTX_t* p_wakeup, BOOL isVupMode) { + memset(p_wakeup, 0, sizeof(*p_wakeup)); + + if (isVupMode) { + p_wakeup->gstepNum = sizeof(wakeupGstepVup) / sizeof(TSKM_GSTEP_t); + p_wakeup->gstep = wakeupGstepVup; + } else { + p_wakeup->gstepNum = sizeof(wakeupGstep) / sizeof(TSKM_GSTEP_t); + p_wakeup->gstep = wakeupGstep; + } + + TSKM_PRINTF(TSKM_LOG_STATE, "gstep(wakeup):%d", p_wakeup->gstepNum); +} + +/*********************************************************************** + * tskm_initDownCtx + ***********************************************************************/ +void tskm_initDownCtx(TSKM_GSTEP_CTX_t* p_down, BOOL isVupMode) { + memset(p_down, 0, sizeof(*p_down)); + + if (isVupMode) { + p_down->gstepNum = sizeof(downGstepVup) / sizeof(TSKM_GSTEP_t); + p_down->gstep = downGstepVup; + } else { + p_down->gstepNum = sizeof(downGstep) / sizeof(TSKM_GSTEP_t); + p_down->gstep = downGstep; + } + + TSKM_PRINTF(TSKM_LOG_STATE, "gstep(down):%d", p_down->gstepNum); +} + diff --git a/service/system/task_manager/client/libtskmcfg/tskm_cfg.xml b/service/system/task_manager/client/libtskmcfg/tskm_cfg.xml new file mode 100755 index 0000000..2898f44 --- /dev/null +++ b/service/system/task_manager/client/libtskmcfg/tskm_cfg.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" ?> + +<!DOCTYPE tskm_cfg [ + <!ELEMENT tskm_cfg (service_list,normal_wakeup,normal_shutdown,vup_wakeup,vup_shutdown) > + + <!-- service list --> + <!ELEMENT service_list (service+) > + <!ELEMENT service (subgid_list*) > + <!ATTLIST service + svcid ID #REQUIRED + name CDATA #REQUIRED + path CDATA #REQUIRED + type (native|unknown) "native" + prio CDATA #REQUIRED + policy (fifo|tss|rr) #REQUIRED + life_cycle (always|always_recoverable|dynamic) "dynamic" + retry_cnt CDATA "1" + cpu_assign (cpu0|cpu1|auto) "auto" + user CDATA #REQUIRED + runtime_limit CDATA #IMPLIED + cpu_limit CDATA #IMPLIED + mem_limit CDATA #IMPLIED + args CDATA #IMPLIED + shutdown_wait (yes|no) #REQUIRED + > + + <!ELEMENT subgid_list (subgid+) > + <!ELEMENT subgid EMPTY > + <!ATTLIST subgid + gid CDATA #REQUIRED + > + + + <!-- Starting/terminating of services --> + <!ELEMENT normal_wakeup (global_step+) > + <!ELEMENT normal_shutdown (global_step+) > + <!ELEMENT vup_wakeup (global_step+) > + <!ELEMENT vup_shutdown (global_step+) > + + <!ELEMENT global_step (exec_list?,request_list?,next_trans_condition?) > + <!ATTLIST global_step + stepid ID #IMPLIED + > + + <!ELEMENT exec_list (exec_svc+) > + <!ELEMENT exec_svc EMPTY > + + <!ATTLIST exec_svc + svcid IDREF #REQUIRED + > + + <!ELEMENT request_list (request+) > + <!ELEMENT request EMPTY > + <!ATTLIST request + svcid IDREF #REQUIRED + local_step (shm|bupchk|1|2|3|4|5|6|7|8|9|last|all) #REQUIRED + > + + <!ELEMENT next_trans_condition EMPTY> + <!ATTLIST next_trans_condition + cond CDATA #REQUIRED + > + + <!ENTITY service_list_xml SYSTEM "tskm_launch.xml"> + <!ENTITY normal_wakeup_xml SYSTEM "tskm_wakeup.xml"> + <!ENTITY normal_shutdown_xml SYSTEM "tskm_shutdown.xml"> + <!ENTITY vup_wakeup_xml SYSTEM "tskm_wakeup_vup.xml"> + <!ENTITY vup_shutdown_xml SYSTEM "tskm_shutdown_vup.xml"> +]> + + +<tskm_cfg> + &service_list_xml; + + &normal_wakeup_xml; + + &normal_shutdown_xml; + + &vup_wakeup_xml; + + &vup_shutdown_xml; + +</tskm_cfg> diff --git a/service/system/task_manager/client/ss_data_init/Makefile b/service/system/task_manager/client/ss_data_init/Makefile new file mode 100755 index 0000000..920fbea --- /dev/null +++ b/service/system/task_manager/client/ss_data_init/Makefile @@ -0,0 +1,43 @@ +# +# @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. +# + +####################################### +####################################### +INST_SHLIBS := libss_data_init + +MKDATAINIT=mkdatainit.sh + +INST_HEADERS = tskm_data_init.h task_manager_libss_data_init.h + +VPATH = ./include/$(COMPONENT_NAME) +CPPFLAGS += -I./include/ -I./../../server/include -I./../libtskmcfg/include + +libss_data_init_SRCS := tskm_data_init.cpp +libss_data_init_PCOS := $(shell ls ./obj/*.os) + +$(libss_data_init_SRCS): $(libss_data_init_PCOS) + set -e ; \ + sh $(MKDATAINIT) + +######## add compile option ######## +LDFLAGS += -Wl,--no-as-needed +CPPFLAGS += -fno-exceptions + +CLEAN_FILES=$(libss_data_init_SRCS) + +LDLIBS = -Wl,-Bdynamic -lNS_FrameworkUnified + +include ../../../system_service.mk diff --git a/service/system/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h b/service/system/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h new file mode 100755 index 0000000..39422e9 --- /dev/null +++ b/service/system/task_manager/client/ss_data_init/include/libss_data_init_taskmanagerlog.h @@ -0,0 +1,78 @@ +/* + * @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_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_ +#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_ + +#include <native_service/ns_logger_if.h> + +#define ZONE_INIT ZONEMASK(10) // library common def +#define ZONE_FUNC ZONEMASK(11) // library common def +#define ZONE_MEM ZONEMASK(12) // library common def +#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_28 ZONEMASK(28) +#define ZONE_INFO ZONEMASK(29) // library common def +#define ZONE_WARN ZONEMASK(30) // library common def +#define ZONE_ERR ZONEMASK(31) // library common def + +#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) // LPRINT +#endif + +#ifndef FRAMEWORKUNIFIEDLOGAPPZONES +#define FRAMEWORKUNIFIEDLOGAPPZONES ZONE_INFO +#endif /* FRAMEWORKUNIFIEDLOGAPPZONES */ + +extern FRAMEWORKUNIFIEDLOGPARAM g_FrameworkunifiedLogParams; + +#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_LIBSS_DATA_INIT_TASKMANAGERLOG_H_ diff --git a/service/system/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h b/service/system/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h new file mode 100755 index 0000000..e3bdfc5 --- /dev/null +++ b/service/system/task_manager/client/ss_data_init/include/system_service/task_manager_libss_data_init.h @@ -0,0 +1,39 @@ +/* + * @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 + * @brief \~english This file include tskm_data_init.h + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup task_manager + * @ingroup system_service + * @{ + */ +#ifndef SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_ // NOLINT(build/header_guard) +#define SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_ + +#include "system_service/tskm_data_init.h" + +#endif // SYSTEMSERVICE_TASKMNAGERLIBSSDATAINIT_H_ +/** @}*/ +/** @}*/ +/** @}*/ diff --git a/service/system/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h b/service/system/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h new file mode 100755 index 0000000..8cb49d6 --- /dev/null +++ b/service/system/task_manager/client/ss_data_init/include/system_service/tskm_data_init.h @@ -0,0 +1,121 @@ +/* + * @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_data_init.h + * @brief \~english This file contains API of initial task manager data + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup system_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup task_manager + * @ingroup system_service + * @{ + */ + +#ifndef TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_ +#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_ + +#include <native_service/frameworkunified_types.h> +#include <system_service/ss_system_manager_if.h> +#include "system_service/tskm_type.h" + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup TSKM_GetExtBootInfo +/// \~english @par Summary +/// Gets boot extended information. +/// \~english @param [in] p_info +/// T_SS_SM_START_ExtDataStructType * - Boot extended information +/// \~english @code +/// typedef struct { +/// BOOL isProgUpdated; +/// EMRelaunchStatus relaunchStatus; +/// BOOL isMapUpdated; +/// BOOL isMapDiffUpdated; +/// uint8_t reserved[]; +/// }T_SS_SM_START_ExtDataStructType; +/// @endcode +/// \~english @retval TSKM_E_OK Normal end +/// \~english @retval TSKM_E_PAR %Parameter error +/// \~english @par Preconditions +/// - None +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - p_info is NULL. [TSKM_E_PAR] +/// \~english @par Classification +/// Public +/// \~english @par Type +/// Sync only +/// \~english @par Detail +/// Is available only at the functions defined by using TSKM_DATA_INIT_FUNC. +/// \~english @see TSKM_DATA_INIT_FUNC +//////////////////////////////////////////////////////////////////////////////////// +TSKM_ERR_t TSKM_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info); + +///////////////////////////////////////////////////////////////////////////////////// +/// \ingroup TSKM_DATA_INIT_FUNC +/// \~english @par Summary +/// Defines callback functions to initialize data. +/// \~english @param [in] serviceName +/// const char* - Service name +/// \~english @param [in] argName +/// const T_SS_SM_START_DataStructType* - Argument name +/// \~english @code +/// 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 resetCount; +/// } T_SS_SM_START_DataStructType; +/// @endcode +/// \~english @retval eFrameworkunifiedStatusOK Normal +/// \~english @retval eFrameworkunifiedStatusFail Check error +/// \~english @par Preconditions +/// - None +/// \~english @par Change of the internal state +/// - The internal state is not changed. +/// \~english @par Causes of failures +/// - Return values depend on the mount of callback functions. [eFrameworkunifiedStatusFail] +/// \~english @par Classification +/// Public +/// \~english @par Detail +/// Defines the callback functions to initialize data. \n +/// The callback functions defined by this macro are executed at a timing +/// when boot factor is fixed after booting the system. \n +/// (Task_Manager executes Callback prior to the boot of ActivityManager.)\n +/// If each service mounts and installs initialization functions, Task_Manager boots it +/// at a timing when data initialization is necessary. \n +/// Each service can install the object file of initialization functions by setting them +/// to MAKE variables INST_DATAINITOBJ of Makefile. +/// \~english @see None +//////////////////////////////////////////////////////////////////////////////////// +#define TSKM_DATA_INIT_FUNC(ServiceName, ArgName) \ + EFrameworkunifiedStatus tskm_ ## ServiceName ## _data_init(T_SS_SM_START_DataStructType* ArgName) + +#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_SYSTEM_SERVICE_TSKM_DATA_INIT_H_ +/** @}*/ // end of Task_Manager +/** @}*/ // end of SystemService +/** @}*/ // end of BaseSystem diff --git a/service/system/task_manager/client/ss_data_init/include/tskm_data_init_local.h b/service/system/task_manager/client/ss_data_init/include/tskm_data_init_local.h new file mode 100755 index 0000000..9d77d19 --- /dev/null +++ b/service/system/task_manager/client/ss_data_init/include/tskm_data_init_local.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_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_ +#define TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_ + +#include "system_service/tskm_data_init.h" + +extern void tskm_dataInitAll(T_SS_SM_START_DataStructType *arg, + T_SS_SM_START_ExtDataStructType *extArg); + +#endif // TASK_MANAGER_CLIENT_SS_DATA_INIT_INCLUDE_TSKM_DATA_INIT_LOCAL_H_ diff --git a/service/system/task_manager/client/ss_data_init/mkdatainit.sh b/service/system/task_manager/client/ss_data_init/mkdatainit.sh new file mode 100755 index 0000000..802fbd9 --- /dev/null +++ b/service/system/task_manager/client/ss_data_init/mkdatainit.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +# +# Copyright (c) 2019-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. +# + +cp tskm_data_init.cpp.in tskm_data_init.cpp.tmp + +LF=$(printf '\\\012_') +LF=${LF%_} + +for files in `ls obj/*.os` +do + serviceName=`nm -C $files | grep " T " | grep -o "tskm_[0-9a-zA-Z_]\+_data_init" | sed -e "s/^tskm_//" | sed -e "s/_data_init\$//"` + + funcname="tskm_"$serviceName"_data_init" + + echo $serviceName $funcname + sed -i "s/@DATA_INIT_PROT@/EFrameworkunifiedStatus $funcname(T_SS_SM_START_DataStructType* );$LF@DATA_INIT_PROT@/g" tskm_data_init.cpp.tmp + sed -i "s/@DATA_INIT_TABLE@/{\"$serviceName\", $funcname},$LF @DATA_INIT_TABLE@/g" tskm_data_init.cpp.tmp + +done + +sed -i "s/@DATA_INIT_PROT@//g" tskm_data_init.cpp.tmp +sed "s/@DATA_INIT_TABLE@/{NULL , NULL},/g" tskm_data_init.cpp.tmp > tskm_data_init.cpp + +rm tskm_data_init.cpp.tmp + + + + + + diff --git a/service/system/task_manager/client/ss_data_init/tskm_data_init.cpp.in b/service/system/task_manager/client/ss_data_init/tskm_data_init.cpp.in new file mode 100755 index 0000000..072a486 --- /dev/null +++ b/service/system/task_manager/client/ss_data_init/tskm_data_init.cpp.in @@ -0,0 +1,66 @@ +/* + * @copyright Copyright (c) 2019-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. + */ + +#include <system_service/tskm_data_init.h> +#include "stdio.h" +#include "libss_data_init_taskmanagerlog.h" + + +#define ZONE_INFO ZONEMASK(29) + +typedef struct{ + const char *serviceName; + EFrameworkunifiedStatus (*dataInitFunc)(T_SS_SM_START_DataStructType *arg); +} FUNC_INFO_t; + +@DATA_INIT_PROT@ + +const FUNC_INFO_t g_funcTbl[] = { + @DATA_INIT_TABLE@ +}; + +static T_SS_SM_START_ExtDataStructType extBootInfo; + +TSKM_ERR_t TSKM_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info){ + TSKM_ERR_t ret = TSKM_E_OK; + + if(NULL == p_info){ + FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__,"p_info = NULL"); + ret = TSKM_E_PAR; + }else{ + memcpy(p_info, &extBootInfo, sizeof(*p_info)); + } + + return ret; +} + +void tskm_dataInitAll(T_SS_SM_START_DataStructType *arg, T_SS_SM_START_ExtDataStructType *extArg){ + int i; + int itemNum = sizeof(g_funcTbl)/sizeof(FUNC_INFO_t) - 1; + + memcpy(&extBootInfo, extArg, sizeof(extBootInfo)); + + // LCOV_EXCL_START 10: Depends on reference information when building software + for(i=0;i<itemNum;i++){ + FRAMEWORKUNIFIEDLOG(ZONE_INFO,__FUNCTION__,"call datainit for %s",g_funcTbl[i].serviceName); + g_funcTbl[i].dataInitFunc(arg); + } + // LCOV_EXCL_STOP + + return; +} // LCOV_EXCL_BR_LINE 10: Final line + + |