#include <errno.h>
#include <zephyr/device.h>
Go to the source code of this file.
◆ serial_vnd_write_cb_t
typedef void(* serial_vnd_write_cb_t) (const struct device *dev, void *user_data) |
Callback called after bytes written to the virtual serial port.
- Parameters
-
dev | Address of virtual serial port. |
user_data | User data. |
◆ serial_vnd_out_data_size_get()
Returns size of unread written data.
- Parameters
-
dev | Address of virtual serial port. |
- Returns
- Output data size (in bytes).
◆ serial_vnd_peek_out_data()
Peek at data written to virtual serial port.
Reads the data without consuming it. Future calls to serial_vnd_peek_out_data() or serial_vnd_read_out_data() will return this data again. Requires CONFIG_RING_BUFFER.
- Warning
- Use cases involving multiple reads of the data must prevent concurrent read operations, either by preventing all readers from being preempted or by using a mutex to govern reads.
- Parameters
-
dev | Address of virtual serial port. |
data | Address of the output buffer. Cannot be NULL. |
size | Data size (in bytes). |
- Return values
-
Number | of bytes written to the output buffer. |
◆ serial_vnd_queue_in_data()
Queues data to be read by the virtual serial port.
- Warning
- Use cases involving multiple writers virtual serial port must prevent concurrent write operations, either by preventing all writers from being preempted or by using a mutex to govern writes.
- Parameters
-
dev | Address of virtual serial port. |
data | Address of data. |
size | Data size (in bytes). |
- Return values
-
◆ serial_vnd_read_out_data()
Read data written to virtual serial port.
Consumes the data, such that future calls to serial_vnd_read_out_data() will not include this data. Requires CONFIG_RING_BUFFER.
- Warning
- Use cases involving multiple reads of the data must prevent concurrent read operations, either by preventing all readers from being preempted or by using a mutex to govern reads.
- Parameters
-
dev | Address of virtual serial port. |
data | Address of the output buffer. Can be NULL to discard data. |
size | Data size (in bytes). |
- Return values
-
Number | of bytes written to the output buffer. |
◆ serial_vnd_set_callback()
Sets the write callback on a virtual serial port.
- Parameters
-
dev | Address of virtual serial port. |
callback | Function to call after each write to the port. |
user_data | Opaque data to pass to the callback. |