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

SPI Programming Examples
SPI Programming Manual427506-006
E-21
Example E-7: Special SSGET Operation in TAL
Example E-7: Special SSGET Operation in TAL
Example E-7 on page E-22 demonstrates the basic buffer manipulation activities
illustrated in Figure 2-7
on page 2-26. This TAL program uses DSM Template Services
to display the contents of the buffer after each manipulation. Run the program to see
the behavior of the SSGET special operation ZSPI-TKN-NEXTCODE.
Source File
SET0207
Object File
SET0207O
printf ("After 4th GETTKN NEXTTOKEN: Token = %ld", tkn_code);
display_token (tkn_code);
printf ("\n");
dump_buf (b1);
if (err = SSGETTKN (b1, ZSPI_TKN_NEXTTOKEN, (char *) &tkn_code,
0, &get_count, (short *) &ssid))
display_spi_error (err, ZSPI_VAL_SSGETTKN,
ZSPI_TKN_NEXTTOKEN, true);
printf ("After 5th GETTKN NEXTTOKEN: Token = %ld", tkn_code);
display_token (tkn_code);
printf ("\n");
dump_buf (b1);
/* This should get an error (missing token) */
printf ("After 6th GETTKN NEXTTOKEN: \n");
if (err = SSGETTKN (b1, ZSPI_TKN_NEXTTOKEN, (char *) &tkn_code,
0, &get_count, (short *) &ssid))
display_spi_error (err, ZSPI_VAL_SSGETTKN,
ZSPI_TKN_NEXTTOKEN, false);
printf ("Program finished.\n");
}
Example E-6. C File: Pointers, Lists, and ZSPI-TKN-NEXTTOKEN (page 3 of 3)