Each program ZLU (either primary or auxiliary) has a single
input queue on which messages are received and read on a first-in-first-out basis.
Because the ZLU is the input queuing mechanism for timeouts and statuses,
as well as for data messages, all programs should request (through
the zopen routine) at least
one program ZLU before using the other ZCOM calls.
The ztimr routine may
be used to enable or disable the timer on a program ZLU. When enabled,
a timeout message is added to the input queue of the ZLU every n seconds (n being
specified as a parameter to the ztimr call).
If there are already 10 or more messages on the queue, no timer
message is queued. Timer processing stops when ZTIMER and ZCLOCK
are reset to zero via the ztimr routine
(a zero "time" value).
The application program uses the zread routine
to read messages from the input queue. All response and status messages
are written to the primary program ZLU. Data messages can be written
to either the primary or auxiliary program ZLUs.
When a zsend routine
call is executed, the message to be sent is moved to the ZCOM kernel
buffer which is queued to the ZLU to which the message was sent.
The message is added to the end of the queue for the specified ZLU.
Queues for terminal ZLUs are located in the physical
terminal tables in the ZCOM memory area as shown in Figure 2-2 “Physical Terminal Table”. The physical terminal tables (one per terminal) maintain
four queues for each terminal.
The driver reads messages first from the express queue until
there are no remaining express queue messages, then from the high
priority queue until there are no high priority messages, at which
stage the low priority queue is read. Any further additions to the
higher priority queues will be read before the driver continues
with the lower priority queues. When the interface card is ready
to accept messages, the driver moves the message to the unacknowledged
queue and transfers the message to the interface card (through the
unacknowledged queue). Both the interface card and the driver use
DMA (Direct Memory Access) hardware to transfer the messages. If
the number of buffers on the unacknowledged queue is less than the
limit specified to TTGEN, more messages will be transferred, otherwise
the transfer will be suspended until some outstanding messages are
acknowledged.
Once the interface card has transmitted the message and has
responded with a definite status, the driver passes the status (if
requested to do so) back to the calling program. If the calling
program also requires the message buffer to be sent back with the
status response, it is picked up from the unacknowledged queue.
Once the driver has passed the message to the program, the message
is removed from the unacknowledged queue.
Messages in the unacknowledged queues for each terminal are
also used in a Mux restart: the messages are moved back to the high
priority queue to be resent. The size of the unacknowledged queue
is configurable in the TTGEN configuration file.