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

SPI Concepts and Protocol
SPI Programming Manual427506-006
2-16
Used Length
recommend a buffer size that can accommodate the largest command or response
supported by the subsystem. These recommended buffer sizes have names of the
form
subsys-VAL-BUFLEN.
Used Length
Few command and response messages occupy the entire allocated buffer. You can
determine how many bytes actually contain message information by using the SSGET
procedure to retrieve the value of the header token ZSPI-TKN-USEDLEN. This lets
you, for example, send only the used portion of the buffer to a server.
Buffer Pointers
Four pointers track four important token positions in each buffer:
The current token
The next token
The last-put token
The current list
The Current-Token Pointer
The current-token pointer contains the position of the token most recently selected
using SSGET. This pointer is stored in the header token ZSPI-TKN-POSITION. SSINIT
sets the current token pointer to the beginning of the buffer, immediately following the
header and preceding any nonheader token. Thereafter, the current-token pointer is
updated by any successful call to SSGET or SSMOVE, and can be explicitly set by a
call to SSPUT using one of the special token codes ZSPI-TKN-POSITION,
ZSPI-TKN-INITIAL-POSITION, or ZSPI-TKN-RESET-BUFFER. Its value can be
retrieved by calling SSGET with ZSPI-TKN-POSITION. The current-token pointer
never points to a header token. The current-token pointer is not updated when SSGET
retrieves a header token value or when a nonzero error is returned by an SPI
procedure.
The Next-Token Pointer
The next-token pointer contains the position where SSGET starts scanning the buffer if
it is called with an index value of 0. SSINIT sets the next-token pointer to the beginning
of the buffer, immediately following the header. Thereafter, whenever a token value is
retrieved, the next-token pointer is set to the token following the value retrieved. If
SSGET is used to retrieve a token code rather than a token valuewhen SSGET is
called using the ZSPI-TKN-NEXTCODE or ZSPI-TKN-NEXTTOKEN special
operationsthe next-token pointer is set to the retrieved token code so that an SSGET
call specifying that token code retrieves that tokens value. The next-token pointer
never points to a header token, and is not changed when SSGET retrieves a header