libipmi_sensor.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. #ifndef __LIBIPMI_SENSOR_DEVICE_H__
  2. #define __LIBIPMI_SENSOR_DEVICE_H__
  3. /* LIIPMI core header files */
  4. #include "libipmi_session.h"
  5. #include "libipmi_errorcodes.h"
  6. #include "libsensor.h"
  7. /* command specific header files */
  8. #pragma pack(1)
  9. #include "com_IPMI_Sensor.h"
  10. #pragma pack()
  11. #include "com_IPMI_SensorEvent.h"
  12. //#include "IPMI_AMI.h"
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /* 35.2 Get Device SDR Info Command */
  17. uint16_t IPMICMD_GetSDRInfo( IPMI20_UDS_SESSION_T *pUDSSession,
  18. uint8_t *pReqGetSDRInfo,
  19. GetSDRInfoRes_T *pResGetSDRInfo,
  20. int timeout);
  21. /* 35.3 Get Device SDR Command */
  22. uint16_t IPMICMD_GetDevSDR( IPMI20_UDS_SESSION_T *pUDSSession,
  23. GetDevSDRReq_T *pReqDevSDR,
  24. GetDevSDRRes_T *pResDevSDR,
  25. uint32_t *pOutBuffLen,
  26. int timeout);
  27. /* 35.4 Reserve Device SDR Repository Command */
  28. uint16_t IPMICMD_ReserveDevSDR( IPMI20_UDS_SESSION_T *pUDSSession,
  29. ReserveDevSDRRes_T *pResReserveDevSDR,
  30. int timeout);
  31. /* 35.5 Get Sensor Reading Factors Command */
  32. uint16_t IPMICMD_GetSensorReadingFactor( IPMI20_UDS_SESSION_T *pUDSSession,
  33. GetSensorReadingFactorReq_T *pReqGetSensorReadingFactor,
  34. GetSensorReadingFactorRes_T *pResGetSensorReadingFactor,
  35. int timeout);
  36. /* 35.6 Set Sensor Hysteresis Command */
  37. uint16_t IPMICMD_SetSensorHysterisis( IPMI20_UDS_SESSION_T *pUDSSession,
  38. SetSensorHysterisisReq_T *pReqSetSensorHysterisis,
  39. SetSensorHysterisisRes_T *pResSetSensorHysterisis,
  40. int timeout);
  41. /* 35.7 Get Sensor Hysteresis Command */
  42. uint16_t IPMICMD_GetSensorHysterisis( IPMI20_UDS_SESSION_T *pUDSSession,
  43. GetSensorHysterisisReq_T *pReqGetSensorHysterisis,
  44. GetSensorHysterisisRes_T *pResGetSensorHysterisis,
  45. int timeout);
  46. /* 35.8 Set Sensor Thresholds Command */
  47. uint16_t IPMICMD_SetSensorThreshold( IPMI20_UDS_SESSION_T *pUDSSession,
  48. SetSensorThresholdReq_T *pReqSetSensorThreshold,
  49. SetSensorThresholdRes_T *pResSetSensorThreshold,
  50. int timeout);
  51. /* 35.9 Get Sensor Thresholds Command */
  52. uint16_t IPMICMD_GetSensorThreshold( IPMI20_UDS_SESSION_T *pUDSSession,
  53. GetSensorThresholdReq_T *pReqGetSensorThreshold,
  54. GetSensorThresholdRes_T *pResGetSensorThreshold,
  55. int timeout);
  56. /* 35.10 Set Sensor Event Enable Command */
  57. uint16_t IPMICMD_SetSensorEventEnable( IPMI20_UDS_SESSION_T *pUDSSession,
  58. SetSensorEventEnableReq_T *pReqSetSensorEventEnable,
  59. SetSensorEventEnableRes_T *pResSetSensorEventEnable,
  60. int timeout);
  61. /* 35.11 Get Sensor Event Enable Command */
  62. uint16_t IPMICMD_GetSensorEventEnable( IPMI20_UDS_SESSION_T *pUDSSession,
  63. GetSensorEventEnableReq_T *pReqGetSensorEventEnable,
  64. GetSensorEventEnableRes_T *pResGetSensorEventEnable,
  65. int timeout);
  66. /* 35.12 ReArm Sensor Events Command */
  67. uint16_t IPMICMD_ReArmSensorEvents( IPMI20_UDS_SESSION_T *pUDSSession,
  68. ReArmSensorReq_T *pReArmSensorReq,
  69. ReArmSensorRes_T *pReArmSensorRes,
  70. int timeout);
  71. /* 35.13 Get Sensor Event Status Command */
  72. uint16_t IPMICMD_GetSensorEventStatus( IPMI20_UDS_SESSION_T *pUDSSession,
  73. GetSensorEventStatusReq_T *pReqGetSensorEventStatus,
  74. GetSensorEventStatusRes_T *pResGetSensorEventStatus,
  75. int timeout);
  76. /* 35.14 Get Sensor Reading Command */
  77. uint16_t IPMICMD_GetSensorReading( IPMI20_UDS_SESSION_T *pUDSSession,
  78. GetSensorReadingReq_T *pReqGetSensorReading,
  79. GetSensorReadingRes_T *pResGetSensorReading,
  80. int timeout);
  81. /* 35.15 Set Sensor Type Command */
  82. uint16_t IPMICMD_SetSensorType( IPMI20_UDS_SESSION_T *pUDSSession,
  83. SetSensorTypeReq_T *pReqSetSensorType,
  84. SetSensorTypeRes_T *pResSetSensorType,
  85. int timeout);
  86. /* 35.16 Get Sensor Type Command */
  87. uint16_t IPMICMD_GetSensorType( IPMI20_UDS_SESSION_T *pUDSSession,
  88. GetSensorTypeReq_T *pReqGetSensorType,
  89. GetSensorTypeRes_T *pResGetSensorType,
  90. int timeout);
  91. uint16_t IPMICMD_SetSensorReading( IPMI20_UDS_SESSION_T *pUDSSession,
  92. SetSensorReadingReq_T *pReqSetSensorReading,
  93. SetSensorReadingRes_T *pResSetSensorReading,
  94. int timeout);
  95. /*------- Structure definitions and defines for HL sensor functions ---------*/
  96. #pragma pack( 1 )
  97. struct sensor_info
  98. {
  99. /* SDR Entry */
  100. uint8_t sdr_buffer[ 64 ];
  101. /*! Sensor description as a null terminated string */
  102. char description[ 17 ];
  103. /*! True if this sensor returns a discrete state */
  104. uint8_t discrete_sensor;
  105. /*! True if this sensor uses analog thresholds */
  106. uint8_t thresholds;
  107. float low_non_recov_thresh; /*!< Low non-recoverable threshold */
  108. float low_crit_thresh; /*!< Low critical threshold */
  109. float low_non_crit_thresh; /*!< Low non-critical threshold */
  110. float high_non_crit_thresh; /*!< High non-critical threshold */
  111. float high_crit_thresh; /*!< High critical threshold */
  112. float high_non_recov_thresh; /*!< High non-recoverable threshold */
  113. };
  114. // /* IPMI threshold state definitions for monitoring */
  115. // #define THRESH_UNINITIALIZED ( (u16)0x00 )
  116. // #define THRESH_NORMAL ( (u16)0x01 )
  117. // #define THRESH_UP_NONCRIT ( (u16)0x02 )
  118. // #define THRESH_UP_CRITICAL ( (u16)0x04 )
  119. // #define THRESH_LOW_NONCRIT ( (u16)0x08 )
  120. // #define THRESH_LOW_CRITICAL ( (u16)0x10 )
  121. // #define THRESH_ACCESS_FAILED ( (u16)0x20 )
  122. // #define THRESH_UP_NON_RECOV ( (u16)0x40 )
  123. // #define THRESH_LOW_NON_RECOV ( (u16)0x80 )
  124. #define SENSOR_NOT_AVAILABLE 0xD5
  125. #define UNABLE_TO_READ_SENSOR 0x20
  126. #define SENSOR_SCANNING_BIT 0x40
  127. #pragma pack()
  128. /*------------------------- HL sensor functions -----------------------------*/
  129. uint16_t
  130. LIBIPMI_HL_ReadSensorFromSDR( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t *sdr_buffer,
  131. uint8_t *raw_reading, float *reading,
  132. uint8_t *discrete, int timeout );
  133. uint16_t
  134. LIBIPMI_HL_LoadSensorSDRs( IPMI20_UDS_SESSION_T *pUDSSession, uint8_t **sdr_buffer, int *count, int timeout );
  135. uint16_t
  136. LIBIPMI_HL_GetSensorCount( IPMI20_UDS_SESSION_T *pUDSSession, int *sdr_count, int timeout );
  137. uint16_t
  138. LIBIPMI_HL_GetAllSensorReadings( IPMI20_UDS_SESSION_T *pUDSSession,
  139. struct sensor_data *sensor_list, uint32_t nNumSensor,int timeout );
  140. uint16_t
  141. LIBIPMI_HL_GetSensorHistoryReadingData( IPMI20_UDS_SESSION_T *pUDSSession,
  142. SensorhistoryData_T *pHistoryData, uint8_t nNumSensor, int timeout);
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146. #endif