![]() |
Ultibo API
C/C++ API for Ultibo Core
|
Go to the source code of this file.
Data Structures | |
| struct | _SERIAL_PROPERTIES |
| struct | _SERIAL_BUFFER |
| struct | _SERIAL_DEVICE |
Macros | |
| #define | SERIAL_NAME_PREFIX "Serial" |
| Name prefix for Serial Devices. | |
| #define | SERIAL_LOGGING_DESCRIPTION "Serial Logging" |
| #define | SERIAL_RECEIVE_DEPTH_DEFAULT SIZE_2K |
| Default receive buffer size in bytes. | |
| #define | SERIAL_TRANSMIT_DEPTH_DEFAULT SIZE_2K |
| Default transmit buffer size in bytes. | |
| #define | SERIAL_PUSH_TIMEOUT 50 |
| Timeout (Milliseconds) for Push RX/TX (Implementation specific). | |
| #define | SERIAL_TYPE_NONE 0 |
| #define | SERIAL_TYPE_UART 1 |
| #define | SERIAL_TYPE_USB 2 |
| #define | SERIAL_TYPE_MAX 2 |
| #define | SERIAL_STATE_CLOSED 0 |
| #define | SERIAL_STATE_CLOSING 1 |
| #define | SERIAL_STATE_OPENING 2 |
| #define | SERIAL_STATE_OPEN 3 |
| #define | SERIAL_STATE_MAX 3 |
| #define | SERIAL_FLAG_NONE 0x00000000 |
| #define | SERIAL_FLAG_DATA_8BIT 0x00000001 |
| Device supports 8 data bits. | |
| #define | SERIAL_FLAG_DATA_7BIT 0x00000002 |
| Device supports 7 data bits. | |
| #define | SERIAL_FLAG_DATA_6BIT 0x00000004 |
| Device supports 6 data bits. | |
| #define | SERIAL_FLAG_DATA_5BIT 0x00000008 |
| Device supports 5 data bits. | |
| #define | SERIAL_FLAG_STOP_1BIT 0x00000010 |
| Device supports 1 stop bit. | |
| #define | SERIAL_FLAG_STOP_2BIT 0x00000020 |
| Device supports 2 stop bits. | |
| #define | SERIAL_FLAG_STOP_1BIT5 0x00000040 |
| Device supports 1.5 stop bits. | |
| #define | SERIAL_FLAG_PARITY_ODD 0x00000080 |
| Device supports odd parity. | |
| #define | SERIAL_FLAG_PARITY_EVEN 0x00000100 |
| Device supports even parity. | |
| #define | SERIAL_FLAG_PARITY_MARK 0x00000200 |
| Device supports mark parity. | |
| #define | SERIAL_FLAG_PARITY_SPACE 0x00000400 |
| Device supports space parity. | |
| #define | SERIAL_FLAG_FLOW_RTS_CTS 0x00000800 |
| Device supports RTS/CTS flow control. | |
| #define | SERIAL_FLAG_FLOW_DSR_DTR 0x00001000 |
| Device supports DSR/DTR flow control. | |
| #define | SERIAL_FLAG_PUSH_RX 0x00002000 |
| Device requires pushed receive (Implementation specific). | |
| #define | SERIAL_FLAG_PUSH_TX 0x00004000 |
| Device requires pushed transmit (Implementation specific). | |
| #define | SERIAL_READ_NONE 0x00000000 |
| #define | SERIAL_READ_NON_BLOCK 0x00000001 |
| Do not block when reading, if the buffer is empty return immediately. | |
| #define | SERIAL_READ_PEEK_BUFFER 0x00000002 |
| Return the number of bytes available in the receive buffer without reading them. | |
| #define | SERIAL_WRITE_NONE 0x00000000 |
| #define | SERIAL_WRITE_NON_BLOCK 0x00000001 |
| Do not block when writing, if the buffer is full return immediately. | |
| #define | SERIAL_WRITE_PEEK_BUFFER 0x00000002 |
| Return the number of bytes free in the transmit buffer without writing anything. | |
| #define | SERIAL_WAIT_NONE 0 |
| #define | SERIAL_WAIT_RECEIVE 1 |
| Wait for data to be available in the receive buffer. | |
| #define | SERIAL_WAIT_TRANSMIT 2 |
| Wait for space to be available in the transmit buffer. | |
| #define | SERIAL_FLUSH_NONE 0x00000000 |
| #define | SERIAL_FLUSH_RECEIVE 0x00000001 |
| Flush the receive buffer. | |
| #define | SERIAL_FLUSH_TRANSMIT 0x00000002 |
| Flush the transmit buffer. | |
| #define | SERIAL_STATUS_NONE 0x00000000 |
| #define | SERIAL_STATUS_RTS 0x00000001 |
| RTS (Request to Send) is set (If applicable). | |
| #define | SERIAL_STATUS_CTS 0x00000002 |
| CTS (Clear to Send) is set (If applicable). | |
| #define | SERIAL_STATUS_DSR 0x00000004 |
| DSR (Data Set Ready) is set (If applicable). | |
| #define | SERIAL_STATUS_DTR 0x00000008 |
| DTR (Data Terminal Ready) is set (If applicable). | |
| #define | SERIAL_STATUS_RX_FULL 0x00000010 |
| Receive buffer is full. | |
| #define | SERIAL_STATUS_RX_EMPTY 0x00000020 |
| Receive buffer is empty. | |
| #define | SERIAL_STATUS_TX_FULL 0x00000040 |
| Transmit buffer is full. | |
| #define | SERIAL_STATUS_TX_EMPTY 0x00000080 |
| Transmit buffer is empty. | |
| #define | SERIAL_STATUS_BUSY 0x00000100 |
| Device is busy. | |
| #define | SERIAL_STATUS_BREAK_ERROR 0x00000200 |
| Break error reported. | |
| #define | SERIAL_STATUS_PARITY_ERROR 0x00000400 |
| Parity error reported. | |
| #define | SERIAL_STATUS_FRAMING_ERROR 0x00000800 |
| Framing error reported. | |
| #define | SERIAL_STATUS_OVERRUN_ERROR 0x00001000 |
| Overrun error reported. | |
| #define | SERIAL_STATUS_DCD 0x00002000 |
| DCD (Data Carrier Detect) is set (If applicable). | |
| #define | SERIAL_STATUS_RI 0x00004000 |
| RI (Ring Indicator) is set (If applicable). | |
Typedefs | |
| typedef struct _SERIAL_PROPERTIES | SERIAL_PROPERTIES |
| typedef struct _SERIAL_BUFFER | SERIAL_BUFFER |
| typedef struct _SERIAL_DEVICE | SERIAL_DEVICE |
| typedef uint32_t STDCALL(* | serial_enumerate_cb) (SERIAL_DEVICE *serial, void *data) |
| typedef uint32_t STDCALL(* | serial_notification_cb) (DEVICE *device, void *data, uint32_t notification) |
| typedef uint32_t STDCALL(* | serial_device_open_proc) (SERIAL_DEVICE *serial, uint32_t baudrate, uint32_t databits, uint32_t stopbits, uint32_t parity, uint32_t flowcontrol, uint32_t receivedepth, uint32_t transmitdepth) |
| typedef uint32_t STDCALL(* | serial_device_close_proc) (SERIAL_DEVICE *serial) |
| typedef uint32_t STDCALL(* | serial_device_read_proc) (SERIAL_DEVICE *serial, void *buffer, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* | serial_device_write_proc) (SERIAL_DEVICE *serial, void *buffer, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* | serial_device_wait_proc) (SERIAL_DEVICE *serial, uint32_t direction, uint32_t timeout, uint32_t *count) |
| typedef uint32_t STDCALL(* | serial_device_flush_proc) (SERIAL_DEVICE *serial, uint32_t flags) |
| typedef uint32_t STDCALL(* | serial_device_get_status_proc) (SERIAL_DEVICE *serial) |
| typedef uint32_t STDCALL(* | serial_device_set_status_proc) (SERIAL_DEVICE *serial, uint32_t status) |
| typedef uint32_t STDCALL(* | serial_device_get_properties_proc) (SERIAL_DEVICE *serial, SERIAL_PROPERTIES *properties) |
| typedef uint32_t STDCALL(* | serial_device_set_properties_proc) (SERIAL_DEVICE *serial, SERIAL_PROPERTIES *properties) |
Functions | |
| uint32_t STDCALL | serial_device_open (SERIAL_DEVICE *serial, uint32_t baudrate, uint32_t databits, uint32_t stopbits, uint32_t parity, uint32_t flowcontrol, uint32_t receivedepth, uint32_t transmitdepth) |
| Open a Serial device ready for sending and receiving. | |
| uint32_t STDCALL | serial_device_close (SERIAL_DEVICE *serial) |
| Close a Serial device and terminate sending and receiving. | |
| uint32_t STDCALL | serial_device_read (SERIAL_DEVICE *serial, void *buffer, uint32_t size, uint32_t flags, uint32_t *count) |
| Read data from a Serial device. | |
| uint32_t STDCALL | serial_device_write (SERIAL_DEVICE *serial, void *buffer, uint32_t size, uint32_t flags, uint32_t *count) |
| Write data to a Serial device. | |
| uint32_t STDCALL | serial_device_wait (SERIAL_DEVICE *serial, uint32_t direction, uint32_t timeout, uint32_t *count) |
| Wait for data to be available in the receive or transmit buffers of a Serial device. | |
| uint32_t STDCALL | serial_device_flush (SERIAL_DEVICE *serial, uint32_t flags) |
| Discard the contents of the receive and/or transmit buffers of a Serial device. | |
| uint32_t STDCALL | serial_device_status (SERIAL_DEVICE *serial) |
| Get the current line status of a Serial device. | |
| uint32_t STDCALL | serial_device_get_status (SERIAL_DEVICE *serial) |
| Get the current line status of a Serial device. | |
| uint32_t STDCALL | serial_device_set_status (SERIAL_DEVICE *serial, uint32_t status) |
| Set the current line status of a Serial device. | |
| uint32_t STDCALL | serial_device_properties (SERIAL_DEVICE *serial, SERIAL_PROPERTIES *properties) |
| Get the properties for the specified Serial device. | |
| uint32_t STDCALL | serial_device_get_properties (SERIAL_DEVICE *serial, SERIAL_PROPERTIES *properties) |
| Get the properties for the specified Serial device. | |
| uint32_t STDCALL | serial_device_set_properties (SERIAL_DEVICE *serial, SERIAL_PROPERTIES *properties) |
| Set the properties for the specified Serial device. | |
| SERIAL_DEVICE *STDCALL | serial_device_create (void) |
| Create a new Serial entry. | |
| SERIAL_DEVICE *STDCALL | serial_device_create_ex (uint32_t size) |
| Create a new Serial entry. | |
| uint32_t STDCALL | serial_device_destroy (SERIAL_DEVICE *serial) |
| Destroy an existing Serial entry. | |
| uint32_t STDCALL | serial_device_register (SERIAL_DEVICE *serial) |
| Register a new Serial in the Serial table. | |
| uint32_t STDCALL | serial_device_deregister (SERIAL_DEVICE *serial) |
| Deregister a Serial from the Serial table. | |
| SERIAL_DEVICE *STDCALL | serial_device_find (uint32_t serialid) |
| Find a serial device by ID in the serial table. | |
| SERIAL_DEVICE *STDCALL | serial_device_find_by_name (const char *name) |
| Find a serial device by name in the serial table. | |
| SERIAL_DEVICE *STDCALL | serial_device_find_by_description (const char *description) |
| Find a serial device by description in the serial table. | |
| uint32_t STDCALL | serial_device_enumerate (serial_enumerate_cb callback, void *data) |
| Enumerate all serial devices in the serial table. | |
| uint32_t STDCALL | serial_device_notification (SERIAL_DEVICE *serial, serial_notification_cb callback, void *data, uint32_t notification, uint32_t flags) |
| Register a notification for serial device changes. | |
| int STDCALL | serial_device_printf (SERIAL_DEVICE *serial, const char *format,...) _ATTRIBUTE((__format__(__printf__ |
| Print formatted text to a Serial device. | |
| int STDCALL uint32_t STDCALL | serial_get_count (void) |
| Get the current Serial count. | |
| SERIAL_DEVICE *STDCALL | serial_device_get_default (void) |
| Get the current default Serial device. | |
| uint32_t STDCALL | serial_device_set_default (SERIAL_DEVICE *serial) |
| Set the current default Serial device. | |
| SERIAL_DEVICE *STDCALL | serial_device_check (SERIAL_DEVICE *serial) |
| Check if the supplied Serial is in the Serial table. | |
| uint32_t STDCALL | serial_type_to_string (uint32_t serialtype, char *string, uint32_t len) |
| Convert a Serial type value to a string. | |
| uint32_t STDCALL | serial_state_to_string (uint32_t serialstate, char *string, uint32_t len) |
| Convert a Serial state value to a string. | |
| BOOL STDCALL | serial_device_redirect_input (SERIAL_DEVICE *serial) |
| Redirect standard input to the serial device specified by Serial. | |
| BOOL STDCALL | serial_device_redirect_output (SERIAL_DEVICE *serial) |
| Redirect standard output to the serial device specified by Serial. | |
| void *STDCALL | serial_buffer_read_start (SERIAL_BUFFER *buffer, uint32_t *available) |
| Return a pointer to the next read from the buffer and the number of bytes that can be read. | |
| BOOL STDCALL | serial_buffer_read_complete (SERIAL_BUFFER *buffer, uint32_t removed) |
| Update the buffer to reflect the number of bytes removed when reading. | |
| void *STDCALL | serial_buffer_write_start (SERIAL_BUFFER *buffer, uint32_t *available) |
| Return a pointer to the next write to the buffer and the number of bytes that can be written. | |
| BOOL STDCALL | serial_buffer_write_complete (SERIAL_BUFFER *buffer, uint32_t added) |
| Update the buffer to reflect the number of bytes added when writing. | |
| uint32_t STDCALL | serial_data_bits_to_string (uint32_t bits, char *string, uint32_t len) |
| uint32_t STDCALL | serial_stop_bits_to_string (uint32_t bits, char *string, uint32_t len) |
| uint32_t STDCALL | serial_parity_to_string (uint32_t parity, char *string, uint32_t len) |
| uint32_t STDCALL | serial_flow_control_to_string (uint32_t flow, char *string, uint32_t len) |
| uint32_t STDCALL | serial_logging_device_add (SERIAL_DEVICE *serial) |
| Add a new serial logging device on receipt of a device register notification. | |
| uint32_t STDCALL | serial_logging_device_remove (SERIAL_DEVICE *serial) |
| Remove a serial logging device on receipt of a device deregister notification. | |
| uint32_t STDCALL | serial_logging_device_parameters (SERIAL_DEVICE *serial, const char *parameters, uint32_t *baudrate, uint32_t *parity, uint32_t *databits, uint32_t *stopbits) |
| Break down the serial parameters value into component parts of baud rate, parity, data bits and stop bits The parameters must be in the form 'BaudRate,Parity,DataBits,StopBits' (eg '115200,N,8,1'). | |
| #define SERIAL_NAME_PREFIX "Serial" |
Name prefix for Serial Devices.
Serial specific constants
| #define SERIAL_LOGGING_DESCRIPTION "Serial Logging" |
| #define SERIAL_RECEIVE_DEPTH_DEFAULT SIZE_2K |
Default receive buffer size in bytes.
| #define SERIAL_TRANSMIT_DEPTH_DEFAULT SIZE_2K |
Default transmit buffer size in bytes.
| #define SERIAL_PUSH_TIMEOUT 50 |
Timeout (Milliseconds) for Push RX/TX (Implementation specific).
| #define SERIAL_TYPE_NONE 0 |
Serial Device Types
| #define SERIAL_TYPE_UART 1 |
| #define SERIAL_TYPE_USB 2 |
| #define SERIAL_TYPE_MAX 2 |
| #define SERIAL_STATE_CLOSED 0 |
Serial Device States
| #define SERIAL_STATE_CLOSING 1 |
| #define SERIAL_STATE_OPENING 2 |
| #define SERIAL_STATE_OPEN 3 |
| #define SERIAL_STATE_MAX 3 |
| #define SERIAL_FLAG_NONE 0x00000000 |
Serial Device Flags
| #define SERIAL_FLAG_DATA_8BIT 0x00000001 |
Device supports 8 data bits.
| #define SERIAL_FLAG_DATA_7BIT 0x00000002 |
Device supports 7 data bits.
| #define SERIAL_FLAG_DATA_6BIT 0x00000004 |
Device supports 6 data bits.
| #define SERIAL_FLAG_DATA_5BIT 0x00000008 |
Device supports 5 data bits.
| #define SERIAL_FLAG_STOP_1BIT 0x00000010 |
Device supports 1 stop bit.
| #define SERIAL_FLAG_STOP_2BIT 0x00000020 |
Device supports 2 stop bits.
| #define SERIAL_FLAG_STOP_1BIT5 0x00000040 |
Device supports 1.5 stop bits.
| #define SERIAL_FLAG_PARITY_ODD 0x00000080 |
Device supports odd parity.
| #define SERIAL_FLAG_PARITY_EVEN 0x00000100 |
Device supports even parity.
| #define SERIAL_FLAG_PARITY_MARK 0x00000200 |
Device supports mark parity.
| #define SERIAL_FLAG_PARITY_SPACE 0x00000400 |
Device supports space parity.
| #define SERIAL_FLAG_FLOW_RTS_CTS 0x00000800 |
Device supports RTS/CTS flow control.
| #define SERIAL_FLAG_FLOW_DSR_DTR 0x00001000 |
Device supports DSR/DTR flow control.
| #define SERIAL_FLAG_PUSH_RX 0x00002000 |
Device requires pushed receive (Implementation specific).
| #define SERIAL_FLAG_PUSH_TX 0x00004000 |
Device requires pushed transmit (Implementation specific).
| #define SERIAL_READ_NONE 0x00000000 |
Serial Read Flags
| #define SERIAL_READ_NON_BLOCK 0x00000001 |
Do not block when reading, if the buffer is empty return immediately.
| #define SERIAL_READ_PEEK_BUFFER 0x00000002 |
Return the number of bytes available in the receive buffer without reading them.
| #define SERIAL_WRITE_NONE 0x00000000 |
Serial Write Flags
| #define SERIAL_WRITE_NON_BLOCK 0x00000001 |
Do not block when writing, if the buffer is full return immediately.
| #define SERIAL_WRITE_PEEK_BUFFER 0x00000002 |
Return the number of bytes free in the transmit buffer without writing anything.
| #define SERIAL_WAIT_NONE 0 |
Serial Wait Directions
| #define SERIAL_WAIT_RECEIVE 1 |
Wait for data to be available in the receive buffer.
| #define SERIAL_WAIT_TRANSMIT 2 |
Wait for space to be available in the transmit buffer.
| #define SERIAL_FLUSH_NONE 0x00000000 |
Serial Flush Flags
| #define SERIAL_FLUSH_RECEIVE 0x00000001 |
Flush the receive buffer.
| #define SERIAL_FLUSH_TRANSMIT 0x00000002 |
Flush the transmit buffer.
| #define SERIAL_STATUS_NONE 0x00000000 |
Serial Status Flags
| #define SERIAL_STATUS_RTS 0x00000001 |
RTS (Request to Send) is set (If applicable).
| #define SERIAL_STATUS_CTS 0x00000002 |
CTS (Clear to Send) is set (If applicable).
| #define SERIAL_STATUS_DSR 0x00000004 |
DSR (Data Set Ready) is set (If applicable).
| #define SERIAL_STATUS_DTR 0x00000008 |
DTR (Data Terminal Ready) is set (If applicable).
| #define SERIAL_STATUS_RX_FULL 0x00000010 |
Receive buffer is full.
| #define SERIAL_STATUS_RX_EMPTY 0x00000020 |
Receive buffer is empty.
| #define SERIAL_STATUS_TX_FULL 0x00000040 |
Transmit buffer is full.
| #define SERIAL_STATUS_TX_EMPTY 0x00000080 |
Transmit buffer is empty.
| #define SERIAL_STATUS_BUSY 0x00000100 |
Device is busy.
| #define SERIAL_STATUS_BREAK_ERROR 0x00000200 |
Break error reported.
| #define SERIAL_STATUS_PARITY_ERROR 0x00000400 |
Parity error reported.
| #define SERIAL_STATUS_FRAMING_ERROR 0x00000800 |
Framing error reported.
| #define SERIAL_STATUS_OVERRUN_ERROR 0x00001000 |
Overrun error reported.
| #define SERIAL_STATUS_DCD 0x00002000 |
DCD (Data Carrier Detect) is set (If applicable).
| #define SERIAL_STATUS_RI 0x00004000 |
RI (Ring Indicator) is set (If applicable).
| typedef struct _SERIAL_PROPERTIES SERIAL_PROPERTIES |
Serial specific types Serial Properties
| typedef struct _SERIAL_BUFFER SERIAL_BUFFER |
Serial Buffer
| typedef struct _SERIAL_DEVICE SERIAL_DEVICE |
Serial Device
| typedef uint32_t STDCALL(* serial_enumerate_cb) (SERIAL_DEVICE *serial, void *data) |
Serial Enumeration Callback
| typedef uint32_t STDCALL(* serial_notification_cb) (DEVICE *device, void *data, uint32_t notification) |
Serial Notification Callback
| typedef uint32_t STDCALL(* serial_device_open_proc) (SERIAL_DEVICE *serial, uint32_t baudrate, uint32_t databits, uint32_t stopbits, uint32_t parity, uint32_t flowcontrol, uint32_t receivedepth, uint32_t transmitdepth) |
Serial Device Methods
| typedef uint32_t STDCALL(* serial_device_close_proc) (SERIAL_DEVICE *serial) |
| typedef uint32_t STDCALL(* serial_device_read_proc) (SERIAL_DEVICE *serial, void *buffer, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* serial_device_write_proc) (SERIAL_DEVICE *serial, void *buffer, uint32_t size, uint32_t flags, uint32_t *count) |
| typedef uint32_t STDCALL(* serial_device_wait_proc) (SERIAL_DEVICE *serial, uint32_t direction, uint32_t timeout, uint32_t *count) |
| typedef uint32_t STDCALL(* serial_device_flush_proc) (SERIAL_DEVICE *serial, uint32_t flags) |
| typedef uint32_t STDCALL(* serial_device_get_status_proc) (SERIAL_DEVICE *serial) |
| typedef uint32_t STDCALL(* serial_device_set_status_proc) (SERIAL_DEVICE *serial, uint32_t status) |
| typedef uint32_t STDCALL(* serial_device_get_properties_proc) (SERIAL_DEVICE *serial, SERIAL_PROPERTIES *properties) |
| typedef uint32_t STDCALL(* serial_device_set_properties_proc) (SERIAL_DEVICE *serial, SERIAL_PROPERTIES *properties) |
| uint32_t STDCALL serial_device_open | ( | SERIAL_DEVICE * | serial, |
| uint32_t | baudrate, | ||
| uint32_t | databits, | ||
| uint32_t | stopbits, | ||
| uint32_t | parity, | ||
| uint32_t | flowcontrol, | ||
| uint32_t | receivedepth, | ||
| uint32_t | transmitdepth ) |
Open a Serial device ready for sending and receiving.
Serial Functions
| Serial | The Serial device to open |
| BaudRate | Baud rate for the connection (eg 9600, 57600, 115200 etc |
| DataBits | Size of the data (eg SERIAL_DATA_8BIT) |
| StopBits | Number of stop bits (eg SERIAL_STOP_1BIT) |
| Parity | Parity type for the data (eg SERIAL_PARITY_NONE) |
| FlowControl | Flow control for the connection (eg SERIAL_FLOW_NONE) |
| ReceiveDepth | Size of the receive buffer (0 = Default size) |
| TransmitDepth | Size of the transmit buffer (0 = Default size) |
| uint32_t STDCALL serial_device_close | ( | SERIAL_DEVICE * | serial | ) |
Close a Serial device and terminate sending and receiving.
| Serial | The Serial device to close |
| uint32_t STDCALL serial_device_read | ( | SERIAL_DEVICE * | serial, |
| void * | buffer, | ||
| uint32_t | size, | ||
| uint32_t | flags, | ||
| uint32_t * | count ) |
Read data from a Serial device.
| Serial | The Serial device to read from |
| Buffer | Pointer to a buffer to receive the data |
| Size | The size of the buffer |
| Flags | The flags to control reading (eg SERIAL_READ_NON_BLOCK) |
| Count | The number of bytes read on return |
| uint32_t STDCALL serial_device_write | ( | SERIAL_DEVICE * | serial, |
| void * | buffer, | ||
| uint32_t | size, | ||
| uint32_t | flags, | ||
| uint32_t * | count ) |
Write data to a Serial device.
| Serial | The Serial device to write to |
| Buffer | Pointer to a buffer of data to transmit |
| Size | The size of the buffer |
| Flags | The flags to control writing (eg SERIAL_WRITE_NON_BLOCK) |
| Count | The number of bytes written on return |
| uint32_t STDCALL serial_device_wait | ( | SERIAL_DEVICE * | serial, |
| uint32_t | direction, | ||
| uint32_t | timeout, | ||
| uint32_t * | count ) |
Wait for data to be available in the receive or transmit buffers of a Serial device.
| Serial | The Serial device to wait for |
| Direction | The direction of data to wait for (eg SERIAL_WAIT_RECEIVE) |
| Timeout | The number of milliseconds to wait for data (INFINITE to wait forever) |
| Count | The number of bytes available on return |
| uint32_t STDCALL serial_device_flush | ( | SERIAL_DEVICE * | serial, |
| uint32_t | flags ) |
Discard the contents of the receive and/or transmit buffers of a Serial device.
| Serial | The Serial device to flush |
| Flags | The flags to indicate what to flush (eg SERIAL_FLUSH_RECEIVE) |
| uint32_t STDCALL serial_device_status | ( | SERIAL_DEVICE * | serial | ) |
Get the current line status of a Serial device.
| Serial | The Serial device to get the status from |
| uint32_t STDCALL serial_device_get_status | ( | SERIAL_DEVICE * | serial | ) |
Get the current line status of a Serial device.
| Serial | The Serial device to get the status from |
| uint32_t STDCALL serial_device_set_status | ( | SERIAL_DEVICE * | serial, |
| uint32_t | status ) |
Set the current line status of a Serial device.
| Serial | The Serial device to set the status for |
| Status | The device status flags to be set (eg SERIAL_STATUS_RTS) |
| uint32_t STDCALL serial_device_properties | ( | SERIAL_DEVICE * | serial, |
| SERIAL_PROPERTIES * | properties ) |
Get the properties for the specified Serial device.
| Serial | The Serial device to get properties from |
| Properties | Pointer to a PSerialProperties structure to fill in |
| uint32_t STDCALL serial_device_get_properties | ( | SERIAL_DEVICE * | serial, |
| SERIAL_PROPERTIES * | properties ) |
Get the properties for the specified Serial device.
| Serial | The Serial device to get properties from |
| Properties | Pointer to a PSerialProperties structure to fill in |
| uint32_t STDCALL serial_device_set_properties | ( | SERIAL_DEVICE * | serial, |
| SERIAL_PROPERTIES * | properties ) |
Set the properties for the specified Serial device.
| Serial | The Serial device to set properties for |
| Properties | Pointer to a PSerialProperties structure to use |
| SERIAL_DEVICE *STDCALL serial_device_create | ( | void | ) |
Create a new Serial entry.
| SERIAL_DEVICE *STDCALL serial_device_create_ex | ( | uint32_t | size | ) |
Create a new Serial entry.
| Size | Size in bytes to allocate for new Serial (Including the Serial entry) |
| uint32_t STDCALL serial_device_destroy | ( | SERIAL_DEVICE * | serial | ) |
Destroy an existing Serial entry.
| Serial | The serial device to destroy |
| uint32_t STDCALL serial_device_register | ( | SERIAL_DEVICE * | serial | ) |
Register a new Serial in the Serial table.
| Serial | The serial device to register |
| uint32_t STDCALL serial_device_deregister | ( | SERIAL_DEVICE * | serial | ) |
Deregister a Serial from the Serial table.
| Serial | The serial device to deregister |
| SERIAL_DEVICE *STDCALL serial_device_find | ( | uint32_t | serialid | ) |
Find a serial device by ID in the serial table.
| SerialId | The ID number of the serial to find |
| SERIAL_DEVICE *STDCALL serial_device_find_by_name | ( | const char * | name | ) |
Find a serial device by name in the serial table.
| Name | The name of the serial to find (eg Serial0) |
| SERIAL_DEVICE *STDCALL serial_device_find_by_description | ( | const char * | description | ) |
Find a serial device by description in the serial table.
| Description | The description of the serial to find (eg BCM2836 PL011 UART) |
| uint32_t STDCALL serial_device_enumerate | ( | serial_enumerate_cb | callback, |
| void * | data ) |
Enumerate all serial devices in the serial table.
| Callback | The callback function to call for each serial in the table |
| Data | A private data pointer to pass to callback for each serial in the table |
| uint32_t STDCALL serial_device_notification | ( | SERIAL_DEVICE * | serial, |
| serial_notification_cb | callback, | ||
| void * | data, | ||
| uint32_t | notification, | ||
| uint32_t | flags ) |
Register a notification for serial device changes.
| Serial | The serial device to notify changes for (Optional, pass nil for all serial devices) |
| Callback | The function to call when a notification event occurs |
| Data | A private data pointer to pass to callback when a notification event occurs |
| Notification | The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER) |
| Flags | The flags to control the notification (eg NOTIFIER_FLAG_WORKER) |
| int STDCALL serial_device_printf | ( | SERIAL_DEVICE * | serial, |
| const char * | format, | ||
| ... ) |
Print formatted text to a Serial device.
| Serial | The serial device to print text to |
| Format | The formatted text to print (As per printf in standard C library) |
Get the current Serial count.
Serial Helper Functions
| SERIAL_DEVICE *STDCALL serial_device_get_default | ( | void | ) |
Get the current default Serial device.
| uint32_t STDCALL serial_device_set_default | ( | SERIAL_DEVICE * | serial | ) |
Set the current default Serial device.
| SERIAL_DEVICE *STDCALL serial_device_check | ( | SERIAL_DEVICE * | serial | ) |
Check if the supplied Serial is in the Serial table.
| uint32_t STDCALL serial_type_to_string | ( | uint32_t | serialtype, |
| char * | string, | ||
| uint32_t | len ) |
Convert a Serial type value to a string.
| uint32_t STDCALL serial_state_to_string | ( | uint32_t | serialstate, |
| char * | string, | ||
| uint32_t | len ) |
Convert a Serial state value to a string.
| BOOL STDCALL serial_device_redirect_input | ( | SERIAL_DEVICE * | serial | ) |
Redirect standard input to the serial device specified by Serial.
| Serial | The serial device to redirect input to (or nil to stop redirection) |
| BOOL STDCALL serial_device_redirect_output | ( | SERIAL_DEVICE * | serial | ) |
Redirect standard output to the serial device specified by Serial.
| Serial | The serial device to redirect output to (or nil to stop redirection) |
| void *STDCALL serial_buffer_read_start | ( | SERIAL_BUFFER * | buffer, |
| uint32_t * | available ) |
Return a pointer to the next read from the buffer and the number of bytes that can be read.
| BOOL STDCALL serial_buffer_read_complete | ( | SERIAL_BUFFER * | buffer, |
| uint32_t | removed ) |
Update the buffer to reflect the number of bytes removed when reading.
| void *STDCALL serial_buffer_write_start | ( | SERIAL_BUFFER * | buffer, |
| uint32_t * | available ) |
Return a pointer to the next write to the buffer and the number of bytes that can be written.
| BOOL STDCALL serial_buffer_write_complete | ( | SERIAL_BUFFER * | buffer, |
| uint32_t | added ) |
Update the buffer to reflect the number of bytes added when writing.
| uint32_t STDCALL serial_data_bits_to_string | ( | uint32_t | bits, |
| char * | string, | ||
| uint32_t | len ) |
| uint32_t STDCALL serial_stop_bits_to_string | ( | uint32_t | bits, |
| char * | string, | ||
| uint32_t | len ) |
| uint32_t STDCALL serial_parity_to_string | ( | uint32_t | parity, |
| char * | string, | ||
| uint32_t | len ) |
| uint32_t STDCALL serial_flow_control_to_string | ( | uint32_t | flow, |
| char * | string, | ||
| uint32_t | len ) |
| uint32_t STDCALL serial_logging_device_add | ( | SERIAL_DEVICE * | serial | ) |
Add a new serial logging device on receipt of a device register notification.
Serial Logging Helper Functions
| uint32_t STDCALL serial_logging_device_remove | ( | SERIAL_DEVICE * | serial | ) |
Remove a serial logging device on receipt of a device deregister notification.
| uint32_t STDCALL serial_logging_device_parameters | ( | SERIAL_DEVICE * | serial, |
| const char * | parameters, | ||
| uint32_t * | baudrate, | ||
| uint32_t * | parity, | ||
| uint32_t * | databits, | ||
| uint32_t * | stopbits ) |
Break down the serial parameters value into component parts of baud rate, parity, data bits and stop bits The parameters must be in the form 'BaudRate,Parity,DataBits,StopBits' (eg '115200,N,8,1').