IOCTL_FARC_NETMAP_SETTINGS

Purpose: settings for netmap build

Parameter:
IN:   ARCNET_NETMAP
OUT:  -

Comment:
This function must be called before performing an IOCTL_FARC_GET_NETMAP.
Netmap build is done using the TENTID bit and the NEXTID register of the COM2002x controller.
Set the node id’s in the ARCNET_NETMAP structure, you want to include in netmap built. Only the nodes, whoose corresponding bit is set are checked.
Set the “not present”-timeout (member w_timeout of ARCNET_NETMAP) in 10ms units: after this time is elapsed, the currently checked node is regarded as “not present” if the TENTID Bit is not set. The timeout starts with setting the TENTID ID register. Setting this value to 0 causes the driver to use worst case conditions (255 nodes, full network load, current busspeed/extended timeout settings).
Have in mind, that the time for building a netmap increases with every node, you set in this call. In example, if you want to build a netmap with all 255 nodes and you have a timeout of 50ms set, netmap build is complete after 255*50ms or approx. 12,7 sec!
You should set the timeout value depending on your network size, data traffic and so on. Please refer to the COM2002x data sheet for further information.

Note, that this feature is not available with SH ARC-66 and SH ARC-USB.

Possible errors (see also Error codes):
E_FARC_NOT_INITED,
E_FARC_EXCESSIVE_RECON,
E_FARC_BUFFER_TOO_SMALL,
E_FARC_NETMAP_ERROR

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;
ARCNET_NETMAP sNetmap;

overlapped.Offset = 0;
overlapped.OffsetHigh = 0;
overlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
 

...
memset(&sNetmap,0,sizeof(sNetmap));
sNetmap.ba_netmap[0] = 0x8E; // scan only nodes 1..3 and 7
sNetmap.w_timeout = 2;  // 20ms "not present timeout"

ret = DeviceIoControl(drvhandle,
   IOCTL_FARC_NETMAP_SETTINGS,
    &sNetmap, sizeof(sNetmap),
    NULL, 0,
    &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
   }
}
...

Programmer's Guide
Contents