summaryrefslogtreecommitdiffstats
path: root/common/recipes-lib/sdr/files/sdr.h
blob: c474fb10ebe273d8ea2d0806e73f229692394296 (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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
 *
 * Copyright 2015-present Facebook. All Rights Reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef __SDR_H__
#define __SDR_H__

#include <stdbool.h>
#include <openbmc/ipmi.h>

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_SDR_LEN           64


#define MAX_SENSOR_RATE_UNIT  7
#define MAX_SENSOR_BASE_UNIT  92

typedef struct _sensor_info_t {
  bool valid;
  sdr_full_t sdr;
} sensor_info_t;

/* List of all the Sensor Rate Units types. */
const char * sensor_rate_units[] = {
  "",             /* 0x00 */
  "per \xC2\xB5s",  /* 0x01 */
  "per ms",         /* 0x02 */
  "per s",          /* 0x03 */
  "per min",        /* 0x04 */
  "per hour",       /* 0x05 */
  "per day",        /* 0x06 */
  "reserved",       /* 0x07 */
};


/* List of all the Sensor Base Units types. */
const char * sensor_base_units[] = {
  "",             /* 000 */
  "C",              /* 001 */
  "F",              /* 002 */
  "K",              /* 003 */
  "Volts",          /* 004 */
  "Amps",           /* 005 */
  "Watts",          /* 006 */
  "Joules",         /* 007 */
  "Coulombs",       /* 008 */
  "VA",             /* 009 */
  "Nits",           /* 010 */
  "lumen",          /* 011 */
  "lux",			      /* 012 */
  "Candela",			  /* 013 */
  "kPa",			      /* 014 */
  "PSI",			      /* 015 */
  "Newton",			    /* 016 */
  "CFM",			      /* 017 */
  "RPM",			      /* 018 */
  "Hz",			        /* 019 */
  "\xC2\xB5s",			/* 020 */
  "ms",			        /* 021 */
  "sec",			      /* 022 */
  "min",			      /* 023 */
  "hour",			      /* 024 */
  "day",			      /* 025 */
  "week",			      /* 026 */
  "mil",			      /* 027 */
  "inches",			    /* 028 */
  "feet",			      /* 029 */
  "cu in",			    /* 030 */
  "cu feet",			  /* 031 */
  "mm",			        /* 032 */
  "cm",			        /* 033 */
  "m",			        /* 034 */
  "cu cm",			    /* 035 */
  "cu m",			      /* 036 */
  "liters",			    /* 037 */
  "fluid ounce",		/* 038 */
  "radians",			  /* 039 */
  "steradians",			/* 040 */
  "revolutions",		/* 041 */
  "cycles",			    /* 042 */
  "gravities",			/* 043 */
  "ounce",			    /* 044 */
  "pound",			    /* 045 */
  "ft-lb",			    /* 046 */
  "oz-in",			    /* 047 */
  "gauss",			    /* 048 */
  "gilberts",			  /* 049 */
  "henry",			    /* 050 */
  "millihenry",			/* 051 */
  "farad",			    /* 052 */
  "microfarad",			/* 053 */
  "ohms",			      /* 054 */
  "siemens",			  /* 055 */
  "mole",			      /* 056 */
  "becquerel",			/* 057 */
  "PPM",						/* 058 */
  "reserved",				/* 059 */
  "Db",						  /* 060 */
  "DbA",						/* 061 */
  "DbC",						/* 062 */
  "gray",						/* 063 */
  "sievert",				/* 064 */
  "color temp deg K", /* 065 */
  "bit",					  /* 066 */
  "kilobit",			 	/* 067 */
  "megabit",			 	/* 068 */
  "gigabit",			 	/* 069 */
  "B",						  /* 070 */
  "KB",						  /* 071 */
  "MB",						  /* 072 */
  "GB",						  /* 073 */
  "word",						/* 074 */
  "dword",					/* 075 */
  "qword",					/* 076 */
  "line",						/* 077 */
  "hit",						/* 078 */
  "miss",						/* 079 */
  "retry",					/* 080 */
  "reset",					/* 081 */
  "overflow",				/* 082 */
  "underrun",				/* 083 */
  "collision",			/* 084 */
  "packets",				/* 085 */
  "messages",				/* 086 */
  "characters",			/* 087 */
  "error",					/* 088 */
  "correctable error",	  /* 089 */
  "uncorrectable error",	/* 090 */
  "fatal error",					/* 091 */
  "grams",					/* 092 */
  "",						    /* 093 */
};

int sdr_init(char *path, sensor_info_t *sinfo);

int sdr_get_sensor_units(sdr_full_t *sdr, uint8_t *op, uint8_t *modifier,
    char *units);
int sdr_get_sensor_name(sdr_full_t *sdr, char *name);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* __SDR_H__ */
OpenPOWER on IntegriCloud