Purpose: query the requirement and available of special hardware
resources (+5V , -12V)
Parameter:
IN: -
OUT: 2x USHORT (size of output buffer >= 2*2 bytes)
Comment:
This function can be called to retrieve the requirement and
availability of special hardware resources.
The return values consists of following:
1st returned USHORT
Bit |
Description |
0 |
-12V supply (PCI bus) required |
1 |
+5V supply (PCI bus) required |
2..15 | unused |
2nd returned USHORT
Bit |
Description |
0 |
-12V supply (PCI bus) available |
1 |
+5V supply (PCI bus) available |
2..15 | unused |
Possible errors (see also Error codes):
E_FARC_INVALID_HANDLE
E_FARC_BUFFER_TOO_SMALL
Example:
Note, that the following example is only a fragment. It is recommended,
that the driver is opened in asynchronous mode and a handle to the
driver
is available.
OVERLAPPED overlapped;
DWORD read, err;
BOOL ret;
USHORT w[2];
overlapped.Offset = 0;
overlapped.OffsetHigh = 0;
overlapped.hEvent =
CreateEvent(NULL,
TRUE, FALSE, NULL);
...
ret = DeviceIoControl(drvhandle,
IOCTL_FARC_GET_RESOURCE_USAGE,
NULL, 0,
w,
2*sizeof(USHORT),
&read,
&overlapped);
if (!ret)
{
err = GetLastError();
if (err == E_FARC_PENDING)
{
ret
= GetOverlappedResult(drvhandle, &overlapped, &read, TRUE);
if
(!ret)
{
err = GetLastError();
// do errorhandling here
}
}
else
{
//
other error occured, perhaps wrong handle
}
}
if (w[0] & 0x01)
{
printf("-12V supply required");
}
if (w[0] & 0x02)
{
printf("+5V supply required");
}
if (w[1] & 0x01)
{
printf("-12V supply available");
}
if (w[2] & 0x02)
{
printf("+5V supply available");
}