oms_command

Synopsis

    #include "omsdrv.h"
    int oms_init( void );
    int oms_command( USHRT function, char *cmd, USHRT n_req, char *buf );
    int oms_shutdown( void );
    int oms_read(char *cmd, USHRT n_req, char *buffer );
    int oms_write( char *cmd );
    

Description

These functions provide basic client access to omsdrv, the driver for the Oregon Micro Systems PC68 Motor Controller Board.

oms_init() provides the standard client/server initialization. As usual, it is optional, but calling it at startup might flag an error condition sooner than if you wait until the first OMS command to find out.

oms_command() is the main routine for client communication with the OMS driver, omsdrv. oms_shutdown(), oms_read() and oms_write() are all implemented via macros which invoke oms_command(). The function codes are defined in omsdrv.h. cmd is the exact command string that should be written out to the PC68 board. n_req specifies the number of atomic responses expected from the board, and is only applicable for read requests. (If you expect results you wish to ignore, we'll need to amend this rule.) buf is a buffer into which the result string is written, stripped of lf-cr prefixes and suffixes. It is the client's responsibility to make sense out of the string.

oms_shutdown() attempts to locate a resident omsdrv and request that it shut down.

oms_read() is used to issue a command to the PC68 when a reply is expected. It uses all the arguments of oms_command().

oms_write() is used to issue commands to the PC68 which do not produce a reply.

Returns

All functions return 0 on success. oms_command() returns 1 if the function code is unrecognized by the server and -1 if the server cannot be located or the reply does not have the correct signature. The response level for this driver is 2, so most errors will produce an error complaint but won't be fatal, although oms_command() will abort no matter what if you pass it invalid arguments.

See Also

Driver Interfaces, Startup functions.

Source File

/usr/local/src/nortlib/omsclient.c

Alphabetical List
Subject List
Return to Manuals Page
webmaster@huarp.harvard.edu
Copyright 2001 by the President and Fellows of Harvard College