Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 3.9 KB

nf-sercx-sercxgetringbufferutilization.md

File metadata and controls

81 lines (58 loc) · 3.9 KB
UID title description old-location tech.root ms.date keywords ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames f1_keywords topic_type api_type api_location api_name
NF:sercx.SerCxGetRingBufferUtilization
SerCxGetRingBufferUtilization function (sercx.h)
The SerCxGetRingBufferUtilization method enables the serial controller driver to determine how much of the type-ahead ring buffer is currently filled by data received from the serial port.
serports\sercxgetringbufferutilization.htm
serports
04/23/2018
SerCxGetRingBufferUtilization function
1/SerCxGetRingBufferUtilization, SerCxGetRingBufferUtilization, SerCxGetRingBufferUtilization method [Serial Ports], serports.sercxgetringbufferutilization
sercx.h
Universal
Available starting with Windows 8.
<= DISPATCH_LEVEL
Windows
SerCxGetRingBufferUtilization
sercx/SerCxGetRingBufferUtilization
APIRef
kbSyntax
COM
1.0\Sercx.h
SerCxGetRingBufferUtilization

SerCxGetRingBufferUtilization function

-description

The SerCxGetRingBufferUtilization method enables the serial controller driver to determine how much of the type-ahead ring buffer is currently filled by data received from the serial port.

-parameters

-param Device [in]

A WDFDEVICE handle to the framework device object that represents the serial controller.

-param BytesUsed [out, optional]

The number of bytes of unread data that are currently contained in the type-ahead ring buffer that is used to store received data.

-param BufferSize [out, optional]

The size, in bytes, of the type-ahead ring buffer that is used to store received data.

-remarks

The serial controller driver calls this function to determine how much storage space is available in the type-ahead ring buffer. The serial controller extension (SerCx) maintains this buffer to contain data that the serial controller driver receives from the serial port when no read request from the client is currently being processed. This function provides the information that the driver requires to accurately perform software flow control (XON/XOFF).

To implement software flow control, the serial controller driver monitors the amount of space available in the type-ahead ring buffer. The available space, in bytes, is equal to BufferSize - BytesUsed. When the available space falls below a client-specified threshold, XoffLimit, the serial controller driver transmits an XOFF character to tell the transmitting port to pause transmission. Later, when the available space rises above a client-specified threshold, XonLimit, the driver transmits an XON character to tell the transmitting port to resume transmission. Typically, the client specified these two thresholds in a previous IOCTL_SERIAL_SET_HANDFLOW I/O control request.

SerCx evaluates the available space in the type-ahead ring buffer in the context of the current flow control and handshaking settings. After the type-ahead ring buffer empties completely, SerCx calls the driver's EvtSerCxReceive callback function so that the driver can send an XON and resume receiving data. The EvtSerCxReceive function can call SerCxGetRingBufferUtilization to determine whether to send an XON.

-see-also

EvtSerCxReceive

IOCTL_SERIAL_SET_HANDFLOW