123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- #ifndef __LIBIPMI_SENSOR_DEVICE_H__
- #define __LIBIPMI_SENSOR_DEVICE_H__
- /* LIIPMI core header files */
- #include "libipmi_session.h"
- #include "libipmi_errorcodes.h"
- #include "libsensor.h"
- /* command specific header files */
- #pragma pack(1)
- #include "com_IPMI_Sensor.h"
- #pragma pack()
- #include "com_IPMI_SensorEvent.h"
- //#include "IPMI_AMI.h"
- #ifdef __cplusplus
- extern "C" {
- #endif
- /* 35.2 Get Device SDR Info Command */
- uint16_t IPMICMD_GetSDRInfo( IPMI20_UDS_SESSION_T *pUDSSession,
- uint8_t *pReqGetSDRInfo,
- GetSDRInfoRes_T *pResGetSDRInfo,
- int timeout);
-
- /* 35.3 Get Device SDR Command */
- uint16_t IPMICMD_GetDevSDR( IPMI20_UDS_SESSION_T *pUDSSession,
- GetDevSDRReq_T *pReqDevSDR,
- GetDevSDRRes_T *pResDevSDR,
- uint32_t *pOutBuffLen,
- int timeout);
- /* 35.4 Reserve Device SDR Repository Command */
- uint16_t IPMICMD_ReserveDevSDR( IPMI20_UDS_SESSION_T *pUDSSession,
- ReserveDevSDRRes_T *pResReserveDevSDR,
- int timeout);
- /* 35.5 Get Sensor Reading Factors Command */
- uint16_t IPMICMD_GetSensorReadingFactor( IPMI20_UDS_SESSION_T *pUDSSession,
- GetSensorReadingFactorReq_T *pReqGetSensorReadingFactor,
- GetSensorReadingFactorRes_T *pResGetSensorReadingFactor,
- int timeout);
- /* 35.6 Set Sensor Hysteresis Command */
- uint16_t IPMICMD_SetSensorHysterisis( IPMI20_UDS_SESSION_T *pUDSSession,
- SetSensorHysterisisReq_T *pReqSetSensorHysterisis,
- SetSensorHysterisisRes_T *pResSetSensorHysterisis,
- int timeout);
- /* 35.7 Get Sensor Hysteresis Command */
- uint16_t IPMICMD_GetSensorHysterisis( IPMI20_UDS_SESSION_T *pUDSSession,
- GetSensorHysterisisReq_T *pReqGetSensorHysterisis,
- GetSensorHysterisisRes_T *pResGetSensorHysterisis,
- int timeout);
- /* 35.8 Set Sensor Thresholds Command */
- uint16_t IPMICMD_SetSensorThreshold( IPMI20_UDS_SESSION_T *pUDSSession,
- SetSensorThresholdReq_T *pReqSetSensorThreshold,
- SetSensorThresholdRes_T *pResSetSensorThreshold,
- int timeout);
- /* 35.9 Get Sensor Thresholds Command */
- uint16_t IPMICMD_GetSensorThreshold( IPMI20_UDS_SESSION_T *pUDSSession,
- GetSensorThresholdReq_T *pReqGetSensorThreshold,
- GetSensorThresholdRes_T *pResGetSensorThreshold,
- int timeout);
- /* 35.10 Set Sensor Event Enable Command */
- uint16_t IPMICMD_SetSensorEventEnable( IPMI20_UDS_SESSION_T *pUDSSession,
- SetSensorEventEnableReq_T *pReqSetSensorEventEnable,
- SetSensorEventEnableRes_T *pResSetSensorEventEnable,
- int timeout);
- /* 35.11 Get Sensor Event Enable Command */
- uint16_t IPMICMD_GetSensorEventEnable( IPMI20_UDS_SESSION_T *pUDSSession,
- GetSensorEventEnableReq_T *pReqGetSensorEventEnable,
- GetSensorEventEnableRes_T *pResGetSensorEventEnable,
- int timeout);
- /* 35.12 ReArm Sensor Events Command */
- uint16_t IPMICMD_ReArmSensorEvents( IPMI20_UDS_SESSION_T *pUDSSession,
- ReArmSensorReq_T *pReArmSensorReq,
- ReArmSensorRes_T *pReArmSensorRes,
- int timeout);
- /* 35.13 Get Sensor Event Status Command */
- uint16_t IPMICMD_GetSensorEventStatus( IPMI20_UDS_SESSION_T *pUDSSession,
- GetSensorEventStatusReq_T *pReqGetSensorEventStatus,
- GetSensorEventStatusRes_T *pResGetSensorEventStatus,
- int timeout);
- /* 35.14 Get Sensor Reading Command */
- uint16_t IPMICMD_GetSensorReading( IPMI20_UDS_SESSION_T *pUDSSession,
- GetSensorReadingReq_T *pReqGetSensorReading,
- GetSensorReadingRes_T *pResGetSensorReading,
- int timeout);
- /* 35.15 Set Sensor Type Command */
- uint16_t IPMICMD_SetSensorType( IPMI20_UDS_SESSION_T *pUDSSession,
- SetSensorTypeReq_T *pReqSetSensorType,
- SetSensorTypeRes_T *pResSetSensorType,
- int timeout);
- /* 35.16 Get Sensor Type Command */
- uint16_t IPMICMD_GetSensorType( IPMI20_UDS_SESSION_T *pUDSSession,
- GetSensorTypeReq_T *pReqGetSensorType,
- GetSensorTypeRes_T *pResGetSensorType,
- int timeout);
- uint16_t IPMICMD_SetSensorReading( IPMI20_UDS_SESSION_T *pUDSSession,
- SetSensorReadingReq_T *pReqSetSensorReading,
- SetSensorReadingRes_T *pResSetSensorReading,
- int timeout);
- /*------- Structure definitions and defines for HL sensor functions ---------*/
- #pragma pack( 1 )
- struct sensor_info
- {
- /* SDR Entry */
- uint8_t sdr_buffer[ 64 ];
- /*! Sensor description as a null terminated string */
- char description[ 17 ];
- /*! True if this sensor returns a discrete state */
- uint8_t discrete_sensor;
- /*! True if this sensor uses analog thresholds */
- uint8_t thresholds;
- float low_non_recov_thresh; /*!< Low non-recoverable threshold */
- float low_crit_thresh; /*!< Low critical threshold */
- float low_non_crit_thresh; /*!< Low non-critical threshold */
- float high_non_crit_thresh; /*!< High non-critical threshold */
- float high_crit_thresh; /*!< High critical threshold */
- float high_non_recov_thresh; /*!< High non-recoverable threshold */
- };
- // /* IPMI threshold state definitions for monitoring */
- // #define THRESH_UNINITIALIZED ( (u16)0x00 )
- // #define THRESH_NORMAL ( (u16)0x01 )
- // #define THRESH_UP_NONCRIT ( (u16)0x02 )
- // #define THRESH_UP_CRITICAL ( (u16)0x04 )
- // #define THRESH_LOW_NONCRIT ( (u16)0x08 )
- // #define THRESH_LOW_CRITICAL ( (u16)0x10 )
- // #define THRESH_ACCESS_FAILED ( (u16)0x20 )
- // #define THRESH_UP_NON_RECOV ( (u16)0x40 )
- // #define THRESH_LOW_NON_RECOV ( (u16)0x80 )
- #define SENSOR_NOT_AVAILABLE 0xD5
- #define UNABLE_TO_READ_SENSOR 0x20
- #define SENSOR_SCANNING_BIT 0x40
- #pragma pack()
- /*------------------------- HL sensor functions -----------------------------*/
- uint16_t
- LIBIPMI_HL_ReadSensorFromSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t *sdr_buffer,
- uint8_t *raw_reading, float *reading,
- uint8_t *discrete, int timeout );
- uint16_t
- LIBIPMI_HL_LoadSensorSDRs( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t **sdr_buffer, int *count, int timeout );
- uint16_t
- LIBIPMI_HL_GetSensorCount( IPMI20_UDS_SESSION_T *pUDSSession, int *sdr_count, int timeout );
- uint16_t
- LIBIPMI_HL_GetAllSensorReadings( IPMI20_UDS_SESSION_T *pUDSSession,
- struct sensor_data *sensor_list, uint32_t nNumSensor,int timeout );
- uint16_t
- LIBIPMI_HL_GetSensorHistoryReadingData( IPMI20_UDS_SESSION_T *pUDSSession,
- SensorhistoryData_T *pHistoryData, uint8_t nNumSensor, int timeout);
- #ifdef __cplusplus
- }
- #endif
- #endif
|