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

SPI Programming Examples
SPI Programming Manual427506-006
E-37
Example E-10: A Simple SPI Requester in C
Example E-10. C File: A Simple SPI Requester (page 1 of 8)
/* File name: secreqrc
* SPI EXAMPLE C Basic Requester model.
*/
#pragma symbols
#pragma inspect
#pragma nomap
#pragma nolmap
#define max_bufsize 560 /* in bytes */
#define version 0x4414u /* Set to the value: "D20" */
#include "secc.h"
#include "secr.h"
short
buflen,
debug_flag, /* Flag to startup server in INSPECT */
dest_idx, /* Destination index for SSMOVETKN */
display_spi_buffer = false,
file_error,
file_num,
open_flags,
read_count,
server_up,
source_idx, /* Source index for SSMOVETKN */
spi_command = 0,
srvr_file_num,
srvr_retry_count = 0,
tkn_count,
tkn_retcode;
_lowmem short
process_id [13],
process_name [5], /* Server's process name.*/
server_name [13]; /* Server's object*/
long
time_to_wait = 1000L; /* In centi-seconds = 10 seconds */
#define sav_buffer b2 /* Saved command buffer (same as b2) */
#pragma list
#pragma PAGE "FORWARD DECLARATIONS"
void open_server(void);
#include "seccutlc"
#include "secrutlc"
#pragma PAGE "get_string"