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

The SPI Procedures
SPI Programming Manual427506-006
3-27
Example: Moving Buffer Tokens Using SSMOVETKN
Example 3-1. Moving Buffer Tokens Using SSMOVETKN (page 1 of 7)
/*
* Try moving some buffer tokens around using SSMOVETKN.
*/
#pragma symbols
#pragma inspect
#pragma nomap
#pragma nolmap
#define max_bufsize 256 /* in bytes */
#include "secc.h"
#pragma list
#include "seccutlc"
short ZERO = 0;
#pragma page "MAIN"
main(/* int argc, char *argv[] */)
{
zspi_ddl_ssid_def mySsid;
bufsize = max_bufsize;
/*
* Initialize the SPI buffer "b1"
*/
if (err = SSINIT (b1, bufsize, (short *) &ssid, ZSPI_VAL_CMDHDR))
display_spi_error (err, ZSPI_VAL_SSINIT, 0L, true);
/*
* Put four tokens in the SPI buffer "b1"
*/
if (err = SSPUTTKN (b1, ZSPI_TKN_DATALIST))
display_spi_error (err, ZSPI_VAL_SSPUTTKN, ZSPI_TKN_DATALIST, true);
val = 'A';
if (err = SSPUTTKN (b1, tkn_1, &val))
display_spi_error (err, ZSPI_VAL_SSPUTTKN, tkn_1, true);
val = 'B';
if (err = SSPUTTKN (b1, tkn_2, &val))
display_spi_error (err, ZSPI_VAL_SSPUTTKN, tkn_2, true);
val = 'C';
if (err = SSPUTTKN (b1, tkn_3, &val))
display_spi_error (err, ZSPI_VAL_SSPUTTKN, tkn_3, true);
val = 'D';
if (err = SSPUTTKN (b1, tkn_3, &val))
display_spi_error (err, ZSPI_VAL_SSPUTTKN, tkn_3, true);
if (err = SSPUTTKN (b1, ZSPI_TKN_ENDLIST))
display_spi_error (err, ZSPI_VAL_SSPUTTKN, ZSPI_TKN_ENDLIST, true);