## Physical Device Driver Reference

[prev][next][parent][TOC]

### Character Queue Management

Character queues are used by character device drivers to buffer data. The two most frequently used structures for character buffers are the FIFO and the circular buffer.

A character device driver can use the DevHlp services to manage a simple circular buffer for characters. The DevHlp services operate on the following character queue header:

    --------------------------------------------------------------

    CharQueue STRUC
            Qsize   DW      ?    ; Size of buffer in bytes
            Qchrout DW      ?    ; Index to next char out
            Qcount  DW      ?    ; Count of characters in buffer
            Qbase   DB      ?    ; Start of buffer
    CharQueue ENDS

    --------------------------------------------------------------

Prior to using the character queue DevHlp services, a physical device driver must allocate the queue header and initialize the Qsize field. The DevHlp_QueueInit must be called before any of the other character queue DevHlps can be called. The other fields in the queue header are managed by the character queue DevHlps and do not need to be examined or altered by the physical device driver.

A character device driver is not required to use the character queue DevHlp services. A character device driver can define its own character buffer management tailored to the requirements of its buffer structure.