The following is a list of external functions in DRIVER.C. Each has an explanation of how it functions and what parameters need to be passed.
void delay( int seconds );
A negative value delays the program for the number of ticks specified by the parameter. A positive number delays the program for a number of seconds. A tick is 1/60 of one second.
int sendToOnspec( char table, char status, int index, double value, int taged );
Sends a message to ONSPEC over the communication queue. This function checks the value against ONSPEC's tables; if the value is the same the message will not be sent. The value returned by this function states whether the write to the queue was successful, 0 = success.
int getFromOnspec ( char *table, char *status, int *index, double *val );
Attempts to read a message from ONSPEC's communication queue. If the value returned by the function is 0 we received a message, otherwise no message was received.
int readString(char *s, int index);
Reads a string from STR table and returns its length.
void writeString(char *s, int index);
Writes a string to STR table.
void gaurdian ( void );
This function ensures that no other processes are using the same communications port at startup.
int getBuffer( unsigned char *s, int len );
Returns a string from the input buffer.
int sendStr( unsigned char *str, int usBuffLen );
Sends a string of length usBuffLen out the communications port. If the port is not sending bytes, the value of the function will return 1, indicating that a time-out has occurred.
int timeToQuit( void )
Check if port MX queue has been deleted or if ONSPEC has gone down. If either case is found, the function returns 1 and the I/O template must abort.
int tailer( int argc, char **argv )
Reads and passes the command tail, setting options specified in command tail.
Command tail format:
void initialize( void );
Open all queues and run all initialization routines.
void watchdog( void );
Send status messages to ONSPEC. Called each time through the main loop but only updates every ten cycles. The watch index for a single I/O template is 128, in a multiple system it's I/O template number + 127.
This chapter will discuss the following aspects: