X-Git-Url: https://git.distorted.org.uk/~mdw/jog/blobdiff_plain/2ec1e6937048636ec6761c3a76c5bf9544278601..efb4b3d6a7f9b4e99b0926fd512f709a139319b8:/serial.h diff --git a/serial.h b/serial.h index f514bda..bac1a96 100644 --- a/serial.h +++ b/serial.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: serial.h,v 1.1 2002/01/25 19:34:45 mdw Exp $ + * $Id: serial.h,v 1.2 2002/01/30 09:23:58 mdw Exp $ * * Common serial functionality * @@ -29,6 +29,11 @@ /*----- Revision history --------------------------------------------------* * * $Log: serial.h,v $ + * Revision 1.2 2002/01/30 09:23:58 mdw + * Follow new transport configuration interface. Add parameters for flow + * control. Break the format into separate parameters for independent + * configuration. + * * Revision 1.1 2002/01/25 19:34:45 mdw * Initial revision * @@ -51,21 +56,23 @@ typedef struct serial_config { unsigned long baud; /* Baud rate */ - unsigned wordlen; /* Word length */ - unsigned parity; /* Parity type (magic constant) */ - unsigned stopbits; /* Number of stop bits */ + unsigned char wordlen; /* Word length */ + unsigned char parity; /* Parity type (magic constant) */ + unsigned char stopbits; /* Number of stop bits */ + unsigned char flow; /* Flow control */ } serial_config; enum { PARITY_NONE, PARITY_ODD, PARITY_EVEN }; +enum { FLOW_NONE, FLOW_XONXOFF, FLOW_RTSCTS }; -#define SERIAL_INIT { 9600, 8, PARITY_NONE, 1 } +#define SERIAL_INIT { 9600, 8, PARITY_NONE, 1, FLOW_NONE } /*----- Functions provided ------------------------------------------------*/ /* --- @serial_parse@ --- * * - * Arguments: @const char *p@ = configuration string to parse - * @serial_config *sc@ = pointer to serial config structure + * Arguments: @serial_config *sc@ = pointer to serial config structure + * @const char *k, *v@ = keyword and value pair * * Returns: Zero if OK, or @-1@ on error. * @@ -75,7 +82,8 @@ enum { PARITY_NONE, PARITY_ODD, PARITY_EVEN }; * already. */ -extern int serial_parse(const char */*p*/, serial_config */*sc*/); +extern int serial_parse(serial_config */*sc*/, + const char */*k*/, const char */*v*/); /*----- That's all, folks -------------------------------------------------*/