Add gitlab issue/merge request templates
[staging/basesystem.git] / service / system / task_manager / client / ss_data_init / tskm_data_init.cpp.in
1 /*
2  * @copyright Copyright (c) 2019-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <system_service/tskm_data_init.h>
18 #include "stdio.h"
19 #include "libss_data_init_taskmanagerlog.h"
20
21
22 #define ZONE_INFO    ZONEMASK(29)
23
24 typedef struct{
25   const char *serviceName;
26   EFrameworkunifiedStatus (*dataInitFunc)(T_SS_SM_START_DataStructType *arg);
27 } FUNC_INFO_t;
28
29 @DATA_INIT_PROT@
30
31 const FUNC_INFO_t g_funcTbl[] = {
32   @DATA_INIT_TABLE@
33 };
34
35 static T_SS_SM_START_ExtDataStructType extBootInfo;
36
37 TSKM_ERR_t TSKM_GetExtBootInfo(T_SS_SM_START_ExtDataStructType *p_info){
38   TSKM_ERR_t ret = TSKM_E_OK;
39   
40   if(NULL == p_info){
41     FRAMEWORKUNIFIEDLOG(ZONE_ERR,__FUNCTION__,"p_info = NULL");
42     ret = TSKM_E_PAR;
43   }else{
44     memcpy(p_info, &extBootInfo, sizeof(*p_info));
45   }
46   
47   return ret;
48 }
49
50 void tskm_dataInitAll(T_SS_SM_START_DataStructType *arg, T_SS_SM_START_ExtDataStructType *extArg){
51   int i;
52   int itemNum = sizeof(g_funcTbl)/sizeof(FUNC_INFO_t) - 1;
53   
54   memcpy(&extBootInfo, extArg, sizeof(extBootInfo));
55
56   // LCOV_EXCL_START 10: Depends on reference information when building software
57   for(i=0;i<itemNum;i++){
58     FRAMEWORKUNIFIEDLOG(ZONE_INFO,__FUNCTION__,"call datainit for %s",g_funcTbl[i].serviceName);
59     g_funcTbl[i].dataInitFunc(arg);
60   }
61   // LCOV_EXCL_STOP
62   
63   return;
64 } // LCOV_EXCL_BR_LINE 10: Final line
65
66