7.5.3
Reading Sensors
The IPMI specification supports many commands to manage and interrogate sensors. The
following program fragment illustrates how the current reading of a sensor can be obtained.
/* network function codes */
#define NFC_SENSOR_EVENT_RQ 0x04
/* commands */
#define CMD_GET_SENS_RD
0x2D
/* Get sensor reading */
/* Completion codes */
#define COMPLETION_OK
0
/* Completion code OK */
/* error codes */
#define E_OK
0
/* OK */
#define E_COMPLETION
0x400
/* wrong completion code */
/* forward declarations */
void vBmcSmicSmsMessageWrite (const unsigned char *pbMessage,
unsigned char bLength);
void vBmcSmicSmsMessageRead (unsigned char *pbMessage,
unsigned char *bMessageLength);
/* response data structure provided to wGetSensorReadingCmd() */
struct SENSOR_READING
{
unsigned char bData;
unsigned char bStatus;
};
/******************************************************************************
*
* wGetSensorReadingCmd
*
* This function gets current sensor reading.
*
* RETURNS: E_OK if it is OK, or error code
*
*/
unsigned short int wGetSensorReadingCmd
(
unsigned char bSensorId,
struct SENSOR_READING *psSensorReading
)
{
unsigned char bLength;
unsigned char abRequest [10];
unsigned char abResponse [10];
unsigned short int wStatus = E_OK;
/* Send Request */
abRequest [0] = NFC_SENSOR_EVENT_RQ << 2;
PP 110/01x
7-19
Intelligent Platform Manager Interface
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com