|
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. More...
|
|
void | ltrx_line_close (uint16_t zeroBasedLine) |
| Relinquish a line previously opened. More...
|
|
const struct
ltrx_line_capabilities * | ltrx_line_get_capabilities (uint16_t zeroBasedLine) |
| Gets the capabilities of the line. More...
|
|
bool | ltrx_line_get_dsr (uint16_t zeroBasedLine, bool *dsr) |
| Get DSR status. More...
|
|
uint8_t | ltrx_line_get_registered_count (void) |
| Get the count of registered lines. More...
|
|
const char * | ltrx_line_get_registered_name (uint16_t zeroBasedLine) |
| Get the registered name of a Line. More...
|
|
bool | ltrx_line_open (uint16_t zeroBasedLine, uint32_t blockTimeMsec) |
| Open a line for exclusive use. More...
|
|
void | ltrx_line_purge (uint16_t zeroBasedLine) |
| Purge data. More...
|
|
uint16_t | ltrx_line_read (uint16_t zeroBasedLine, uint8_t **dataPointerLocation, size_t max_size, bool *optBreakDetected, uint32_t blockTimeMsec) |
| Read data. More...
|
|
uint16_t | ltrx_line_read_bytes_available (uint16_t zeroBasedLine, struct ltrx_trigger *optReadTrigger) |
| How many bytes are available? More...
|
|
void | ltrx_line_set_dtr (uint16_t zeroBasedLine, bool dtr) |
| Set DTR value. More...
|
|
bool | ltrx_line_write (uint16_t zeroBasedLine, const void *data, size_t size, struct ltrx_trigger *optWriteTrigger) |
| Write data. More...
|
|
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. More...
|
|
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. More...
|
|
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.
- Return values
-
true | Success. |
false | Failed. |
- Parameters
-
[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.
- Parameters
-
[in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
Gets the capabilities of the line.
- Returns
- Capabilities of the designated Serial Line.
- Parameters
-
[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.
- Return values
-
true | The result is in dsr. |
false | No DSR status was available. |
- Parameters
-
[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.
Returns the number of registered lines.
const char* ltrx_line_get_registered_name |
( |
uint16_t |
zeroBasedLine | ) |
|
Get the registered name of a Line.
- Returns
- Name.
- Return values
-
- Parameters
-
[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().
- Return values
-
true | Success. |
false | Failed. |
- Parameters
-
[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.
- Parameters
-
[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, |
|
|
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() or ltrx_line_close().
- Returns
- Number of bytes sitting under the data pointer.
- Parameters
-
[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. |
[out] | optBreakDetected | Optional pointer to flag to detect line breaks. |
[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.
- Returns
- Number of bytes available to read.
- Parameters
-
[in] | zeroBasedLine | 0 for line 1, 1 for line 2, and so on. |
[in] | optReadTrigger | Optional pointer to trigger. |
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.
- Parameters
-
[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.
- Return values
-
true | Success. |
false | Failure. |
- Parameters
-
[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.
- Return values
-
LINE_REGISTRATION_FAILED | Failed. |
- Returns
- Index of the first Line.
- Parameters
-
[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.
- Return values
-
true | Success. |
false | Failed. |
- Parameters
-
[out] | outStream | Your UART output stream struct to initialize. |
[in] | zeroBasedIndex | 0 for line 1, 1 for line 2, and so on. |