X hits on this document

PDF document

February 10, 2006 - page 154 / 238

532 views

0 shares

0 downloads

0 comments

154 / 238

142

CHAPTER 8. SENSORS

8.6.3

Discrete

Sensors

in

OpenIPMI

The value of a discrete sensor is its states, the value of its bits. Each bit is a single independent states; the bits are not used together to represent multi-bit values.

Discrete Sensor Readings in OpenIPMI To read the value of a discrete sensor, use the following:

t y p e d e f v o i d ( * i p m i _ s e n s o r _ s t a t e s _ c b ) ( i p m i _ s e n s o r _ t * s e n s o r int err, , i p m i _ s t a t e s _ t * s t a t e s ,

* c b _ d a t a ) *sensor, void ; i n t i p m i _ s e n s o r _ g e t _ s t a t e s ( i p m i _ s e n s o r _ t i p m i _ s t a t e s _ r e a d _ c b d o n e ,

void

* c b _ d a t a ) ;

_ _ int ipmi_discrete_event_readable(ipmi sensor t *sensor,

int

event,

int

*val);

The values are returned in the states object. To know if a specific state will be set in the states structure for a sensor, use the function:

will return true if the given state (bit) is set and false if it is not set.

This will set val to if the bit for the given sensor will support being read. Once you know if the bit is supported, the function:

i n t i p m i _ i s _ s t a t e _ s e t ( i p m i _ s t a t e s _ t * s t a t e s ,

int

s t a t e _ n u m ) ;

int

offset,

_ _ _ enum ipmi event dir e dir,

int

*val);

Discrete Sensor Events in OpenIPMI To know if a specific bit can cause an event to be sent by the sensor, use the following function:

i n t i p m i _ s e n s o r _ d i s c r e t e _ e v e n t _ s u p p o r t e d ( i p m i _ s e n s o r _ t

*sensor,

The val will be set to whether the event is supported or not.

To actually enable or disable individual events for a sensor, an event state structure must be created. An event state structure is passed in when the event state of a sensor is queried. To set or clear individual

events in one of these structures, use the following:

void ipmi_discrete_event_clear(ipmi_event_state_t int e n u m i p m i _ e v e n t _ d i

r *events, event_offset, _ e d i r ) ;

v o i d i p m i _ d i s c r e t e _ e v e n t _ s e t ( i p m i _ e v e n t _ s t a t e int _ t e n u m i p m i _ e v e n t _ d i

r *events, event_offset, _ e d i r ) ;

Document info
Document views532
Page views532
Page last viewedSun Dec 04 01:25:17 UTC 2016
Pages238
Paragraphs8090
Words85809

Comments