API's for a serial line driver. More...
Data Fields | |
enum line_state(* | line_get_status_info )(uint16_t port, struct line_status_info *optStatus) |
Retrieve line's status information. More... | |
void(* | line_serial_close )(uint16_t zeroBasedLine) |
Relinquish a line previously opened. More... | |
bool(* | line_serial_get_dsr )(uint16_t zeroBasedLine, bool *dsr) |
Get DSR status. More... | |
bool(* | line_serial_open )(uint16_t zeroBasedLine, uint32_t blockTimeMsec) |
Open a line for exclusive use. More... | |
void(* | line_serial_purge )(uint16_t zeroBasedLine) |
Purge data. More... | |
uint16_t(* | line_serial_read )(uint16_t port, uint8_t **dataPointerLocation, size_t max_size, bool *optBreakDetected, uint32_t blockTimeMsec) |
Read data. More... | |
uint16_t(* | line_serial_read_bytes_available )(uint16_t zeroBasedLine, struct ltrx_trigger *optReadTrigger) |
How many bytes are available? More... | |
void(* | line_serial_set_dtr )(uint16_t zeroBasedLine, bool dtr) |
Set DTR value. More... | |
bool(* | line_serial_write )(uint16_t zeroBasedLine, const void *data, size_t size, struct ltrx_trigger *optWriteTrigger) |
Write data. More... | |
API's for a serial line driver.
enum line_state(* ltrx_line_driver::line_get_status_info)(uint16_t port, struct line_status_info *optStatus) |
Retrieve line's status information.
Some fields in line_status_info are only applicable for physical serial line.
void(* ltrx_line_driver::line_serial_close)(uint16_t zeroBasedLine) |
Relinquish a line previously opened.
Previously you would have called ltrx_line_open() and saw it return true
. This will allow other threads to open the line.
bool(* ltrx_line_driver::line_serial_get_dsr)(uint16_t zeroBasedLine, bool *dsr) |
Get DSR status.
Note that on some lines, a CP may need to be configured to read DSR.
true | The result is in dsr. |
false | No DSR status was available. |
bool(* ltrx_line_driver::line_serial_open)(uint16_t zeroBasedLine, uint32_t blockTimeMsec) |
Open a line for exclusive use.
Warning: Check the return value even if you specify TIME_WAIT_FOREVER because your thread can return early if another thread calls ltrx_thread_wake().
true | Success. |
false | Failed. |
void(* ltrx_line_driver::line_serial_purge)(uint16_t zeroBasedLine) |
Purge data.
Clears any data not yet read from the Serial Line and any data previously written but not yet sent out on the Serial Line.
uint16_t(* ltrx_line_driver::line_serial_read)(uint16_t port, uint8_t **dataPointerLocation, size_t max_size, bool *optBreakDetected, uint32_t blockTimeMsec) |
Read data.
The number of bytes to be read will be limited by max_size, but this call will generally return with fewer bytes. The number of bytes is governed by the Line configured Gap Timer and Threshold.
If /c 0 bytes were read, your data pointer will not have been filled in, so do not attempt to reference it.
You are free to read the data under the data pointer until either your next call to ltrx_line_read(), ltrx_line_read_bytes_available() or ltrx_line_close().
uint16_t(* ltrx_line_driver::line_serial_read_bytes_available)(uint16_t zeroBasedLine, struct ltrx_trigger *optReadTrigger) |
How many bytes are available?
If optReadTrigger is not NULL
, the trigger will later be signaled when data is available.
void(* ltrx_line_driver::line_serial_set_dtr)(uint16_t zeroBasedLine, bool dtr) |
Set DTR value.
Note that on some lines, a CP may need to be configured to write DTR.
bool(* ltrx_line_driver::line_serial_write)(uint16_t zeroBasedLine, const void *data, size_t size, struct ltrx_trigger *optWriteTrigger) |
Write data.
If optWriteTrigger is NULL
, this function blocks until the write is completed. Otherwise this routine returns without blocking and the trigger will later be signaled when the write has completed.
true | Success. |
false | Failure. |