ONLP
Open Network Linux Platform APIs
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables

Data Structures

struct  onlp_fan_info_s
 

Macros

#define ONLP_FAN_INFO_CAP_IS_SET(_pinfo, _name)   ((_pinfo)->caps & ONLP_FAN_CAPS_##_name)
 Determine if a fan capability is set.
 
#define ONLP_FAN_STATUS_PRESENT(_fi)   ((_fi).hdr.status & ONLP_OID_STATUS.PRESENT)
 
#define ONLP_FAN_STATUS_MISSING(_fi)   (!ONLP_FAN_INFO_PRESENT(_fi))
 
#define ONLP_FAN_STATUS_FAILED(_fi)   ( (_fi).hdr.status & ONLP_OID_STATUS.FAILED)
 
#define ONLP_FAN_STATUS_NORMAL(_fi)   ( ONLP_FAN_STATUS_PRESENT(_fi) && !ONLP_FAN_STATUS_FAILED(_fi) )
 
#define ONLP_FAN_CAPS_VALID(_e)   (onlp_fan_caps_valid((_e)))
 
#define ONLP_FAN_DIR_STRINGS
 
#define ONLP_FAN_DIR_VALID(_e)   ( (0 <= (_e)) && ((_e) <= ONLP_FAN_DIR_F2B))
 

Typedefs

typedef enum onlp_fan_caps_e onlp_fan_caps_t
 
typedef enum onlp_fan_dir_e onlp_fan_dir_t
 
typedef struct onlp_fan_info_s onlp_fan_info_t
 

Enumerations

enum  onlp_fan_caps_e {
  ONLP_FAN_CAPS_SET_DIR = (1 << 0),
  ONLP_FAN_CAPS_GET_DIR = (1 << 1),
  ONLP_FAN_CAPS_SET_RPM = (1 << 2),
  ONLP_FAN_CAPS_SET_PERCENTAGE = (1 << 3),
  ONLP_FAN_CAPS_GET_RPM = (1 << 4),
  ONLP_FAN_CAPS_GET_PERCENTAGE = (1 << 5)
}
 
enum  onlp_fan_dir_e {
  ONLP_FAN_DIR_UNKNOWN,
  ONLP_FAN_DIR_B2F,
  ONLP_FAN_DIR_F2B,
  ONLP_FAN_DIR_LAST = ONLP_FAN_DIR_F2B,
  ONLP_FAN_DIR_COUNT,
  ONLP_FAN_DIR_INVALID = -1
}
 

Functions

int onlp_fan_sw_init (void)
 Software Initialization of the Fan module.
 
int onlp_fan_hw_init (uint32_t flags)
 Hardware Initialization of the Fan module. More...
 
int onlp_fan_sw_denit (void)
 Deinitialize the fan software module. More...
 
int onlp_fan_hdr_get (onlp_oid_t oid, onlp_oid_hdr_t *hdr)
 Retrieve the fan's OID hdr. More...
 
int onlp_fan_info_get (onlp_oid_t oid, onlp_fan_info_t *rv)
 Retrieve fan information. More...
 
int onlp_fan_caps_get (onlp_oid_t oid, uint32_t *caps)
 Retrieve the fan capabilities. More...
 
int onlp_fan_rpm_set (onlp_oid_t oid, int rpm)
 Set the fan speed in RPMs. More...
 
int onlp_fan_percentage_set (onlp_oid_t oid, int p)
 Set the fan speed in percentage. More...
 
int onlp_fan_dir_set (onlp_oid_t oid, onlp_fan_dir_t dir)
 Set the fan direction. More...
 
int onlp_fan_info_to_user_json (onlp_fan_info_t *info, cJSON **cj, uint32_t flags)
 Convert a fan info structure to user JSON. More...
 
int onlp_fan_info_to_json (onlp_fan_info_t *info, cJSON **cj, uint32_t flags)
 Convert a fan info structure to JSON. More...
 
int onlp_fan_info_from_json (cJSON *cj, onlp_fan_info_t *info)
 Convert a JSON object to a fan info structure. More...
 
const char * onlp_fan_caps_name (onlp_fan_caps_t e)
 
int onlp_fan_caps_value (const char *str, onlp_fan_caps_t *e, int substr)
 
const char * onlp_fan_caps_desc (onlp_fan_caps_t e)
 
int onlp_fan_caps_valid (onlp_fan_caps_t e)
 
const char * onlp_fan_dir_name (onlp_fan_dir_t e)
 
int onlp_fan_dir_value (const char *str, onlp_fan_dir_t *e, int substr)
 
const char * onlp_fan_dir_desc (onlp_fan_dir_t e)
 

Variables

aim_map_si_t onlp_fan_caps_map []
 
aim_map_si_t onlp_fan_caps_desc_map []
 
aim_map_si_t onlp_fan_dir_map []
 
aim_map_si_t onlp_fan_dir_desc_map []
 

Detailed Description

Macro Definition Documentation

◆ ONLP_FAN_CAPS_VALID

#define ONLP_FAN_CAPS_VALID (   _e)    (onlp_fan_caps_valid((_e)))

validator

◆ ONLP_FAN_DIR_STRINGS

#define ONLP_FAN_DIR_STRINGS
Value:
{\
"UNKNOWN", \
"B2F", \
"F2B", \
}

Strings macro.

◆ ONLP_FAN_DIR_VALID

#define ONLP_FAN_DIR_VALID (   _e)    ( (0 <= (_e)) && ((_e) <= ONLP_FAN_DIR_F2B))

validator

◆ ONLP_FAN_STATUS_FAILED

#define ONLP_FAN_STATUS_FAILED (   _fi)    ( (_fi).hdr.status & ONLP_OID_STATUS.FAILED)

Fan has failed.

◆ ONLP_FAN_STATUS_MISSING

#define ONLP_FAN_STATUS_MISSING (   _fi)    (!ONLP_FAN_INFO_PRESENT(_fi))

Fan is missing.

◆ ONLP_FAN_STATUS_NORMAL

#define ONLP_FAN_STATUS_NORMAL (   _fi)    ( ONLP_FAN_STATUS_PRESENT(_fi) && !ONLP_FAN_STATUS_FAILED(_fi) )

Fan is operating normally

◆ ONLP_FAN_STATUS_PRESENT

#define ONLP_FAN_STATUS_PRESENT (   _fi)    ((_fi).hdr.status & ONLP_OID_STATUS.PRESENT)

Fan is present.

Typedef Documentation

◆ onlp_fan_caps_t

onlp_fan_caps

◆ onlp_fan_dir_t

onlp_fan_dir

◆ onlp_fan_info_t

Fan information structure.

Enumeration Type Documentation

◆ onlp_fan_caps_e

onlp_fan_caps

38  {
39  ONLP_FAN_CAPS_SET_DIR = (1 << 0),
40  ONLP_FAN_CAPS_GET_DIR = (1 << 1),
41  ONLP_FAN_CAPS_SET_RPM = (1 << 2),
42  ONLP_FAN_CAPS_SET_PERCENTAGE = (1 << 3),
43  ONLP_FAN_CAPS_GET_RPM = (1 << 4),
44  ONLP_FAN_CAPS_GET_PERCENTAGE = (1 << 5),
enum onlp_fan_caps_e onlp_fan_caps_t

◆ onlp_fan_dir_e

onlp_fan_dir

48  {
49  ONLP_FAN_DIR_UNKNOWN,
50  ONLP_FAN_DIR_B2F,
51  ONLP_FAN_DIR_F2B,
52  ONLP_FAN_DIR_LAST = ONLP_FAN_DIR_F2B,
53  ONLP_FAN_DIR_COUNT,
54  ONLP_FAN_DIR_INVALID = -1,
enum onlp_fan_dir_e onlp_fan_dir_t

Function Documentation

◆ onlp_fan_caps_desc()

const char* onlp_fan_caps_desc ( onlp_fan_caps_t  e)

Enum descriptions.

◆ onlp_fan_caps_get()

int onlp_fan_caps_get ( onlp_oid_t  oid,
uint32_t *  caps 
)

Retrieve the fan capabilities.

Parameters
oidThe fan OID.
[out]capsReceives the fan capabilities.

◆ onlp_fan_caps_name()

const char* onlp_fan_caps_name ( onlp_fan_caps_t  e)

Enum names.

◆ onlp_fan_caps_valid()

int onlp_fan_caps_valid ( onlp_fan_caps_t  e)

Enum validator.

◆ onlp_fan_caps_value()

int onlp_fan_caps_value ( const char *  str,
onlp_fan_caps_t e,
int  substr 
)

Enum values.

◆ onlp_fan_dir_desc()

const char* onlp_fan_dir_desc ( onlp_fan_dir_t  e)

Enum descriptions.

◆ onlp_fan_dir_name()

const char* onlp_fan_dir_name ( onlp_fan_dir_t  e)

Enum names.

◆ onlp_fan_dir_set()

int onlp_fan_dir_set ( onlp_oid_t  oid,
onlp_fan_dir_t  dir 
)

Set the fan direction.

Parameters
oidThe fan OID.
dirThe fan direction (B2F or F2B)
Note
Only called if both capabilities are set.

◆ onlp_fan_dir_value()

int onlp_fan_dir_value ( const char *  str,
onlp_fan_dir_t e,
int  substr 
)

Enum values.

◆ onlp_fan_hdr_get()

int onlp_fan_hdr_get ( onlp_oid_t  oid,
onlp_oid_hdr_t hdr 
)

Retrieve the fan's OID hdr.

Parameters
oidThe fan OID.
[out]hdrReceives the OID header.

◆ onlp_fan_hw_init()

int onlp_fan_hw_init ( uint32_t  flags)

Hardware Initialization of the Fan module.

Parameters
flagsThe hardware initialization flags.

◆ onlp_fan_info_from_json()

int onlp_fan_info_from_json ( cJSON *  cj,
onlp_fan_info_t info 
)

Convert a JSON object to a fan info structure.

Parameters
cjThe JSON object.
[out]infoRecieves the fan info structure.

◆ onlp_fan_info_get()

int onlp_fan_info_get ( onlp_oid_t  oid,
onlp_fan_info_t rv 
)

Retrieve fan information.

Parameters
oidThe fan OID.
[out]rvReceives the fan information.

◆ onlp_fan_info_to_json()

int onlp_fan_info_to_json ( onlp_fan_info_t info,
cJSON **  cj,
uint32_t  flags 
)

Convert a fan info structure to JSON.

Parameters
infoThe fan info structure.
[out]cjReceives the JSON object.
flagsThe JSON format flags.

◆ onlp_fan_info_to_user_json()

int onlp_fan_info_to_user_json ( onlp_fan_info_t info,
cJSON **  cj,
uint32_t  flags 
)

Convert a fan info structure to user JSON.

Parameters
infoThe fan info structure.
[out]cjReceives the JSON object.
flagsThe JSON format flags.

◆ onlp_fan_percentage_set()

int onlp_fan_percentage_set ( onlp_oid_t  oid,
int  p 
)

Set the fan speed in percentage.

Parameters
oidThe fan OID.
pThe percentage.
Note
Only valid if the fan has the SET_PERCENTAGE capability.

◆ onlp_fan_rpm_set()

int onlp_fan_rpm_set ( onlp_oid_t  oid,
int  rpm 
)

Set the fan speed in RPMs.

Parameters
oidThe fan OID.
rpmThe new RPM.
Note
Only valid if the fan has the SET_RPM capability.

◆ onlp_fan_sw_denit()

int onlp_fan_sw_denit ( void  )

Deinitialize the fan software module.

Note
The primary purpose of this API is to properly deallocate any resources used by the module in order faciliate detection of real resouce leaks.

Variable Documentation

◆ onlp_fan_caps_desc_map

aim_map_si_t onlp_fan_caps_desc_map[]

onlp_fan_caps_desc_map table.

◆ onlp_fan_caps_map

aim_map_si_t onlp_fan_caps_map[]

onlp_fan_caps_map table.

◆ onlp_fan_dir_desc_map

aim_map_si_t onlp_fan_dir_desc_map[]

onlp_fan_dir_desc_map table.

◆ onlp_fan_dir_map

aim_map_si_t onlp_fan_dir_map[]

onlp_fan_dir_map table.