A central part of implementing the
IOSerialDriverSync interface is managing the serial port's state. The serial port state is a bitfield of 32-bits that is used to report events, such as the arrival of data on the serial port, as well as to save the overall state of the port, such as whether it has been opened by a user space process or not. Although there are methods that are directly involved in manipulating the state bitmask, ultimately every method that the serial port implements from
IOSerialDriverSync will need to access the serial port's state, even if for no other reason than to verify that the serial port has been opened before attempting to perform an operation.
The state bits are defined in the header file