IOCTL_FARC_INIT

Purpose: initialization of the driver

Parameter:
IN:  struct ARCNET_DCB (declared in FARC.H)
OUT:  -

Possible errors (see also Error codes):
E_FARC_INITIALIZING
E_FARC_NO_TOKEN
E_FARC_NO_ACTIVITY
E_FARC_NO_NEXTID
E_FARC_NO_PARAMETERS
E_FARC_INVALID_HANDLE
E_FARC_DUPID
E_FARC_INIT_FORCED
E_FARC_BUFFER_TOO_SMALL
E_FARC_BAD_PARAMETER

Comment:
Before doing any WriteFile or ReadFile Requests, this function must be called. The ARCNET adapter tries to connect the ARCNET network with the given node-id.

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_DCB dcb;

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

// ResponseTtime 74.7 usec, ReconfigTime 840ms, when using 20020
 dcb.z_et_1 = TRUE;
dcb.z_et_2 = TRUE;
dcb.z_et_3 = FALSE;

// 2.5 Mbps
dcb.z_ckp_1 = FALSE;
dcb.z_ckp_2 = FALSE;
dcb.z_ckp_3 = FALSE;

// No backplane, because we use coax interface
dcb.z_backplane = FALSE;
dcb.z_p1mode = FALSE;

// Abort transmission after 128 NAKs
dcb.z_four_naks = FALSE;

// Stop joining the network, if no token seen, or no netactivity is detected
dcb.b_init_behaviour = eARC_INIT_BREAK;

ret = DeviceIoControl(drvhandle,
     IOCTL_FARC_INIT,
     &dcb, sizeof(dcb),
     NULL, 0,
     &read, &overlapped);

if (!ret)
{
   err = GetLastError();
   if (err == E_FARC_PENDING)
   {
      ret = GetOverlappedResult(drvhandle, &overlapped, &read, TRUE);
      if (ret != TRUE)
      {
         err = GetLastError();
         switch(err)
         {
           case E_FARC_DUPID:
             // Error: Duplicate NODE-ID detected
             break;
           case E_FARC_NO_TOKEN:
             // Error: No token seen on net
             break;
           case E_FARC_NO_ACTIVITY:
             // Error: No activity seen on net
             break;
           case E_FARC_INIT_FORCED:
             // Warning: Init forced
             break;
         }
      }
      else
      {
         // Init succeeded
      }
   }
   else
   {
      // other error occured, perhaps wrong handle
   }
}
...

Programmers Guide
Contents