beautypg.com

M1966_measure_update, Section 6.6.3 – Maxim Integrated 73M1866B/73M1966B Reference Driver User Manual

Page 62

background image

73M1866B/73M1966B Reference Driver User Guide

UG_1x66B_015

62

Rev. 2.7

6.6.3 M1966_MEASURE_UPDATE

Description

Reads an IET entry or updates an IET entry based on provided parameters. The param parameter points
to a structure that contains the requested action (GET or SET), the measuring entity (current or voltage),
the IET table index, and its attributes, if used in the SET operation. For GET operations the IET attributes
will be read from the driver.

#define M1966_MEASURE_UPDATE _IOWR(0xA4, 0xE7, unsigned int)

Prototype

int ioctl (

int chan_fd,

int M1966_MEASURE_UPDATE,

unsigned long param );


Parameters

Data Type

Name

Description

int

chan_fd

Channel descriptor.

int

M1966_MEASURE_UPDATE

I/O control identifier for this operation.

unsigned long

param

Pointer to M1966_MEASURE_UPDATE_t.


Return Values

Data Type

Description

unsigned int

0 – Successful.
-1 – Failed to update IET entry.


Example

The following example code illustrates an update to a line current IET table entry.

M1966_MEASURE_UPDATE_t

update;

int ret;

update.row = 3; /* update row 3 of current IET table */
update.action = M1966_MEASURE_ACTION_SET; /* request for SET operation */
update.entity = M1966_MEASURE_ENTITY_CURRENT; /* measuring entity= current */
update.interval_min = 15; /* lower bound current = 15ma */
update.interval_max = 21; /* upper bound current = 21ma */
update.event = 0x000E1521; /* this event to be emitted */

ret = ioctl (fd, M1966_MEASURE_UPDATE, &update);
if (ret < 0)
printf (“Failed to update current IET entry”);
else
printf (“Successful”);