IOCTL_FARC_INIT
Description:
initialize the ARCNET controller
Parameters:
Parameter |
Type |
Description |
Input |
Controller settings to be set |
struct ARCNET_DCB |
Define the settings thar are required for controller initialization, such as:
- clock divider for speed settings 2,5Mbit/s and below
- timeouts (response time, reconfiguration time, idle time)
- interface type
- NAK behaviour
- intialization behaviour
|
Output |
- |
- |
- |
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_PASSIVE_INIT
E_FARC_BUFFER_TOO_SMALL
E_FARC_BAD_PARAMETER
Remarks:
The controller must be initalized before doing any WriteFile() or ReadFile() Requests.
Requirements:
passive initialization mode (b_init_behaviour=eARC_INIT_PASSIVE) is supported only by SH ARC-USB driver v4.4.
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;
case E_FARC_PASSIVE_INIT:
// Warning: Intialized with inactive transmitter
break;
}
}
else
{
// Init succeeded
}
}
else
{
// other error occured, perhaps wrong handle
}
}
...
See also:
DeviceIoControl()
ARCNET_EXTND
ARCNET_DCB
IOCTL_FARC_EXTND_FUNCTIONS
IOCTL_FARC_GET_USEDDCB
IOCTL_FARC_ARC_TRANSMITTER_CTRL