mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 01:07:01 +00:00
Thermal thresholds.
This commit is contained in:
@@ -152,6 +152,12 @@ thermal_caps: &thermal_caps
|
||||
- GET_ERROR_THRESHOLD : (1 << 2)
|
||||
- GET_SHUTDOWN_THRESHOLD : (1 << 3)
|
||||
|
||||
# Thermal threshold, in milli-celsius
|
||||
thermal_threshold: &thermal_threshold
|
||||
- WARNING_DEFAULT : 45000
|
||||
- ERROR_DEFAULT : 55000
|
||||
- SHUTDOWN_DEFAULT : 60000
|
||||
|
||||
# LED caps
|
||||
led_caps: &led_caps
|
||||
- ON_OFF : (1 << 0)
|
||||
@@ -232,6 +238,9 @@ definitions:
|
||||
onlp_thermal_caps:
|
||||
tag: thermal
|
||||
members: *thermal_caps
|
||||
onlp_thermal_threshold:
|
||||
tag: thermal
|
||||
members: *thermal_threshold
|
||||
onlp_sfp_control:
|
||||
tag: sfp1
|
||||
members:
|
||||
|
||||
@@ -56,6 +56,7 @@ ONLP_ENUMERATION_ENTRY(onlp_sfp_control_flag, "")
|
||||
ONLP_ENUMERATION_ENTRY(onlp_status, "")
|
||||
ONLP_ENUMERATION_ENTRY(onlp_thermal_caps, "")
|
||||
ONLP_ENUMERATION_ENTRY(onlp_thermal_status, "")
|
||||
ONLP_ENUMERATION_ENTRY(onlp_thermal_threshold, "")
|
||||
#undef ONLP_ENUMERATION_ENTRY
|
||||
#endif
|
||||
/* <auto.end.xenum(ALL).define> */
|
||||
|
||||
@@ -43,6 +43,13 @@ typedef enum onlp_thermal_status_e {
|
||||
ONLP_THERMAL_STATUS_PRESENT = (1 << 0),
|
||||
ONLP_THERMAL_STATUS_FAILED = (1 << 1),
|
||||
} onlp_thermal_status_t;
|
||||
|
||||
/** onlp_thermal_threshold */
|
||||
typedef enum onlp_thermal_threshold_e {
|
||||
ONLP_THERMAL_THRESHOLD_WARNING_DEFAULT = 45000,
|
||||
ONLP_THERMAL_THRESHOLD_ERROR_DEFAULT = 55000,
|
||||
ONLP_THERMAL_THRESHOLD_SHUTDOWN_DEFAULT = 60000,
|
||||
} onlp_thermal_threshold_t;
|
||||
/* <auto.end.enum(tag:thermal).define> */
|
||||
|
||||
/**
|
||||
@@ -58,6 +65,14 @@ typedef enum onlp_thermal_status_e {
|
||||
ONLP_THERMAL_CAPS_GET_ERROR_THRESHOLD | \
|
||||
ONLP_THERMAL_CAPS_GET_SHUTDOWN_THRESHOLD )
|
||||
|
||||
/**
|
||||
* Shortcut for all default thermal threshold value.
|
||||
*/
|
||||
#define ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS \
|
||||
{ ONLP_THERMAL_THRESHOLD_WARNING_DEFAULT, \
|
||||
ONLP_THERMAL_THRESHOLD_ERROR_DEFAULT, \
|
||||
ONLP_THERMAL_THRESHOLD_SHUTDOWN_DEFAULT }
|
||||
|
||||
/**
|
||||
* Thermal sensor information structure.
|
||||
*/
|
||||
@@ -183,6 +198,27 @@ int onlp_thermal_status_valid(onlp_thermal_status_t e);
|
||||
extern aim_map_si_t onlp_thermal_status_map[];
|
||||
/** onlp_thermal_status_desc_map table. */
|
||||
extern aim_map_si_t onlp_thermal_status_desc_map[];
|
||||
|
||||
/** Enum names. */
|
||||
const char* onlp_thermal_threshold_name(onlp_thermal_threshold_t e);
|
||||
|
||||
/** Enum values. */
|
||||
int onlp_thermal_threshold_value(const char* str, onlp_thermal_threshold_t* e, int substr);
|
||||
|
||||
/** Enum descriptions. */
|
||||
const char* onlp_thermal_threshold_desc(onlp_thermal_threshold_t e);
|
||||
|
||||
/** Enum validator. */
|
||||
int onlp_thermal_threshold_valid(onlp_thermal_threshold_t e);
|
||||
|
||||
/** validator */
|
||||
#define ONLP_THERMAL_THRESHOLD_VALID(_e) \
|
||||
(onlp_thermal_threshold_valid((_e)))
|
||||
|
||||
/** onlp_thermal_threshold_map table. */
|
||||
extern aim_map_si_t onlp_thermal_threshold_map[];
|
||||
/** onlp_thermal_threshold_desc_map table. */
|
||||
extern aim_map_si_t onlp_thermal_threshold_desc_map[];
|
||||
/* <auto.end.enum(tag:thermal).supportheader> */
|
||||
|
||||
#endif /* __ONLP_THERMAL_H__ */
|
||||
|
||||
@@ -1044,5 +1044,67 @@ onlp_thermal_status_valid(onlp_thermal_status_t e)
|
||||
return aim_map_si_i(NULL, e, onlp_thermal_status_map, 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
aim_map_si_t onlp_thermal_threshold_map[] =
|
||||
{
|
||||
{ "WARNING_DEFAULT", ONLP_THERMAL_THRESHOLD_WARNING_DEFAULT },
|
||||
{ "ERROR_DEFAULT", ONLP_THERMAL_THRESHOLD_ERROR_DEFAULT },
|
||||
{ "SHUTDOWN_DEFAULT", ONLP_THERMAL_THRESHOLD_SHUTDOWN_DEFAULT },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
aim_map_si_t onlp_thermal_threshold_desc_map[] =
|
||||
{
|
||||
{ "None", ONLP_THERMAL_THRESHOLD_WARNING_DEFAULT },
|
||||
{ "None", ONLP_THERMAL_THRESHOLD_ERROR_DEFAULT },
|
||||
{ "None", ONLP_THERMAL_THRESHOLD_SHUTDOWN_DEFAULT },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
const char*
|
||||
onlp_thermal_threshold_name(onlp_thermal_threshold_t e)
|
||||
{
|
||||
const char* name;
|
||||
if(aim_map_si_i(&name, e, onlp_thermal_threshold_map, 0)) {
|
||||
return name;
|
||||
}
|
||||
else {
|
||||
return "-invalid value for enum type 'onlp_thermal_threshold'";
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
onlp_thermal_threshold_value(const char* str, onlp_thermal_threshold_t* e, int substr)
|
||||
{
|
||||
int i;
|
||||
AIM_REFERENCE(substr);
|
||||
if(aim_map_si_s(&i, str, onlp_thermal_threshold_map, 0)) {
|
||||
/* Enum Found */
|
||||
*e = i;
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
const char*
|
||||
onlp_thermal_threshold_desc(onlp_thermal_threshold_t e)
|
||||
{
|
||||
const char* name;
|
||||
if(aim_map_si_i(&name, e, onlp_thermal_threshold_desc_map, 0)) {
|
||||
return name;
|
||||
}
|
||||
else {
|
||||
return "-invalid value for enum type 'onlp_thermal_threshold'";
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
onlp_thermal_threshold_valid(onlp_thermal_threshold_t e)
|
||||
{
|
||||
return aim_map_si_i(NULL, e, onlp_thermal_threshold_map, 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
/* <auto.end.enum(ALL).source> */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user