Data Structures | |
| struct | input_stream_from_uart |
| Concrete struct for a Serial Line input stream. More... | |
| struct | ltrx_line_capabilities |
| Represents capabilities of a Serial Line. More... | |
| struct | ltrx_line_driver |
| API's for a serial line driver. More... | |
| struct | ltrx_line_protocol |
| Represents a line protocol for registration. More... | |
| struct | output_stream_to_uart |
| Concrete struct for a Serial Line output stream. More... | |
Macros | |
| #define | LINE_REGISTRATION_FAILED 0xff |
| Index out of range error code. | |
Functions | |
| bool | ltrx_input_stream_init_from_uart (struct input_stream_from_uart *inStream, unsigned int zeroBasedIndex) |
| Set up an input stream from a Serial Line. | |
| void | ltrx_line_close (uint16_t zeroBasedLine) |
| Relinquish a line previously opened. | |
| const struct ltrx_line_capabilities * | ltrx_line_get_capabilities (uint16_t zeroBasedLine) |
| Gets the capabilities of the line. | |
| bool | ltrx_line_get_dsr (uint16_t zeroBasedLine, bool *dsr) |
| Get DSR status. | |
| uint8_t | ltrx_line_get_registered_count (void) |
| Get the count of registered lines. | |
| const char * | ltrx_line_get_registered_name (uint16_t zeroBasedLine) |
| Get the registered name of a Line. | |
| bool | ltrx_line_open (uint16_t zeroBasedLine, uint32_t blockTimeMsec) |
| Open a line for exclusive use. | |
| void | ltrx_line_purge (uint16_t zeroBasedLine) |
| Purge data. | |
| uint16_t | ltrx_line_read (uint16_t zeroBasedLine, uint8_t **dataPointerLocation, size_t max_size, uint32_t blockTimeMsec) |
| Read data. | |
| uint16_t | ltrx_line_read_bytes_available (uint16_t zeroBasedLine, struct ltrx_trigger *optReadTrigger) |
| How many bytes are available? | |
| bool | ltrx_line_register_break_callback (uint16_t zeroBasedLine, void(*break_callback)(void *opaque), void *opaque) |
| Register a line break callback. | |
| void | ltrx_line_set_dtr (uint16_t zeroBasedLine, bool dtr) |
| Set DTR value. | |
| bool | ltrx_line_write (uint16_t zeroBasedLine, const void *data, size_t size, struct ltrx_trigger *optWriteTrigger) |
| Write data. | |
| uint8_t | ltrx_logical_line_driver_register (const struct ltrx_line_driver *driver, const char *name) |
| Register a driver for one or more logical Lines. | |
| bool | ltrx_output_stream_init_to_uart (struct output_stream_to_uart *outStream, unsigned int zeroBasedIndex) |
| Set up an output stream to a Serial Line. | |
The Serial Line refers to a Universal Asynchronous Receiver/Transmitter (UART) interface. These definitions relate to operation of the interface.
| #define LINE_REGISTRATION_FAILED 0xff |
Index out of range error code.
This error code indicates the number of registered line is over the max number of lines allowed
| bool ltrx_input_stream_init_from_uart | ( | struct input_stream_from_uart * | inStream, |
| unsigned int | zeroBasedIndex ) |
Set up an input stream from a Serial Line.
| true | Success. |
| false | Failed. |
| [out] | inStream | Your UART input stream struct to initialize. |
| [in] | zeroBasedIndex | 0 for line 1, 1 for line 2, and so on. |
| void ltrx_line_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.
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| const struct ltrx_line_capabilities * ltrx_line_get_capabilities | ( | uint16_t | zeroBasedLine | ) |
Gets the capabilities of the line.
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| bool ltrx_line_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. |
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| [out] | dsr | DSR status: true for asserted. |
| uint8_t ltrx_line_get_registered_count | ( | void | ) |
Get the count of registered lines.
| const char * ltrx_line_get_registered_name | ( | uint16_t | zeroBasedLine | ) |
Get the registered name of a Line.
| NULL | Failed. |
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| bool ltrx_line_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. |
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| [in] | blockTimeMsec | How long to wait if line is in use. To wait indefinitely, use TIME_WAIT_FOREVER. |
| void ltrx_line_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.
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| uint16_t ltrx_line_read | ( | uint16_t | zeroBasedLine, |
| uint8_t ** | dataPointerLocation, | ||
| size_t | max_size, | ||
| 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() or ltrx_line_close().
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| [out] | dataPointerLocation | Points to a data pointer to be filled in. |
| [in] | max_size | Maximum bytes to read. |
| [in] | blockTimeMsec | How long to wait for data. To wait indefinitely, use TIME_WAIT_FOREVER. |
| uint16_t ltrx_line_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.
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| [in] | optReadTrigger | Optional pointer to trigger. |
| bool ltrx_line_register_break_callback | ( | uint16_t | zeroBasedLine, |
| void(* | break_callback )(void *opaque), | ||
| void * | opaque ) |
Register a line break callback.
Note that some line types do not support break.
| true | The registration was successful. |
| false | The registration failed. |
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| [in] | break_callback | callback when break is detected. |
| [in] | opaque | pointer to be supplied to break_callback. |
| void ltrx_line_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.
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| [in] | dtr | DTR value: true for asserted. |
| bool ltrx_line_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. |
| [in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
| [in] | data | Data to be written. |
| [in] | size | Number of bytes under data to be written. |
| [in] | optWriteTrigger | Optional pointer to trigger. |
| uint8_t ltrx_logical_line_driver_register | ( | const struct ltrx_line_driver * | driver, |
| const char * | name ) |
Register a driver for one or more logical Lines.
| LINE_REGISTRATION_FAILED | Failed. |
| [in] | driver | Structure comprising the Line driver. |
| [in] | name | The name for the Line being registered. |
| bool ltrx_output_stream_init_to_uart | ( | struct output_stream_to_uart * | outStream, |
| unsigned int | zeroBasedIndex ) |
Set up an output stream to a Serial Line.
| true | Success. |
| false | Failed. |
| [out] | outStream | Your UART output stream struct to initialize. |
| [in] | zeroBasedIndex | 0 for line 1, 1 for line 2, and so on. |