summaryrefslogtreecommitdiffstats
path: root/task_manager/server/include/system_service/Primary_common.h
blob: e0624bba7e58c217b7660f713330a17abf6fd37c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @file Primary_common.h
 * @brief \~english This file contains declaration of common enum and structures
 */
/** @addtogroup BaseSystem
 *  @{
 */
/** @addtogroup system_service
 *  @ingroup BaseSystem
 *  @{
 */
/** @addtogroup task_manager
 *  @ingroup system_service
 *  @{
 */
#ifndef TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
#define TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_

#include <stdint.h>
#include <pthread.h>

typedef unsigned int PRI_DWORD;    // To eliminate the DWORD

/* SRAM process type */
#define SRAM_INIT   (int)0        /* Initialization processing specification */
#define SRAM_CHK    (int)1        /* Range check processing specification */
#define SRAM_MAPVER (int)2        /* Map Version change support designation */
#define SRAM_MAPVER_CHK (int)3    /* Map Version change support + range checking specification */
#define SRAM_SYSTEM_INIT (int)4   /* System initialization processing specification */
#define SRAM_CONFIG_INIT (int)5   /* Reset setting */

/* Processing result */
#define SRAM_CHK_OK   (int)0      /* SRAM checking completed normally (no change) */
#define SRAM_CHK_CHG  (int)1      /* SRAM checking Successful completion value is changed (Including during initialization) */
#define SRAM_CHK_NG   (int)-1     /* SRAM checking error */

/*
 Constant definition
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#define PRIM_SHM_NAME_MAX           32              /* Maximum name size */

// Local stage number of the stage start request/end request from the TSKM
// In XML, it is set with a direct value of 1-9, but it is left because the legacy service refers to this definition
enum _PRIM_FORK_STEP {
  PRIM_STEPFORK_FIRST = 1, /* First startup step */
  PRIM_STEPFORK_SECOND,    /* 2nd startup step */
  PRIM_STEPFORK_THIRD,     /* 3rd startup step */
  PRIM_STEPFORK_FOURTH,    /* 4th startup step */
  PRIM_STEPFORK_FIFTH,     /* 5th startup step */
  PRIM_STEPFORK_SIXTH,     /* 6th startup step */
  PRIM_STEPFORK_SEVENTH,   /* 7th startup step */
  PRIM_STEPFORK_EIGHTH,    /* 8th startup step */ /* #GPF_10_018 */
  PRIM_STEPFORK_NINTH,     /* 9th startup step */ /* #GPF_10_018 */
  PRIM_STEPFORK_TENTH,     /* 10th startup step */ /* #GPF_10_018 */
  PRIM_STEPFORK_MAX        /* Maximum number of Gradual startup steps */ /* Used for judgment when receiving gradual startup */
};

enum _PRIM_ACCOFF_STEP {
  PRIM_ACCOFF_FIRST = 1, /* First step */
  PRIM_ACCOFF_SECOND,    /* 2nd step */
  PRIM_ACCOFF_THIRD,     /* 3rd step */
  PRIM_ACCOFF_FOURTH,    /* 4th step */
  PRIM_ACCOFF_FIFTH,     /* 5th step */
  PRIM_ACCOFF_MAX        /* Total number of ACC-OFF steps */ /* Used for judgment when receiving ACC-OFF instruction */
};

/******************************************************************************
 * TAG        : PRIM_SHAREDATA_TBL
 * ABSTRACT   : Shared data table
 * NOTE       :
 ******************************************************************************/
/* Structure of shared data table */
typedef struct {
  char shmName[PRIM_SHM_NAME_MAX];  /* Shared data name */
  int32_t size;                     /* Shared data size */
} PRIM_SHAREDATA_TBL;

/******************************************************************************
 * TAG        : PRIM_FORK_TBL
 * ABSTRACT   : Startup process table
 * NOTE       :
 ******************************************************************************/
typedef struct {
  PRI_DWORD (*threadFunc)(void* prm); /* Thread function */
  void* prm; /* Thread startup parameters */
  uint32_t priority; /* Thread priority */
  uint16_t pno; /* Thuread number */
  uint8_t rsv; /* Reserved field */
  uint8_t wakeLocalStep; /* Startup step */
  // The following is valid only when useLegacy = FALSE
  char threadName[16]; /* Thread name */
  char downLocalStep; /* When the termination step is 0, termination notification is not issued */
  void* primaryLocal; /* Local area for libPrimary (cannot be changed) */
} PRIM_FORK_TBL;

/******************************************************************************
 * TAG        : PRIM_EXFUNC_TBL
 * ABSTRACT   : Feature extension table
 ******************************************************************************/
typedef struct {
  void (*func)(void* prm); /* Feature extension function */
  void* prm; /* parameters         */
  uint8_t localStep; /* Startup step */
  uint8_t rsv[3]; /* Reserved     */
} PRIM_EXFUNC_TBL;

/******************************************************************************
 * TAG        : PRIM_BACKUPCHK_TBL
 * ABSTRACT   : Function table for check backup data
 ******************************************************************************/
typedef struct {
  int32_t (*func)(int32_t kind); /* Feature Extension Functions */
} PRIM_BACKUPCHK_TBL;

/******************************************************************************
 * TAG        : PRIM_ACCOFF_TBL
 * ABSTRACT   : ACC-OFF process table
 ******************************************************************************/
typedef struct {
  uint32_t localStep; /* ACC-OFF process step  */
  uint16_t pno; /* PNO of Notification destination        */
  uint8_t rsv[2];
} PRIM_ACCOFF_TBL;

#endif  // TASK_MANAGER_SERVER_INCLUDE_SYSTEM_SERVICE_PRIMARY_COMMON_H_
/*
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 End of File : Primary_common.h
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */
/** @}*/
/** @}*/
/** @}*/