IOCTL_FARC_GET_RESOURCE_USAGE
Description:
query the requirement and availability of special hardware resources (+5V , -12V).
Parameters:
Parameter |
Type |
Description |
Input |
- |
- |
- |
Output |
resource availability |
USHORT[2] |
Returns required and available of hardware resources in form bit array
- [0] - required hardware resources
- [1] - available hardware resources
Bit description:
- [0] - "-12V" supply (PCI bus)
- [1] - "+5V" supply (PCI bus) required
- [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");
}
See also:
DeviceIoControl()
Back to Programming Guide