SPI Programming Manual (G06.24+, H06.03+, J06.03+)

General SPI Programming Guidelines
SPI Programming Manual427506-006
5-17
Defining Simple Tokens
where
If the resulting recommended buffer size is large because of long commands or
responses that are not likely to be issued or received by some requesters, you can
recommend additional buffer sizes. Each requester can then choose the value that is
appropriate for its needs.
For each recommended buffer size you define, provide a corresponding declaration for
a buffer of that size:
subsys
is the abbreviation for your server.
buffer-size
is the number of bytes needed to make the buffer the recommended length. You
can use the constant name you define for the corresponding recommended length
(for instance,
subsys-VAL-BUFLEN).
Defining Simple Tokens
Tokens that are fixed structures should be used primarily for items that are almost as
primitive as simple data typessuch as the internal file name or SPI subsystem ID,
hdr is the size of the SPI message header, defined by SPI as ZSPI-
VAL-HDRSIZE.
tokens is the total number of tokens in the longest command or response
message defined by the server. This value includes list tokens
(ZSPI-TKN-LIST, -DATALIST, -SEGLIST, -ENDLIST). A token
code is 4 bytes long.
ssid-qual-tokens is the total number of tokens that are qualified by an SSID. The
SSID adds 12 bytes to the length of a token code.
sum-value-size is the sum of the sizes of all of the token values in the message,
including the values of comment (ZSPI-TKN-COMMENT) and
context (ZSPI-TKN-CONTEXT) tokens.
lists is the number of lists in the message. Each pair of list and end-list
tokens requires 2 additional bytes beyond the 8 bytes required for
the 2 token codes.
cushion is a generous safety margin to cover future enhancements.
def subsys-DDL-MSG-BUFFER.
02 Z-MSGCODE type ZSPI-DDL-INT.
02 Z-BUFLEN type ZSPI-DDL-UINT.
02 Z-OCCURS type ZSPI-DDL-UINT.
02 Z-FILLER type ZSPI-DDL-BYTE
occurs 0 to buffer-size times
depending on Z-OCCURS.
end