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

SPI Programming Examples
SPI Programming Manual427506-006
E-55
Example E-12: A Simple SPI Server in C
Example E-12: A Simple SPI Server in C
Example E-12 is a simple SPI server that performs simple string manipulations on
strings provided by the requester shown in Example E-9
on page E-28. The server is
started automatically when you run the requester, SECREQRO.
Source File
SECSERVC
Object File
SECSERVO
Example E-12. C File: A Simple SPI Server (page 1 of 12)
/* File name: secservc
* SPI EXAMPLE C Basic Server model.
*/
#pragma symbols
#pragma inspect
#pragma nomap
#pragma nolmap
#pragma nostdfiles
#define max_bufsize 1010 /* in bytes */
#define version 0x4414u /* Set to the value: "D20" */
#include "secc.h"
#include "secr.h"
short
context_count, /* Number of CONTEXT tokens */
dest_idx, /* Destination index for SSMOVETKN */
file_error,
max_resp, /* From the SPI message */
object_type, /* Object type */
rcv_file_num, /* $RECEIVE’s file number */
resp_type, /* From the SPI message */
source_idx, /* Source index for SSMOVETKN */
spi_buffer_size, /* Size of last SPI buffer read. */
spi_command, /* From the SPI message */
tkn_count, /* The number of tokens */
tkn_retcode;
_lowmem string_template out_string; /* output string */
#define res_buffer b2 /* Response buffer (same as b2) */
#include "zcomc (constants)" nolist
#pragma PAGE "FORWARD DECLARATIONS"
void build_hdr_response(void);
void error_response(short p_err_num);
void initialization(void);