|
Ares LoRa Firmware
|
Serial API. More...
#include <serial/frame.h>#include <serial/serial_common.h>#include <stdbool.h>#include <stddef.h>#include <zephyr/kernel.h>#include <zephyr/sys/util.h>#include <serial/serial_backend.h>

Go to the source code of this file.
Data Structures | |
| struct | ares_serial_transport_api |
| Unified serial transport interface. More... | |
| struct | ares_serial_transport |
| Transfer interface. More... | |
| struct | ares_buf |
| Unified buffer structure for serial. More... | |
| struct | ares_serial_command |
| Ares frame handler descriptor. More... | |
| struct | ares_serial_ctx |
| Ares serial instance context. More... | |
| struct | ares_serial |
| Ares serial internals. More... | |
Macros | |
| #define | ARES_SERIAL_TRX_BUF_SIZE MAX(SERIAL_BACKEND_TX_RINGBUF_SIZE, SERIAL_BACKEND_RX_RINGBUF_SIZE) |
| #define | ARES_SERIAL_DEFINE(_name, _transport) |
| Macro for defining an ares_serial instance. | |
Typedefs | |
| typedef void(* | serial_transport_handler_t) (enum serial_transport_evt evt, void *ctx) |
| Serial transport event handler prototype. | |
Enumerations | |
| enum | serial_transport_evt { SERIAL_TRANSPORT_EVT_RX_RDY , SERIAL_TRANSPORT_EVT_TX_RDY } |
| Serial transport events. More... | |
| enum | ares_serial_signal { ARES_SIGNAL_RXRDY , ARES_SIGNAL_TXDONE , ARES_SIGNALS } |
| Signals for the serial interface. More... | |
Functions | |
| int | ares_serial_init (const struct ares_serial *serial, const void *transport_config) |
| Function for initiating a transport layer and internal serial state. | |
| int | ares_serial_register_command_callbacks (const struct ares_serial *serial, const struct ares_serial_command *commands, size_t num_commands) |
| Function for registering frame handlers. | |
| int | ares_serial_write_frame (const struct ares_serial *serial, const struct ares_frame *frame) |
| Function to write a frame to the serial transfer layer. | |
| void | ares_serial_flush_out (const struct ares_serial *serial, k_timeout_t timeout) |
| Function to flush the serial transfer layer transmit buffer. | |
| int | wait_serial_ready (const struct ares_serial *serial) |
| Block current thread execution until a connection is established with a host. | |
| int | set_wait_usb_host (const struct ares_serial *serial, bool block) |
| Function to configure the transport layer to block transmissions if no host is connected. | |
| bool | ares_serial_check_rx_error (const struct ares_serial *serial) |
| Function to check if there was a reception error in the transfer layer. | |
Serial API.
| #define ARES_SERIAL_DEFINE | ( | _name, | |
| _transport ) |
Macro for defining an ares_serial instance.
| _name | Instance name. |
| _transport | Pointer to the transport interface. |
| #define ARES_SERIAL_TRX_BUF_SIZE MAX(SERIAL_BACKEND_TX_RINGBUF_SIZE, SERIAL_BACKEND_RX_RINGBUF_SIZE) |
Unified serial buffer size for transmitting and receiving.
| typedef void(* serial_transport_handler_t) (enum serial_transport_evt evt, void *ctx) |
Serial transport event handler prototype.
| [in] | evt | The event that occurred. |
| [in] | ctx | Pointer to the event context. |
| enum ares_serial_signal |
| enum serial_transport_evt |
| bool ares_serial_check_rx_error | ( | const struct ares_serial * | serial | ) |
Function to check if there was a reception error in the transfer layer.
| [in] | serial | Pointer to serial instance. |
| void ares_serial_flush_out | ( | const struct ares_serial * | serial, |
| k_timeout_t | timeout ) |
Function to flush the serial transfer layer transmit buffer.
| [in] | serial | Pointer to serial instance. |
| [in] | timeout | The maximum amount of time to wait for the flush to occur. Use K_FOREVER to wait indefinitely. |
| int ares_serial_init | ( | const struct ares_serial * | serial, |
| const void * | transport_config ) |
Function for initiating a transport layer and internal serial state.
| [in] | serial | Pointer to serial instance. |
| [in] | transport_config | Transport configuration during initialization. |
| int ares_serial_register_command_callbacks | ( | const struct ares_serial * | serial, |
| const struct ares_serial_command * | commands, | ||
| size_t | num_commands ) |
Function for registering frame handlers.
| [in] | serial | Pointer to serial instance. |
| [in] | commands | The array of frame handlers. |
| [in] | num_commands | The number of frame handlers in the array. |
| int ares_serial_write_frame | ( | const struct ares_serial * | serial, |
| const struct ares_frame * | frame ) |
Function to write a frame to the serial transfer layer.
| [in] | serial | Pointer to serial instance. |
| [in] | frame | The frame to write to the serial transport. |
| int set_wait_usb_host | ( | const struct ares_serial * | serial, |
| bool | block ) |
Function to configure the transport layer to block transmissions if no host is connected.
| [in] | serial | Pointer to serial instance. |
| [in] | block | Tell transfer layer to block transmissions until host is connected. |
| int wait_serial_ready | ( | const struct ares_serial * | serial | ) |
Block current thread execution until a connection is established with a host.
| [in] | serial | Pointer to serial instance. |