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

SPI Programming Examples
SPI Programming Manual427506-006
E-88
Example E-20: Routines for C Requesters and
Servers
/*
* If debug_flag is set, then bring up the server in DEBUG.
*/
if (debug_flag)
{
l_process_flags |= 0x0001; /* Turn debug on */
l_priority |= 0x8000; /* Turn debug on */
} else
{
l_process_flags &= 0xFFFE; /* Turn debug off */
l_priority &= 0x7FFF; /* Turn debug off */
}
strcpy ((char *) &process_id[0], " ");
NEWPROCESS (server_name, l_priority,
/*memory pages*/, /*processor*/,
process_id, &file_error,
process_name, /*home_term*/,
l_process_flags);
if (file_error)
{
report_newprocess_error (server_name, file_error);
return;
}
open_server();
} /* of restart_server() */
#pragma PAGE "write_read_server"
/*
*=========================================================================
* Proc : write_read_server =
* Function : This procedure will write a message to the server and read =
* the reply. It handles any file errors on the server’s file.=
*=========================================================================
*/
void write_read_server(void)
{
short
l_await_done,
l_op_done,
l_recoverable_err,
l_status;
l_op_done = false;
do
{
l_status = WRITEREADX (srvr_file_num, (char *) &req_buffer[0],
max_bufsize, max_bufsize, &read_count);
if (l_status != CCE) get_file_error (srvr_file_num);
l_await_done = false;
Example E-20. C File: SECRUTLC Supporting Code (page 3 of 4)