Muokkaa

Jaa


Serial I/O Request Interface

To control a peripheral device that is connected to a port on a serial controller, a client application or peripheral device driver sends I/O requests to the port. A client uses IRP_MJ_WRITE and IRP_MJ_READ requests to transmit data to and receive data from a serial port. In addition, Windows defines a set of serial I/O control requests (IOCTLs) that a client can use to configure a serial port.

The serial IRP_MJ_XXX requests and serial IOCTLs together form a serial I/O request interface that is supported across a range of serial controller devices. This interface is supported by the Serial.sys driver, and by the combination of SerCx2 or SerCx and an extension-based serial controller driver.

SerCx2, SerCx, and Serial.sys support many of the same serial IOCTLs. However, SerCx2, SerCx, and Serial.sys support different subsets of the IOCTLs specified in Serial Device Control Requests. The following table summarizes the subsets of IOCTLs that are supported by SerCx2, SerCx, and Serial.sys. A Yes entry in the table indicates that the serial framework extension or driver supports the corresponding IOCTL, and a No entry indicates that it does not.

Serial IOCTL SerCx2 SerCx Serial.sys

IOCTL_SERIAL_APPLY_DEFAULT_CONFIGURATION

Yes

Yes

No

IOCTL_SERIAL_CLEAR_STATS

No

Yes

Yes

IOCTL_SERIAL_CLR_DTR

See note 1.

Yes

Yes

IOCTL_SERIAL_CLR_RTS

Yes

Yes

Yes

IOCTL_SERIAL_CONFIG_SIZE

No

No

Yes

IOCTL_SERIAL_GET_BAUD_RATE

Yes

Yes

Yes

IOCTL_SERIAL_GET_CHARS

See note 2.

Yes

Yes

IOCTL_SERIAL_GET_COMMSTATUS

Yes

Yes

Yes

IOCTL_SERIAL_GET_DTRRTS

Yes

Yes

Yes

IOCTL_SERIAL_GET_HANDFLOW

See note 1.

Yes

Yes

IOCTL_SERIAL_GET_LINE_CONTROL

Yes

Yes

Yes

IOCTL_SERIAL_GET_MODEM_CONTROL (See note 4.)

Yes

Yes

Yes

IOCTL_SERIAL_GET_MODEMSTATUS

No

Yes

Yes

IOCTL_SERIAL_GET_PROPERTIES

Yes

Yes

Yes

IOCTL_SERIAL_GET_STATS

No

Yes

Yes

IOCTL_SERIAL_GET_TIMEOUTS

Yes

Yes

Yes

IOCTL_SERIAL_GET_WAIT_MASK

Yes

Yes

Yes

IOCTL_SERIAL_IMMEDIATE_CHAR

No

Yes

Yes

IOCTL_SERIAL_LSRMST_INSERT

No

Yes

Yes

IOCTL_SERIAL_PURGE

Yes

Yes

Yes

IOCTL_SERIAL_RESET_DEVICE (See note 5.)

No

No

Yes

IOCTL_SERIAL_SET_BAUD_RATE

Yes

Yes

Yes

IOCTL_SERIAL_SET_BREAK_OFF

Yes

Yes

Yes

IOCTL_SERIAL_SET_BREAK_ON

Yes

Yes

Yes

IOCTL_SERIAL_SET_CHARS

See note 2.

Yes

Yes

IOCTL_SERIAL_SET_DTR

See note 1.

Yes

Yes

IOCTL_SERIAL_SET_FIFO_CONTROL

See note 1.

Yes

Yes

IOCTL_SERIAL_SET_HANDFLOW (See note 3.)

Yes

Yes

Yes

IOCTL_SERIAL_SET_LINE_CONTROL

Yes

Yes

Yes

IOCTL_SERIAL_SET_MODEM_CONTROL (See note 4.)

Yes

Yes

Yes

IOCTL_SERIAL_SET_QUEUE_SIZE

Yes

Yes

Yes

IOCTL_SERIAL_SET_RTS

Yes

Yes

Yes

IOCTL_SERIAL_SET_TIMEOUTS

Yes

Yes

Yes

IOCTL_SERIAL_SET_WAIT_MASK

Yes

Yes

Yes

IOCTL_SERIAL_SET_XOFF

No

Yes

Yes

IOCTL_SERIAL_SET_XON

No

Yes

Yes

IOCTL_SERIAL_WAIT_ON_MASK

Yes

Yes

Yes

IOCTL_SERIAL_XOFF_COUNTER

No

Yes

Yes

**Notes**
  1. SerCx2 may or may not support this IOCTL depending on the implementation of the serial controller driver and the capabilities of the serial controller hardware.

  2. SerCx2 does not support special characters. SerCx2 always completes an IOCTL_SERIAL_SET_CHARS request with a STATUS_SUCCESS status code, but does not set any special characters or perform any other operation in response to this request. For an IOCTL_SERIAL_GET_CHARS request, SerCx2 sets all the character values in the SERIAL_CHARS structure to null, and completes the request with a STATUS_SUCCESS status code.

  3. SerCx2 and SerCx support only subsets of the flags defined for the FlowReplace and ControlHandShake members of the SERIAL_HANDFLOW structure. Serial.sys supports all of these flags. For more information, see SERIAL_HANDFLOW.

  4. The IOCTL_SERIAL_GET_MODEM_CONTROL and IOCTL_SERIAL_SET_MODEM_CONTROL requests are used primarily for hardware testing. No standard register layout is defined for the modem control operations. Peripheral drivers that use modem control IOCTLs risk making themselves dependent on the hardware features of a particular serial controller.

  5. The Serial.sys driver always completes an IOCTL_SERIAL_RESET_DEVICE request with STATUS_SUCCESS, but performs no operation in response to this request. SerCx2 and SerCx do not support IOCTL_SERIAL_RESET_DEVICE requests and always complete these requests with STATUS_NOT_IMPLEMENTED.

For more information about IOCTL_SERIAL_XXX requests and read and write requests for serial controllers, see the ntddser.h header.