ZCOM Message Handling

Message Queuing

Message Queuing

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.

Figure 2-1 Program Message Queueing

 

Primary

Points to the

 

Input Queue

 

Program

 

 

 

 

 

 

Application A

zread

Input

Queue MSG MSG

Chapter 2

27