Add gitlab issue/merge request templates
[staging/basesystem.git] / service / system / task_manager / include-share / tskm_gstep.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 #ifndef TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
18 #define TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
19
20 #include  "system_service/tskm_local_type.h"
21 #include  "tskm_debug.h"
22
23 /*********************************************************
24  *        Get gradual startup current info
25  *********************************************************/
26 inline TSKM_STATIC TSKM_BOOL_t gstepIsLast(TSKM_GSTEP_CTX_t* p_gstep) {
27   if (p_gstep->gstepNum == p_gstep->gstepIdx + 1) {
28     return TSKM_TRUE;
29   }
30   return TSKM_FALSE;
31 }
32
33 /*********************************************************
34  *        Get gradual startup current info
35  *********************************************************/
36 inline TSKM_STATIC TSKM_GSTEP_t*
37 gstepGetCurrent(TSKM_GSTEP_CTX_t* p_gstep) {
38   if (p_gstep->gstepNum > p_gstep->gstepIdx) {
39     return &p_gstep->gstep[p_gstep->gstepIdx];
40   }
41   return NULL;
42 }
43
44 /*********************************************************
45  *        Issue requests waiting for exec completion
46  *********************************************************/
47 inline TSKM_STATIC TSKM_GSTEP_t*
48 changeNextStep(TSKM_GSTEP_CTX_t* p_gstep) {
49   p_gstep->gstepIdx++;
50   return gstepGetCurrent(p_gstep);
51 }
52
53 #endif  // TASK_MANAGER_INCLUDE_SHARE_TSKM_GSTEP_H_
54