Difference between revisions of "Unit Serial"
Line 646: | Line 646: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 661: | Line 661: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to open | | The Serial device to open | ||
|- | |- | ||
− | ! | + | ! BaudRate |
− | | Baud rate for the connection (eg 9600, 57600, 115200 etc | + | | Baud rate for the connection (eg 9600, 57600, 115200 etc) |
|- | |- | ||
− | ! | + | ! DataBits |
| Size of the data (eg SERIAL_DATA_8BIT) | | Size of the data (eg SERIAL_DATA_8BIT) | ||
|- | |- | ||
− | ! | + | ! StopBits |
| Number of stop bits (eg SERIAL_STOP_1BIT) | | Number of stop bits (eg SERIAL_STOP_1BIT) | ||
|- | |- | ||
− | ! | + | ! Parity |
| Parity type for the data (eg SERIAL_PARITY_NONE) | | Parity type for the data (eg SERIAL_PARITY_NONE) | ||
|- | |- | ||
− | ! | + | ! FlowControl |
| Flow control for the connection (eg SERIAL_FLOW_NONE) | | Flow control for the connection (eg SERIAL_FLOW_NONE) | ||
|- | |- | ||
− | ! | + | ! ReceiveDepth |
| Size of the receive buffer (0 = Default size) | | Size of the receive buffer (0 = Default size) | ||
|- | |- | ||
− | ! | + | ! TransmitDepth |
| Size of the transmit buffer (0 = Default size) | | Size of the transmit buffer (0 = Default size) | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 697: | Line 697: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to close | | The Serial device to close | ||
|- | |- | ||
− | ! | + | ! Note |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 712: | Line 712: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to read from | | The Serial device to read from | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Pointer to a buffer to receive the data | | Pointer to a buffer to receive the data | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the buffer | | The size of the buffer | ||
|- | |- | ||
− | ! | + | ! Flags |
| The flags to control reading (eg SERIAL_READ_NON_BLOCK) | | The flags to control reading (eg SERIAL_READ_NON_BLOCK) | ||
|- | |- | ||
− | ! | + | ! Count |
| The number of bytes read on return | | The number of bytes read on return | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 739: | Line 739: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to write to | | The Serial device to write to | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Pointer to a buffer of data to transmit | | Pointer to a buffer of data to transmit | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the buffer | | The size of the buffer | ||
|- | |- | ||
− | ! | + | ! Flags |
| The flags to control writing (eg SERIAL_WRITE_NON_BLOCK) | | The flags to control writing (eg SERIAL_WRITE_NON_BLOCK) | ||
|- | |- | ||
− | ! | + | ! Count |
| The number of bytes written on return | | The number of bytes written on return | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 766: | Line 766: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to wait for | | The Serial device to wait for | ||
|- | |- | ||
− | ! | + | ! Direction |
| The direction of data to wait for (eg SERIAL_WAIT_RECEIVE) | | The direction of data to wait for (eg SERIAL_WAIT_RECEIVE) | ||
|- | |- | ||
− | ! | + | ! Timeout |
| The number of milliseconds to wait for data (INFINITE to wait forever) | | The number of milliseconds to wait for data (INFINITE to wait forever) | ||
|- | |- | ||
− | ! | + | ! Count |
| The number of bytes available on return | | The number of bytes available on return | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 790: | Line 790: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to flush | | The Serial device to flush | ||
|- | |- | ||
− | ! | + | ! Flags |
| The flags to indicate what to flush (eg SERIAL_FLUSH_RECEIVE) | | The flags to indicate what to flush (eg SERIAL_FLUSH_RECEIVE) | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 808: | Line 808: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to get the status from | | The Serial device to get the status from | ||
|- | |- | ||
− | ! | + | ! Return |
| A set of flags containing the device status (eg SERIAL_STATUS_RTS) | | A set of flags containing the device status (eg SERIAL_STATUS_RTS) | ||
|- | |- | ||
Line 823: | Line 823: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to get the status from | | The Serial device to get the status from | ||
|- | |- | ||
− | ! | + | ! Return |
| A set of flags containing the device status (eg SERIAL_STATUS_RTS) | | A set of flags containing the device status (eg SERIAL_STATUS_RTS) | ||
|- | |- | ||
Line 838: | Line 838: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to set the status for | | The Serial device to set the status for | ||
|- | |- | ||
− | ! | + | ! Status |
| The device status flags to be set (eg SERIAL_STATUS_RTS) | | The device status flags to be set (eg SERIAL_STATUS_RTS) | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not all SERIAL_STATUS_* flags can be set, the device may ignore invalid values | + | | Not all SERIAL_STATUS_* flags can be set, the device may ignore invalid values. |
− | Not all serial devices support set status, returns ERROR_CALL_NOT_IMPLEMENTED if not supported | + | Not all serial devices support set status, returns ERROR_CALL_NOT_IMPLEMENTED if not supported. |
|- | |- | ||
|} | |} | ||
Line 860: | Line 860: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to get properties from | | The Serial device to get properties from | ||
|- | |- | ||
− | ! | + | ! Properties |
| Pointer to a PSerialProperties structure to fill in | | Pointer to a PSerialProperties structure to fill in | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
− | ! | + | ! Note |
| Replaced by SerialDeviceGetProperties for consistency | | Replaced by SerialDeviceGetProperties for consistency | ||
|- | |- | ||
Line 881: | Line 881: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to get properties from | | The Serial device to get properties from | ||
|- | |- | ||
− | ! | + | ! Properties |
| Pointer to a PSerialProperties structure to fill in | | Pointer to a PSerialProperties structure to fill in | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 899: | Line 899: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The Serial device to set properties for | | The Serial device to set properties for | ||
|- | |- | ||
− | ! | + | ! Properties |
| Pointer to a PSerialProperties structure to use | | Pointer to a PSerialProperties structure to use | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 917: | Line 917: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to new Serial entry or nil if Serial could not be created | | Pointer to new Serial entry or nil if Serial could not be created | ||
|- | |- | ||
Line 929: | Line 929: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Size |
| Size in bytes to allocate for new Serial (Including the Serial entry) | | Size in bytes to allocate for new Serial (Including the Serial entry) | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to new Serial entry or nil if Serial could not be created | | Pointer to new Serial entry or nil if Serial could not be created | ||
|- | |- | ||
Line 944: | Line 944: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The serial device to destroy | | The serial device to destroy | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 959: | Line 959: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The serial device to register | | The serial device to register | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 974: | Line 974: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The serial device to deregister | | The serial device to deregister | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 989: | Line 989: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! SerialId |
| The Id number of the serial to find | | The Id number of the serial to find | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to serial device entry or nil if not found | | Pointer to serial device entry or nil if not found | ||
|- | |- | ||
Line 1,004: | Line 1,004: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Name |
| The name of the serial to find (eg Serial0) | | The name of the serial to find (eg Serial0) | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to serial device entry or nil if not found | | Pointer to serial device entry or nil if not found | ||
|- | |- | ||
Line 1,019: | Line 1,019: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Description |
| The description of the serial to find (eg BCM2836 PL011 UART) | | The description of the serial to find (eg BCM2836 PL011 UART) | ||
|- | |- | ||
− | ! | + | ! Return |
| Pointer to serial device entry or nil if not found | | Pointer to serial device entry or nil if not found | ||
|- | |- | ||
Line 1,034: | Line 1,034: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Callback |
| The callback function to call for each serial in the table | | 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 | | A private data pointer to pass to callback for each serial in the table | ||
|- | |- | ||
− | ! | + | ! Return |
| ERROR_SUCCESS if completed or another error code on failure | | ERROR_SUCCESS if completed or another error code on failure | ||
|- | |- | ||
Line 1,052: | Line 1,052: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The serial device to notify changes for (Optional, pass nil for all serial devices) | | The serial device to notify changes for (Optional, pass nil for all serial devices) | ||
|- | |- | ||
− | ! | + | ! Callback |
| The function to call when a notification event occurs | | The function to call when a notification event occurs | ||
|- | |- | ||
− | ! | + | ! Data |
| A private data pointer to pass to callback when a notification event occurs | | 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) | | The events to register for notification of (eg DEVICE_NOTIFICATION_REGISTER) | ||
|- | |- | ||
− | ! | + | ! Flags |
| The flags to control the notification (eg NOTIFIER_FLAG_WORKER) | | The flags to control the notification (eg NOTIFIER_FLAG_WORKER) | ||
|- | |- | ||
Line 1,079: | Line 1,079: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use LoggingDeviceStart instead | + | | Not intended to be called directly by applications, use LoggingDeviceStart instead. |
|- | |- | ||
|} | |} | ||
Line 1,091: | Line 1,091: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use LoggingDeviceStop instead | + | | Not intended to be called directly by applications, use LoggingDeviceStop instead. |
|- | |- | ||
|} | |} | ||
Line 1,103: | Line 1,103: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Not intended to be called directly by applications, use LoggingDeviceOutput instead | + | | Not intended to be called directly by applications, use LoggingDeviceOutput instead. |
|- | |- | ||
|} | |} | ||
Line 1,118: | Line 1,118: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 1,130: | Line 1,130: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 1,142: | Line 1,142: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 1,157: | Line 1,157: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,169: | Line 1,169: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! BaudRate |
− | | Baud rate for the connection (eg 9600, 57600, 115200 etc | + | | Baud rate for the connection (eg 9600, 57600, 115200 etc) |
|- | |- | ||
− | ! | + | ! DataBits |
| Size of the data (eg SERIAL_DATA_8BIT) | | Size of the data (eg SERIAL_DATA_8BIT) | ||
|- | |- | ||
− | ! | + | ! StopBits |
| Number of stop bits (eg SERIAL_STOP_1BIT) | | Number of stop bits (eg SERIAL_STOP_1BIT) | ||
|- | |- | ||
− | ! | + | ! Parity |
| Parity type for the data (eg SERIAL_PARITY_NONE) | | Parity type for the data (eg SERIAL_PARITY_NONE) | ||
|- | |- | ||
− | ! | + | ! FlowControl |
| Flow control for the connection (eg SERIAL_FLOW_NONE) | | Flow control for the connection (eg SERIAL_FLOW_NONE) | ||
|- | |- | ||
− | ! | + | ! ReceiveDepth |
| Size of the receive buffer (0 = Default size) | | Size of the receive buffer (0 = Default size) | ||
|- | |- | ||
− | ! | + | ! TransmitDepth |
| Size of the transmit buffer (0 = Default size) | | Size of the transmit buffer (0 = Default size) | ||
|- | |- | ||
Line 1,199: | Line 1,199: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,211: | Line 1,211: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Pointer to a buffer to receive the data | | Pointer to a buffer to receive the data | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the buffer | | The size of the buffer | ||
|- | |- | ||
− | ! | + | ! Count |
| The number of bytes read on return | | The number of bytes read on return | ||
|- | |- | ||
Line 1,229: | Line 1,229: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Buffer |
| Pointer to a buffer of data to transmit | | Pointer to a buffer of data to transmit | ||
|- | |- | ||
− | ! | + | ! Size |
| The size of the buffer | | The size of the buffer | ||
|- | |- | ||
− | ! | + | ! Count |
| The number of bytes written on return | | The number of bytes written on return | ||
|- | |- | ||
Line 1,250: | Line 1,250: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,262: | Line 1,262: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,274: | Line 1,274: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,286: | Line 1,286: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,298: | Line 1,298: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The serial device to redirect input to (or nil to stop redirection) | | The serial device to redirect input to (or nil to stop redirection) | ||
|- | |- | ||
− | ! | + | ! Return |
| True if completed successfully or False if an error occurred | | True if completed successfully or False if an error occurred | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Redirects the input of the text file Input which also redirects the input of Read, ReadLn and the standard C library | + | | Redirects the input of the text file Input which also redirects the input of Read, ReadLn and the standard C library. |
|- | |- | ||
|} | |} | ||
Line 1,316: | Line 1,316: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Serial |
| The serial device to redirect output to (or nil to stop redirection) | | The serial device to redirect output to (or nil to stop redirection) | ||
|- | |- | ||
− | ! | + | ! Return |
| True if completed successfully or False if an error occurred | | True if completed successfully or False if an error occurred | ||
|- | |- | ||
− | ! | + | ! Note |
− | | Redirects the output of the text files Output, ErrOutput, StdOut and StdErr which also redirects the output of Write, WriteLn and the standard C library | + | | Redirects the output of the text files Output, ErrOutput, StdOut and StdErr which also redirects the output of Write, WriteLn and the standard C library. |
|- | |- | ||
|} | |} | ||
Line 1,334: | Line 1,334: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the lock on the serial device which owns the buffer | | Caller must hold the lock on the serial device which owns the buffer | ||
|- | |- | ||
Line 1,346: | Line 1,346: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the lock on the serial device which owns the buffer | | Caller must hold the lock on the serial device which owns the buffer | ||
|- | |- | ||
Line 1,358: | Line 1,358: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the lock on the serial device which owns the buffer | | Caller must hold the lock on the serial device which owns the buffer | ||
|- | |- | ||
Line 1,370: | Line 1,370: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Caller must hold the lock on the serial device which owns the buffer | | Caller must hold the lock on the serial device which owns the buffer | ||
|- | |- | ||
Line 1,382: | Line 1,382: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,394: | Line 1,394: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,406: | Line 1,406: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,418: | Line 1,418: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,430: | Line 1,430: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,442: | Line 1,442: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,454: | Line 1,454: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,469: | Line 1,469: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,481: | Line 1,481: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,493: | Line 1,493: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| The parameters must be in the form 'BaudRate,Parity,DataBits,StopBits' (eg '115200,N,8,1') | | The parameters must be in the form 'BaudRate,Parity,DataBits,StopBits' (eg '115200,N,8,1') | ||
|- | |- | ||
Line 1,505: | Line 1,505: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| None documented | | None documented | ||
|- | |- | ||
Line 1,517: | Line 1,517: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- | ||
Line 1,529: | Line 1,529: | ||
{| class="wikitable" style="font-size: 14px; background: white;" | {| class="wikitable" style="font-size: 14px; background: white;" | ||
|- | |- | ||
− | ! | + | ! Note |
| Not intended to be called directly by applications | | Not intended to be called directly by applications | ||
|- | |- |
Revision as of 05:30, 20 April 2018
Return to Unit Reference
Contents
[hide]Description
Ultibo Serial interface unit
Serial devices represent a communication device that can be both read and written and has a set of common properties and capabilities. The underlying device may be an actual UART or it may be some other form of device such as a USB to Serial converter. As long as the device can implement the common capabilities then it can be accessed as a serial device without regard to the actual implementation.
Each serial device returns a set of properties that describe the capabilities of the device and includes a set of flags that indicate what features are supported.
Reads from and writes to serial devices are buffered so that varying data transfer rates can be accommodated and both reads and writes allow for non blocking so that a caller can avoid waiting for received data to be available or the device to be ready to transmit.
This unit also implements the serial logging device which can be configured via parameters in the GlobalConfig unit or from the command line.
Constants
SERIAL_*
SERIAL_TYPE_*
SERIAL_STATE_*
SERIAL_FLAG_*
SERIAL_READ_*
SERIAL_WRITE_*
SERIAL_WAIT_*
SERIAL_FLUSH_*
SERIAL_STATUS_*
SERIAL_LOG_*
Type definitions
Serial properties
Serial buffer
Serial enumeration callback
TSerialEnumerate = function(Serial:PSerialDevice; Data:Pointer):LongWord;
|
Serial notification callback
TSerialNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
|
Serial device open
TSerialDeviceOpen = function(Serial:PSerialDevice; BaudRate,DataBits,StopBits,Parity,FlowControl,ReceiveDepth,TransmitDepth:LongWord):LongWord;
|
Serial device close
TSerialDeviceClose = function(Serial:PSerialDevice):LongWord;
|
Serial device read
TSerialDeviceRead = function(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
|
Serial device write
TSerialDeviceWrite = function(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
|
Serial device wait
TSerialDeviceWait = function(Serial:PSerialDevice; Direction,Timeout:LongWord; var Count:LongWord):LongWord;
|
Serial device flush
TSerialDeviceFlush = function(Serial:PSerialDevice;Flags:LongWord):LongWord;
|
Serial device get status
TSerialDeviceGetStatus = function(Serial:PSerialDevice):LongWord;
|
Serial device set status
TSerialDeviceSetStatus = function(Serial:PSerialDevice; Status:LongWord):LongWord;
|
Serial device get properties
TSerialDeviceGetProperties = function(Serial:PSerialDevice; Properties:PSerialProperties):LongWord;
|
Serial device set properties
TSerialDeviceSetProperties = function(Serial:PSerialDevice; Properties:PSerialProperties):LongWord;
|
Serial device
Serial logging
Public variables
Serial logging
SERIAL_DEFAULT_LOG_LEVEL:LongWord = SERIAL_LOG_LEVEL_DEBUG;
|
Minimum level for Serial messages. Only messages with level greater than or equal to this will be printed. |
SERIAL_LOG_ENABLED:Boolean;
|
Function declarations
Initialization functions
Serial functions
function SerialDeviceOpen(Serial:PSerialDevice; BaudRate,DataBits,StopBits,Parity,FlowControl,ReceiveDepth,TransmitDepth:LongWord):LongWord;
function SerialDeviceClose(Serial:PSerialDevice):LongWord;
function SerialDeviceRead(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
function SerialDeviceWrite(Serial:PSerialDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
function SerialDeviceWait(Serial:PSerialDevice; Direction,Timeout:LongWord; var Count:LongWord):LongWord;
function SerialDeviceFlush(Serial:PSerialDevice; Flags:LongWord):LongWord;
function SerialDeviceStatus(Serial:PSerialDevice):LongWord; inline;
function SerialDeviceGetStatus(Serial:PSerialDevice):LongWord;
function SerialDeviceSetStatus(Serial:PSerialDevice; Status:LongWord):LongWord;
function SerialDeviceProperties(Serial:PSerialDevice; Properties:PSerialProperties):LongWord; inline;
function SerialDeviceGetProperties(Serial:PSerialDevice; Properties:PSerialProperties):LongWord;
function SerialDeviceSetProperties(Serial:PSerialDevice; Properties:PSerialProperties):LongWord;
function SerialDeviceCreateEx(Size:LongWord):PSerialDevice;
function SerialDeviceDestroy(Serial:PSerialDevice):LongWord;
function SerialDeviceRegister(Serial:PSerialDevice):LongWord;
function SerialDeviceDeregister(Serial:PSerialDevice):LongWord;
function SerialDeviceFind(SerialId:LongWord):PSerialDevice;
function SerialDeviceFindByName(const Name:String):PSerialDevice; inline;
function SerialDeviceFindByDescription(const Description:String):PSerialDevice; inline;
function SerialDeviceEnumerate(Callback:TSerialEnumerate; Data:Pointer):LongWord;
function SerialDeviceNotification(Serial:PSerialDevice; Callback:TSerialNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Serial logging functions
function SerialLoggingStart(Logging:PLoggingDevice):LongWord;
function SerialLoggingStop(Logging:PLoggingDevice):LongWord;
function SerialLoggingOutput(Logging:PLoggingDevice; const Data:String):LongWord;
RTL text IO functions
function SysTextIOReadChar(var ACh:Char; AUserData:Pointer):Boolean;
function SysTextIOWriteChar(ACh:Char; AUserData:Pointer):Boolean;
function SysTextIOWriteBuffer(ABuffer:PChar; ACount:LongInt; AUserData:Pointer):LongInt;
RTL serial functions
function SysSerialOpen(BaudRate,DataBits,StopBits,Parity,FlowControl,ReceiveDepth,TransmitDepth:LongWord):LongWord;
function SysSerialClose:LongWord;
function SysSerialRead(Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
function SysSerialWrite(Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Serial helper functions
function SerialDeviceGetDefault:PSerialDevice; inline;
function SerialDeviceSetDefault(Serial:PSerialDevice):LongWord;
function SerialDeviceCheck(Serial:PSerialDevice):PSerialDevice;
function SerialDeviceRedirectInput(Serial:PSerialDevice):Boolean;
function SerialDeviceRedirectOutput(Serial:PSerialDevice):Boolean;
function SerialBufferReadStart(Buffer:PSerialBuffer; var Available:LongWord):Pointer;
function SerialBufferReadComplete(Buffer:PSerialBuffer; Removed:LongWord):Boolean;
function SerialBufferWriteStart(Buffer:PSerialBuffer; var Available:LongWord):Pointer;
function SerialBufferWriteComplete(Buffer:PSerialBuffer; Added:LongWord):Boolean;
procedure SerialLog(Level:LongWord; Serial:PSerialDevice; const AText:String);
procedure SerialLogInfo(Serial:PSerialDevice; const AText:String); inline;
procedure SerialLogWarn(Serial:PSerialDevice; const AText:String); inline;
procedure SerialLogError(Serial:PSerialDevice; const AText:String); inline;
procedure SerialLogDebug(Serial:PSerialDevice; const AText:String); inline;
Serial logging helper functions
function SerialLoggingDeviceAdd(Serial:PSerialDevice):LongWord;
function SerialLoggingDeviceRemove(Serial:PSerialDevice):LongWord;
function SerialLoggingDeviceParameters(Serial:PSerialDevice; const Parameters:String; var BaudRate,Parity,DataBits,StopBits:LongWord):LongWord;
function SerialLoggingFirstWord(var Value:String;const Delimiter:String):String;
function SerialLoggingDeviceEnum(Serial:PSerialDevice; Data:Pointer):LongWord;
function SerialLoggingDeviceNotify(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;
Return to Unit Reference