e0624bba7e58c217b7660f713330a17abf6fd37c
[staging/basesystem.git] / service / system / task_manager / server / include / system_service / Primary_common.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17  * @file Primary_common.h
18  * @brief \~english This file contains declaration of common enum and structures
19  */
20 /** @addtogroup BaseSystem
21  *  @{
22  */
23 /** @addtogroup system_service
24  *  @ingroup BaseSystem
25  *  @{
26  */
27 /** @addtogroup task_manager
28  *  @ingroup system_service
29  *  @{
30  */
31 #ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
32 #define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
33
34 #include <stdint.h>
35 #include <pthread.h>
36
37 typedef unsigned int PRI_DWORD;    // To eliminate the DWORD
38
39 /* SRAM process type */
40 #define SRAM_INIT   (int)0        /* Initialization processing specification */
41 #define SRAM_CHK    (int)1        /* Range check processing specification */
42 #define SRAM_MAPVER (int)2        /* Map Version change support designation */
43 #define SRAM_MAPVER_CHK (int)3    /* Map Version change support + range checking specification */
44 #define SRAM_SYSTEM_INIT (int)4   /* System initialization processing specification */
45 #define SRAM_CONFIG_INIT (int)5   /* Reset setting */
46
47 /* Processing result */
48 #define SRAM_CHK_OK   (int)0      /* SRAM checking completed normally (no change) */
49 #define SRAM_CHK_CHG  (int)1      /* SRAM checking Successful completion value is changed (Including during initialization) */
50 #define SRAM_CHK_NG   (int)-1     /* SRAM checking error */
51
52 /*
53  Constant definition
54  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
55 #define PRIM_SHM_NAME_MAX           32              /* Maximum name size */
56
57 // Local stage number of the stage start request/end request from the TSKM
58 // In XML, it is set with a direct value of 1-9, but it is left because the legacy service refers to this definition
59 enum _PRIM_FORK_STEP {
60   PRIM_STEPFORK_FIRST = 1, /* First startup step */
61   PRIM_STEPFORK_SECOND,    /* 2nd startup step */
62   PRIM_STEPFORK_THIRD,     /* 3rd startup step */
63   PRIM_STEPFORK_FOURTH,    /* 4th startup step */
64   PRIM_STEPFORK_FIFTH,     /* 5th startup step */
65   PRIM_STEPFORK_SIXTH,     /* 6th startup step */
66   PRIM_STEPFORK_SEVENTH,   /* 7th startup step */
67   PRIM_STEPFORK_EIGHTH,    /* 8th startup step */ /* #GPF_10_018 */
68   PRIM_STEPFORK_NINTH,     /* 9th startup step */ /* #GPF_10_018 */
69   PRIM_STEPFORK_TENTH,     /* 10th startup step */ /* #GPF_10_018 */
70   PRIM_STEPFORK_MAX        /* Maximum number of Gradual startup steps */ /* Used for judgment when receiving gradual startup */
71 };
72
73 enum _PRIM_ACCOFF_STEP {
74   PRIM_ACCOFF_FIRST = 1, /* First step */
75   PRIM_ACCOFF_SECOND,    /* 2nd step */
76   PRIM_ACCOFF_THIRD,     /* 3rd step */
77   PRIM_ACCOFF_FOURTH,    /* 4th step */
78   PRIM_ACCOFF_FIFTH,     /* 5th step */
79   PRIM_ACCOFF_MAX        /* Total number of ACC-OFF steps */ /* Used for judgment when receiving ACC-OFF instruction */
80 };
81
82 /******************************************************************************
83  * TAG        : PRIM_SHAREDATA_TBL
84  * ABSTRACT   : Shared data table
85  * NOTE       :
86  ******************************************************************************/
87 /* Structure of shared data table */
88 typedef struct {
89   char shmName[PRIM_SHM_NAME_MAX];  /* Shared data name */
90   int32_t size;                     /* Shared data size */
91 } PRIM_SHAREDATA_TBL;
92
93 /******************************************************************************
94  * TAG        : PRIM_FORK_TBL
95  * ABSTRACT   : Startup process table
96  * NOTE       :
97  ******************************************************************************/
98 typedef struct {
99   PRI_DWORD (*threadFunc)(void* prm); /* Thread function */
100   void* prm; /* Thread startup parameters */
101   uint32_t priority; /* Thread priority */
102   uint16_t pno; /* Thuread number */
103   uint8_t rsv; /* Reserved field */
104   uint8_t wakeLocalStep; /* Startup step */
105   // The following is valid only when useLegacy = FALSE
106   char threadName[16]; /* Thread name */
107   char downLocalStep; /* When the termination step is 0, termination notification is not issued */
108   void* primaryLocal; /* Local area for libPrimary (cannot be changed) */
109 } PRIM_FORK_TBL;
110
111 /******************************************************************************
112  * TAG        : PRIM_EXFUNC_TBL
113  * ABSTRACT   : Feature extension table
114  ******************************************************************************/
115 typedef struct {
116   void (*func)(void* prm); /* Feature extension function */
117   void* prm; /* parameters         */
118   uint8_t localStep; /* Startup step */
119   uint8_t rsv[3]; /* Reserved     */
120 } PRIM_EXFUNC_TBL;
121
122 /******************************************************************************
123  * TAG        : PRIM_BACKUPCHK_TBL
124  * ABSTRACT   : Function table for check backup data
125  ******************************************************************************/
126 typedef struct {
127   int32_t (*func)(int32_t kind); /* Feature Extension Functions */
128 } PRIM_BACKUPCHK_TBL;
129
130 /******************************************************************************
131  * TAG        : PRIM_ACCOFF_TBL
132  * ABSTRACT   : ACC-OFF process table
133  ******************************************************************************/
134 typedef struct {
135   uint32_t localStep; /* ACC-OFF process step  */
136   uint16_t pno; /* PNO of Notification destination        */
137   uint8_t rsv[2];
138 } PRIM_ACCOFF_TBL;
139
140 #endif  // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
141 /*
142  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
143  End of File : Primary_common.h
144  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
145  */
146 /** @}*/
147 /** @}*/
148 /** @}*/