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

SPI Programming Examples
SPI Programming Manual427506-006
E-39
Example E-10: A Simple SPI Requester in C
case '4':
display_spi_buffer = true;
break;
case '5':
display_spi_buffer = false;
break;
case '6':
printf (" \n");
STOP(process_id); /* Stop the server. */
STOP();
break;
default:
printf (" \n");
printf ("Invalid option. Try again.\n");
break;
} /* end of switch */
}
while (l_work_to_do == false);
} /* of get_string() */
#pragma PAGE "initialization"
/*
*======================================================================
* Proc : initialization =
* Function : This procedure will start the server. =
*======================================================================
*/
void initialization(void)
{
short len;
/* Get the startup msg */
if (get_startup_msg(&startup_msg, &len))
{
printf ("No STARTUP message received.");
return;
}
/* Put in the current volume/subvolume. */
memcpy((char *) &server_name[0], &startup_msg.defaults.whole, 16);
/* Parse parameters for 'debug' */
debug_flag = false;
if ((strcmp(startup_msg.param, "D") == 0)
|| (strcmp(startup_msg.param, "d") == 0))
{
debug_flag = true;
time_to_wait = 60000L; /* In centi-seconds = 600 seconds */
}
/* Do the NEWPROCESS of the server */
server_up = false;
do
{
restart_server();
}
while (server_up == false);
} /* of PROC initialize */
Example E-10. C File: A Simple SPI Requester (page 3 of 8)