39#define UART_NAME_PREFIX "UART"
41#define UART_PUSH_TIMEOUT SERIAL_PUSH_TIMEOUT
44#define UART_TYPE_NONE 0
45#define UART_TYPE_8250 1
46#define UART_TYPE_16550 2
47#define UART_TYPE_16650 3
49#define UART_TYPE_MAX 3
52#define UART_MODE_NONE 0
53#define UART_MODE_UART 1
54#define UART_MODE_SERIAL 2
56#define UART_MODE_MAX 2
59#define UART_STATE_DISABLED 0
60#define UART_STATE_ENABLED 1
62#define UART_STATE_MAX 1
65#define UART_FLAG_NONE SERIAL_FLAG_NONE
66#define UART_FLAG_DATA_8BIT SERIAL_FLAG_DATA_8BIT
67#define UART_FLAG_DATA_7BIT SERIAL_FLAG_DATA_7BIT
68#define UART_FLAG_DATA_6BIT SERIAL_FLAG_DATA_6BIT
69#define UART_FLAG_DATA_5BIT SERIAL_FLAG_DATA_5BIT
70#define UART_FLAG_STOP_1BIT SERIAL_FLAG_STOP_1BIT
71#define UART_FLAG_STOP_2BIT SERIAL_FLAG_STOP_2BIT
72#define UART_FLAG_STOP_1BIT5 SERIAL_FLAG_STOP_1BIT5
73#define UART_FLAG_PARITY_ODD SERIAL_FLAG_PARITY_ODD
74#define UART_FLAG_PARITY_EVEN SERIAL_FLAG_PARITY_EVEN
75#define UART_FLAG_PARITY_MARK SERIAL_FLAG_PARITY_MARK
76#define UART_FLAG_PARITY_SPACE SERIAL_FLAG_PARITY_SPACE
77#define UART_FLAG_FLOW_RTS_CTS SERIAL_FLAG_FLOW_RTS_CTS
78#define UART_FLAG_FLOW_DSR_DTR SERIAL_FLAG_FLOW_DSR_DTR
79#define UART_FLAG_PUSH_RX SERIAL_FLAG_PUSH_RX
80#define UART_FLAG_PUSH_TX SERIAL_FLAG_PUSH_TX
83#define UART_READ_NONE SERIAL_READ_NONE
84#define UART_READ_NON_BLOCK SERIAL_READ_NON_BLOCK
87#define UART_WRITE_NONE SERIAL_WRITE_NONE
88#define UART_WRITE_NON_BLOCK SERIAL_WRITE_NON_BLOCK
91#define UART_WAIT_NONE SERIAL_WAIT_NONE
92#define UART_WAIT_RECEIVE SERIAL_WAIT_RECEIVE
93#define UART_WAIT_TRANSMIT SERIAL_WAIT_TRANSMIT
96#define UART_STATUS_NONE SERIAL_STATUS_NONE
97#define UART_STATUS_RTS SERIAL_STATUS_RTS
98#define UART_STATUS_CTS SERIAL_STATUS_CTS
99#define UART_STATUS_DSR SERIAL_STATUS_DSR
100#define UART_STATUS_DTR SERIAL_STATUS_DTR
101#define UART_STATUS_RX_FULL SERIAL_STATUS_RX_FULL
102#define UART_STATUS_RX_EMPTY SERIAL_STATUS_RX_EMPTY
103#define UART_STATUS_TX_FULL SERIAL_STATUS_TX_FULL
104#define UART_STATUS_TX_EMPTY SERIAL_STATUS_TX_EMPTY
105#define UART_STATUS_BUSY SERIAL_STATUS_BUSY
106#define UART_STATUS_BREAK_ERROR SERIAL_STATUS_BREAK_ERROR
107#define UART_STATUS_PARITY_ERROR SERIAL_STATUS_PARITY_ERROR
108#define UART_STATUS_FRAMING_ERROR SERIAL_STATUS_FRAMING_ERROR
109#define UART_STATUS_OVERRUN_ERROR SERIAL_STATUS_OVERRUN_ERROR
110#define UART_STATUS_DCD SERIAL_STATUS_DCD
111#define UART_STATUS_RI SERIAL_STATUS_RI
struct _DEVICE DEVICE
Definition devices.h:373
HANDLE EVENT_HANDLE
Definition globaltypes.h:117
#define STDCALL
Definition globaltypes.h:45
HANDLE MUTEX_HANDLE
Definition globaltypes.h:105
struct _SERIAL_DEVICE SERIAL_DEVICE
Definition serial.h:148
uint32_t uartid
Unique Id of this UART in the UART table.
Definition uart.h:157
UART_PROPERTIES properties
Device properties.
Definition uart.h:174
uint32_t transmitcount
Definition uart.h:180
MUTEX_HANDLE lock
Device lock.
Definition uart.h:171
EVENT_HANDLE transmitwait
Write wait event.
Definition uart.h:173
uint32_t receiveerrors
Definition uart.h:179
uart_device_set_status_proc devicesetstatus
A Device specific DeviceSetStatus method implementing the standard UART device interface (Optional).
Definition uart.h:167
uart_device_read_proc deviceread
A Device specific DeviceRead method implementing the standard UART device interface (Mandatory).
Definition uart.h:163
DEVICE device
The Device entry for this UART.
Definition uart.h:155
uart_device_set_properties_proc devicesetproperties
A Device specific DeviceSetProperties method implementing the standard UART device interface (Or nil ...
Definition uart.h:169
uint32_t uartmode
UART mode (eg UART_MODE_SERIAL).
Definition uart.h:158
uint32_t receivecount
Definition uart.h:178
uart_device_get_properties_proc devicegetproperties
A Device specific DeviceGetProperties method implementing the standard UART device interface (Or nil ...
Definition uart.h:168
uart_device_wait_proc devicewait
A Device specific DeviceWait method implementing the standard UART device interface (Or nil if the de...
Definition uart.h:165
uart_device_close_proc deviceclose
A Device specific DeviceClose method implementing the standard UART device interface (Mandatory).
Definition uart.h:162
SERIAL_DEVICE * serial
The Serial device represented by this UART.
Definition uart.h:176
uart_device_open_proc deviceopen
A Device specific DeviceOpen method implementing the standard UART device interface (Mandatory).
Definition uart.h:161
uint32_t uartstate
UART state (eg UART_STATE_ENABLED).
Definition uart.h:159
UART_DEVICE * prev
Previous entry in UART table.
Definition uart.h:183
EVENT_HANDLE receivewait
Read wait event.
Definition uart.h:172
UART_DEVICE * next
Next entry in UART table.
Definition uart.h:184
uint32_t uartstatus
UART status (eg UART_STATUS_RX_FULL)(May not be real time status depending on the driver).
Definition uart.h:160
uart_device_get_status_proc devicegetstatus
A Device specific DeviceGetStatus method implementing the standard UART device interface (Or nil if t...
Definition uart.h:166
uint32_t transmiterrors
Definition uart.h:181
uart_device_write_proc devicewrite
A Device specific DeviceWrite method implementing the standard UART device interface (Mandatory).
Definition uart.h:164
uint32_t minrate
Minimum supported baud rate.
Definition uart.h:120
uint32_t parity
Current parity setting.
Definition uart.h:125
uint32_t flags
Device flags (eg UART_FLAG_DATA_8BIT).
Definition uart.h:119
uint32_t maxrate
Maximum supported baud rate.
Definition uart.h:121
uint32_t stopbits
Current stop bits setting.
Definition uart.h:124
uint32_t flowcontrol
Current flow control setting.
Definition uart.h:126
uint32_t databits
Current data bits setting.
Definition uart.h:123
uint32_t baudrate
Current baud rate setting.
Definition uart.h:122
uint32_t STDCALL uart_serial_device_transmit(UART_DEVICE *uart)
Write data to a UART device from the transmit buffer of the associated Serial device.
uint32_t STDCALL(* uart_enumerate_cb)(UART_DEVICE *uart, void *data)
Definition uart.h:133
uint32_t STDCALL uart_device_set_default(UART_DEVICE *uart)
Set the current default UART device.
uint32_t STDCALL uart_type_to_string(uint32_t uarttype, char *string, uint32_t len)
Convert a UART type value to a string.
uint32_t STDCALL uart_device_register(UART_DEVICE *uart)
Register a new UART in the UART table.
uint32_t STDCALL uart_device_set_status(UART_DEVICE *uart, uint32_t status)
Set the current line status of a UART device.
UART_DEVICE *STDCALL uart_device_check(UART_DEVICE *uart)
Check if the supplied UART is in the UART table.
uint32_t STDCALL(* uart_device_get_status_proc)(UART_DEVICE *uart)
Definition uart.h:146
uint32_t STDCALL uart_device_destroy(UART_DEVICE *uart)
Destroy an existing UART entry.
uint32_t STDCALL uart_device_properties(UART_DEVICE *uart, UART_PROPERTIES *properties)
Get the properties for the specified UART device.
UART_DEVICE *STDCALL uart_device_find(uint32_t uartid)
Find a UART device by ID in the UART table.
uint32_t STDCALL uart_device_notification(UART_DEVICE *uart, uart_notification_cb callback, void *data, uint32_t notification, uint32_t flags)
Register a notification for UART device changes.
UART_DEVICE *STDCALL uart_device_find_by_name(const char *name)
Find a UART device by name in the UART table.
uint32_t STDCALL(* uart_device_set_properties_proc)(UART_DEVICE *uart, UART_PROPERTIES *properties)
Definition uart.h:150
uint32_t STDCALL uart_device_close(UART_DEVICE *uart)
Close a UART device and terminate sending and receiving.
uint32_t STDCALL uart_device_open(UART_DEVICE *uart, uint32_t baudrate, uint32_t databits, uint32_t stopbits, uint32_t parity, uint32_t flowcontrol)
Open a UART device ready for sending and receiving.
uint32_t STDCALL(* uart_device_open_proc)(UART_DEVICE *uart, uint32_t baudrate, uint32_t databits, uint32_t stopbits, uint32_t parity, uint32_t flowcontrol)
Definition uart.h:138
uint32_t STDCALL uart_device_wait(UART_DEVICE *uart, uint32_t direction, uint32_t timeout)
Wait for data to be available in the receive or transmit FIFO of a UART device.
uint32_t STDCALL uart_device_set_properties(UART_DEVICE *uart, UART_PROPERTIES *properties)
Set the properties for the specified UART device.
uint32_t STDCALL(* uart_device_read_proc)(UART_DEVICE *uart, void *buffer, uint32_t size, uint32_t flags, uint32_t *count)
Definition uart.h:141
uint32_t STDCALL uart_device_write(UART_DEVICE *uart, void *buffer, uint32_t size, uint32_t flags, uint32_t *count)
Write data to a UART device.
uint32_t STDCALL uart_device_get_properties(UART_DEVICE *uart, UART_PROPERTIES *properties)
Get the properties for the specified UART device.
uint32_t STDCALL uart_serial_device_receive(UART_DEVICE *uart)
Read data from a UART device into the receive buffer of the associated Serial device.
UART_DEVICE *STDCALL uart_device_create(void)
Create a new UART entry.
struct _UART_DEVICE UART_DEVICE
Definition uart.h:130
uint32_t STDCALL uart_device_enumerate(uart_enumerate_cb callback, void *data)
Enumerate all UART devices in the UART table.
uint32_t STDCALL(* uart_device_close_proc)(UART_DEVICE *uart)
Definition uart.h:139
uint32_t STDCALL(* uart_notification_cb)(DEVICE *device, void *data, uint32_t notification)
Definition uart.h:135
UART_DEVICE *STDCALL uart_device_get_default(void)
Get the current default UART device.
uint32_t STDCALL uart_device_status(UART_DEVICE *uart)
Get the current line status of a UART device.
UART_DEVICE *STDCALL uart_device_find_by_description(const char *description)
Find a UART device by description in the UART table.
uint32_t STDCALL uart_state_to_string(uint32_t uartstate, char *string, uint32_t len)
Convert a UART state value to a string.
uint32_t STDCALL(* uart_device_get_properties_proc)(UART_DEVICE *uart, UART_PROPERTIES *properties)
Definition uart.h:149
uint32_t STDCALL uart_get_count(void)
Get the current UART count.
uint32_t STDCALL(* uart_device_wait_proc)(UART_DEVICE *uart, uint32_t direction, uint32_t timeout)
Definition uart.h:144
uint32_t STDCALL(* uart_device_set_status_proc)(UART_DEVICE *uart, uint32_t status)
Definition uart.h:147
uint32_t STDCALL uart_device_deregister(UART_DEVICE *uart)
Deregister a UART from the UART table.
uint32_t STDCALL uart_device_get_status(UART_DEVICE *uart)
Get the current line status of a UART device.
struct _UART_PROPERTIES UART_PROPERTIES
Definition uart.h:116
uint32_t STDCALL uart_device_read(UART_DEVICE *uart, void *buffer, uint32_t size, uint32_t flags, uint32_t *count)
Read data from a UART device.
uint32_t STDCALL uart_mode_to_string(uint32_t uartmode, char *string, uint32_t len)
Convert a UART mode to a string.
uint32_t STDCALL(* uart_device_write_proc)(UART_DEVICE *uart, void *buffer, uint32_t size, uint32_t flags, uint32_t *count)
Definition uart.h:142
UART_DEVICE *STDCALL uart_device_create_ex(uint32_t size)
Create a new UART entry.