1 /*
2  * Copyright (C) 2003-2015 FreeIPMI Core Team
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  */
18 
19 #ifndef IPMI_SENSOR_UNITS_SPEC_H
20 #define IPMI_SENSOR_UNITS_SPEC_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define IPMI_SENSOR_UNIT_UNSPECIFIED             0
27 #define IPMI_SENSOR_UNIT_DEGREES_C               1
28 #define IPMI_SENSOR_UNIT_DEGREES_F               2
29 #define IPMI_SENSOR_UNIT_DEGREES_K               3
30 #define IPMI_SENSOR_UNIT_VOLTS                   4
31 #define IPMI_SENSOR_UNIT_AMPS                    5
32 #define IPMI_SENSOR_UNIT_WATTS                   6
33 #define IPMI_SENSOR_UNIT_JOULES                  7
34 #define IPMI_SENSOR_UNIT_COULOMBS                8
35 #define IPMI_SENSOR_UNIT_VA                      9
36 #define IPMI_SENSOR_UNIT_NITS                   10
37 #define IPMI_SENSOR_UNIT_LUMEN                  11
38 #define IPMI_SENSOR_UNIT_LUX                    12
39 #define IPMI_SENSOR_UNIT_CANDELA                13
40 #define IPMI_SENSOR_UNIT_KPA                    14
41 #define IPMI_SENSOR_UNIT_PSI                    15
42 #define IPMI_SENSOR_UNIT_NEWTON                 16
43 #define IPMI_SENSOR_UNIT_CFM                    17
44 #define IPMI_SENSOR_UNIT_RPM                    18
45 #define IPMI_SENSOR_UNIT_HZ                     19
46 #define IPMI_SENSOR_UNIT_MICROSECOND            20
47 #define IPMI_SENSOR_UNIT_MILLISECOND            21
48 #define IPMI_SENSOR_UNIT_SECOND                 22
49 #define IPMI_SENSOR_UNIT_MINUTE                 23
50 #define IPMI_SENSOR_UNIT_HOUR                   24
51 #define IPMI_SENSOR_UNIT_DAY                    25
52 #define IPMI_SENSOR_UNIT_WEEK                   26
53 #define IPMI_SENSOR_UNIT_MIL                    27
54 #define IPMI_SENSOR_UNIT_INCHES                 28
55 #define IPMI_SENSOR_UNIT_FEET                   29
56 #define IPMI_SENSOR_UNIT_CU_IN                  30
57 #define IPMI_SENSOR_UNIT_CU_FEET                31
58 #define IPMI_SENSOR_UNIT_MM                     32
59 #define IPMI_SENSOR_UNIT_CM                     33
60 #define IPMI_SENSOR_UNIT_M                      34
61 #define IPMI_SENSOR_UNIT_CU_CM                  35
62 #define IPMI_SENSOR_UNIT_CU_M                   36
63 #define IPMI_SENSOR_UNIT_LITERS                 37
64 #define IPMI_SENSOR_UNIT_FLUID_OUNCE            38
65 #define IPMI_SENSOR_UNIT_RADIANS                39
66 #define IPMI_SENSOR_UNIT_STERADIANS             40
67 #define IPMI_SENSOR_UNIT_REVOLUTIONS            41
68 #define IPMI_SENSOR_UNIT_CYCLES                 42
69 #define IPMI_SENSOR_UNIT_GRAVITIES              43
70 #define IPMI_SENSOR_UNIT_OUNCE                  44
71 #define IPMI_SENSOR_UNIT_POUND                  45
72 #define IPMI_SENSOR_UNIT_FT_LB                  46
73 #define IPMI_SENSOR_UNIT_OZ_IN                  47
74 #define IPMI_SENSOR_UNIT_GAUSS                  48
75 #define IPMI_SENSOR_UNIT_GILBERTS               49
76 #define IPMI_SENSOR_UNIT_HENRY                  50
77 #define IPMI_SENSOR_UNIT_MILLIHENRY             51
78 #define IPMI_SENSOR_UNIT_FARAD                  52
79 #define IPMI_SENSOR_UNIT_MICROFARAD             53
80 #define IPMI_SENSOR_UNIT_OHMS                   54
81 #define IPMI_SENSOR_UNIT_SIEMENS                55
82 #define IPMI_SENSOR_UNIT_MOLE                   56
83 #define IPMI_SENSOR_UNIT_BECQUEREL              57
84 #define IPMI_SENSOR_UNIT_PPM                    58
85 #define IPMI_SENSOR_UNIT_RESERVED               59
86 #define IPMI_SENSOR_UNIT_DECIBELS               60
87 #define IPMI_SENSOR_UNIT_DBA                    61
88 #define IPMI_SENSOR_UNIT_DBC                    62
89 #define IPMI_SENSOR_UNIT_GRAY                   63
90 #define IPMI_SENSOR_UNIT_SIEVERT                64
91 #define IPMI_SENSOR_UNIT_COLOR_TEMP_DEG_K       65
92 #define IPMI_SENSOR_UNIT_BIT                    66
93 #define IPMI_SENSOR_UNIT_KILOBIT                67
94 #define IPMI_SENSOR_UNIT_MEGABIT                68
95 #define IPMI_SENSOR_UNIT_GIGABIT                69
96 #define IPMI_SENSOR_UNIT_BYTE                   70
97 #define IPMI_SENSOR_UNIT_KILOBYTE               71
98 #define IPMI_SENSOR_UNIT_MEGABYTE               72
99 #define IPMI_SENSOR_UNIT_GIGABYTE               73
100 #define IPMI_SENSOR_UNIT_WORD                   74
101 #define IPMI_SENSOR_UNIT_DWORD                  75
102 #define IPMI_SENSOR_UNIT_QWORD                  76
103 #define IPMI_SENSOR_UNIT_LINE                   77
104 #define IPMI_SENSOR_UNIT_HIT                    78
105 #define IPMI_SENSOR_UNIT_MISS                   79
106 #define IPMI_SENSOR_UNIT_RETRY                  80
107 #define IPMI_SENSOR_UNIT_RESET                  81
108 #define IPMI_SENSOR_UNIT_OVERRUN_OVERFLOW       82
109 #define IPMI_SENSOR_UNIT_UNDERRUN               83
110 #define IPMI_SENSOR_UNIT_COLLISION              84
111 #define IPMI_SENSOR_UNIT_PACKETS                85
112 #define IPMI_SENSOR_UNIT_MESSAGES               86
113 #define IPMI_SENSOR_UNIT_CHARACTERS             87
114 #define IPMI_SENSOR_UNIT_ERROR                  88
115 #define IPMI_SENSOR_UNIT_CORRECTABLE_ERROR      89
116 #define IPMI_SENSOR_UNIT_UNCORRECTABLE_ERROR    90
117 #define IPMI_SENSOR_UNIT_FATAL_ERROR            91
118 #define IPMI_SENSOR_UNIT_GRAMS                  92
119 
120 /* To avoid gcc warnings, add +1 in comparison */
121 #define IPMI_SENSOR_UNIT_VALID(__sensor_unit)            \
122   (((__sensor_unit + 1) >= (IPMI_SENSOR_UNIT_UNSPECIFIED + 1) \
123     && (__sensor_unit) <= IPMI_SENSOR_UNIT_GRAMS) ? 1 : 0)
124 
125 #define IPMI_SENSOR_RATE_UNIT_NONE               0
126 #define IPMI_SENSOR_RATE_UNIT_PER_US             1
127 #define IPMI_SENSOR_RATE_UNIT_PER_MS             2
128 #define IPMI_SENSOR_RATE_UNIT_PER_S              3
129 #define IPMI_SENSOR_RATE_UNIT_PER_MINUTE         4
130 #define IPMI_SENSOR_RATE_UNIT_PER_HOUR           5
131 #define IPMI_SENSOR_RATE_UNIT_PER_DAY            6
132 
133 /* To avoid gcc warnings, add +1 in comparison */
134 #define IPMI_SENSOR_RATE_UNIT_VALID(__sensor_rate_unit)     \
135   (((__sensor_rate_unit + 1) >= (IPMI_SENSOR_RATE_UNIT_NONE + 1) \
136     && (__sensor_rate_unit) <= IPMI_SENSOR_RATE_UNIT_PER_DAY) ? 1 : 0)
137 
138 extern const char *const ipmi_sensor_units[];
139 extern const char *const ipmi_sensor_units_abbreviated[];
140 extern const char *const ipmi_sensor_rate_units[];
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif /* IPMI_SENSOR_UNITS_SPEC_H */
147