- Returns: SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
- if an invalid port is passed.
-
-int sp_close(struct sp_port *port);
-
- Closes the specified serial port.
-
- Returns: SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
- if an invalid port is passed.
-
-Setting port parameters
------------------------
-
-int sp_set_params(struct sp_port *port, int baudrate,
- int bits, int parity, int stopbits,
- int flowcontrol, int rts, int dtr);
-
- Sets serial parameters for the specified serial port.
-
- Parameters:
-
- port: Pointer to port structure.
- baudrate: Baud rate to set.
- bits: Number of data bits to use.
- parity: Parity setting to use
- (SP_PARITY_NONE, SP_PARITY_EVEN or SP_PARITY_ODD)
- stopbits: Number of stop bits to use (1 or 2).
- flowcontrol: Flow control setting to use
- (SP_FLOW_NONE, SP_FLOW_HARDWARE or SP_FLOW_SOFTWARE)
-
- Returns: SP_OK on success, SP_ERR_FAIL on failure, or SP_ERR_ARG
- for invalid arguments.
-
-Reading, writing and flushing data
-----------------------------------
-
-int sp_read(struct sp_port *port, const void *buf, size_t count)
-
- Reads a number of bytes from the specified serial port.
-
- Parameters:
-
- port: Pointer to port structure.
- buf: Buffer in which to store the bytes read.
- count: Number of bytes to read.
-
- Returns: The number of bytes read, SP_ERR_FAIL on failure,
- or SP_ERR_ARG for invalid arguments.
-
-int sp_write(struct sp_port *port, const void *buf, size_t count)
-
- Writes a number of bytes to the specified serial port.
-
- Parameters:
-
- port: Pointer to port structure.
- buf: Buffer containing the bytes to write.
- count: Number of bytes to write.
-
- Returns: The number of bytes written, SP_ERR_FAIL on failure,
- or SP_ERR_ARG for invalid arguments.
-
-int sp_flush(struct sp_port *port);
-
- Flushes serial port buffers.