Unified serial transport interface.
More...
#include <serial.h>
|
| int(* | init )(const struct ares_serial_transport *transport, const void *config, serial_transport_handler_t evt_handler, void *context) |
| | Function for initializing the serial transport interface.
|
| int(* | uninit )(const struct ares_serial_transport *transport) |
| | Function for uninitializing the serial transport interface.
|
| int(* | enable )(const struct ares_serial_transport *transport, bool blocking_tx) |
| | Function for enabling transport in given TX mode.
|
| int(* | write )(const struct ares_serial_transport *transport, const void *data, size_t length, size_t *cnt) |
| | Function for writing data to the transfer interface.
|
| int(* | read )(const struct ares_serial_transport *transport, void *data, size_t length, size_t *cnt) |
| | Function for reading data from the transfer interface.
|
| void(* | wait_dtr )(const struct ares_serial_transport *transport) |
| | Function that blocks execution of the thread until the DTR control line is asserted.
|
| bool(* | rx_error )(const struct ares_serial_transport *transport) |
| | Function that checks if there is a reception error.
|
| void(* | block_no_usb_host )(const struct ares_serial_transport *transport, bool block) |
| | Function that configures the transport to operate in blocking/non-blocking mode while waiting for a host connection.
|
Unified serial transport interface.
◆ block_no_usb_host
| void(* ares_serial_transport_api::block_no_usb_host) (const struct ares_serial_transport *transport, bool block) |
Function that configures the transport to operate in blocking/non-blocking mode while waiting for a host connection.
- Parameters
-
| [in] | transport | Pointer ot the transfer instance. |
| [in] | block | If true, transport will block until a host connection is established. |
◆ enable
| int(* ares_serial_transport_api::enable) (const struct ares_serial_transport *transport, bool blocking_tx) |
Function for enabling transport in given TX mode.
Function can be used to reconfigure TX to work in blocking mode.
- Parameters
-
| [in] | transport | Pointer ot the transfer instance. |
| [in] | blocking_tx | If true, the transport TX is enabled in blocking mode. |
- Returns
- 0 on success.
-
negative error code otherwise.
◆ init
Function for initializing the serial transport interface.
- Parameters
-
| [in] | transport | Pointer to the transfer instance. |
| [in] | config | Pointer to the instance configuration. |
| [in] | evt_handler | Event handler. |
| [in] | context | Pointer to the context passed to the event handler. |
- Returns
- 0 onsuccess.
-
negative error code otherwise.
◆ read
| int(* ares_serial_transport_api::read) (const struct ares_serial_transport *transport, void *data, size_t length, size_t *cnt) |
Function for reading data from the transfer interface.
- Parameters
-
| [in] | transport | Pointer ot the transfer instance. |
| [in] | data | Pointer to the destination buffer. |
| [in] | length | Destination buffer length. |
| [out] | cnt | Pointer to the received bytes counter. |
- Returns
- 0 on success.
-
negative error code otherwise.
◆ rx_error
Function that checks if there is a reception error.
- Parameters
-
| [in] | transport | Pointer ot the transfer instance. |
- Returns
- true if there was a reception error.
-
false if there was no reception error.
◆ uninit
Function for uninitializing the serial transport interface.
- Parameters
-
| [in] | transport | Pointer ot the transfer instance. |
- Returns
- 0 on success.
-
negative error code otherwise.
◆ wait_dtr
Function that blocks execution of the thread until the DTR control line is asserted.
- Parameters
-
| [in] | transport | Pointer ot the transfer instance. |
◆ write
| int(* ares_serial_transport_api::write) (const struct ares_serial_transport *transport, const void *data, size_t length, size_t *cnt) |
Function for writing data to the transfer interface.
- Parameters
-
| [in] | transport | Pointer ot the transfer instance. |
| [in] | data | Pointer to the source buffer. |
| [in] | length | Source buffer length. |
| [out] | cnt | Pointer to the sent bytes counter. |
- Returns
- 0 on success.
-
negative error code otherwise.
The documentation for this struct was generated from the following file: