User`s guide
Calling the Network Driver from a Host Application
The SLTA-10 MIP mode network driver for DOS supports the open, close, read,
write, and i oc t 1 DOS calls. See Chapter 4 of the Host Application Programmer’s
Guide for more details.
When the SLTA-10 MIP mode network driver for DOS is loaded during execution of
the CONFIG. SYS file, it does not attempt to communicate with the SLTA-10 Adapter.
When the network driver is opened with the DOS open call, it establishes
communications with the SLTA-10 Adapter. The network driver returns an error if
this fails, for example, if the SLTA-10 Adapter is disconnected, powered down, or
configured incorrectly. If the open call succeeds, the driver enables network
communications by clearing the SLTA-10 Adapter FLUSH state, if configured to do so.
The DOS read call is defined to return the number of bytes read from the device.
Some LONWORKS standard network drivers return 0 if there are no uplink messages
available. DOS reports this as an end-of-file condition and prevents further reads
from succeeding. However, the SLTA-10 Adapter driver returns a length of 2, and
sets the first byte of the caller’s buffer (the cmd/queue byte) to 0 to indicate that there
is no uplink message available.
Normally, the DOS read and write calls are not used with LONWORKS standard
network drivers. This is because any error from the network interface will display
thefamiliar Abort, Retry,
Fai 1? error message from DOS, unless the caller has
installed a critical error device handler. Therefore, DOS applications using a
network device typically call direct entry points into the driver. This also allows
more detailed error status to be returned to the application. The addresses of these
entry points are obtained by calling the i oc t 1( ) function of the driver.
This function call is used as follows:
int ioctl(int handle, int func, void far *argdx, int argcx);
.
handle is an integer returned by an earlier successful call to open ( ) , specifying
the LONWORKS network driver LONn to be opened.
.
f unc is the value 2, meaning that the application is reading information from the
driver. For LONWORKS standard DOS network drivers, the information
returned is the network interface direct call structure.
.
argdx is a pointer to a caller-declared structure that will contain the direct entry
points into the driver. See the structure direct-calls in the file NI-MSG. C in
the supplied example host application for usage.
.
argcx is the size of the structure.
Function code 2 is supported by network drivers for DOS to return three direct entry
points into the driver code. The network driver for the SLTA-10 Adapter supports an
additional option to function code 2, as well as function code 3, which is used to
manage the modem control state of the driver. These options are not used when the
SLTA-10 Adapter is connected directly to a host. They are provided primarily for use
while establishing communications with a remote host. For example, the host
connect utility (HCU) described in Chapter 12 of this manual uses these functions.
8-8
Using the DOS Driver with SLTA-10 MIP Mode