• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef UTILS_COMMON_TIMER_ERRORS_H
17 #define UTILS_COMMON_TIMER_ERRORS_H
18 
19 #include <errno.h>
20 #include "errors.h"
21 #include "common_errors.h"
22 
23 namespace OHOS {
24 namespace Utils {
25 
26 /**
27  * ErrCode layout
28  *
29  * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
30  * | Bit |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00|
31  * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
32  * |Field|Reserved|        Subsystem      |  Module      |                  Code                         |
33  * +-----+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
34  *
35  * In this file, subsystem is "SUBSYS_COMMON" and module is "MODULE_TIMER".
36  */
37 
38 using ErrCode = int;
39 
40 // offset of timer module error, only be used in this file.
41 constexpr ErrCode COMMON_TIMER_ERR_OFFSET = ErrCodeOffset(SUBSYS_COMMON, MODULE_TIMER);
42 
43 enum {
44     TIMER_ERR_OK                = 0,
45     TIMER_ERR_DEAL_FAILED       = COMMON_TIMER_ERR_OFFSET + EAGAIN,
46     TIMER_ERR_BADF              = COMMON_TIMER_ERR_OFFSET + EBADF,
47     TIMER_ERR_INVALID_VALUE     = COMMON_TIMER_ERR_OFFSET + EINVAL
48 };
49 
50 } // Utils
51 } // OHOS
52 
53 #endif