
TPMC118-SW-95 – QNX6 Neutrino Device Driver
Page 13 of 30
3.3.2 DCMD_TP118_READINP
NAME
DCMD_TP118_READINP – Read digital input values
DESCRIPTION
This devctl function reads the values of the digital input channels. A pointer to the callers message
buffer (
TP118_READINP
) and the size of this structure is passed by the parameters
data_ptr
and
n_bytes
to the device.
The
TP118_READINP
structure has the following layout:
typedef struct
{
long
value;
} TP118_READINP, *PTP118_READINP;
value
This parameter will return the actual value of the digital input register. Only bit 0 up to 5 are
valid. Bit 0 is advised to IN1, bit 1 is advised IN2 and so on.
EXAMPLE
int
fd;
int
result;
TP118_READINP digBuf;
...
/*
** read digital input value
*/
result = devctl(
fd,
DCMD_TP118_READINP,
&digBuf,
sizeof(digBuf),
NULL);
if (result == EOK)
{
/* successful read */
}
...