TTYBUF

Implement a circular buffer for character I/O operations

typedef struct ttybuf_entry {
    unsigned int    cnt;
    unsigned int    size;
    unsigned char * buff;
    unsigned char * head;
    unsigned char * tail;
} TTYBUF;

Description:

The TTYBUF type implements a circular buffer (ring buffer) for efficient character I/O operations.

The members include:

cnt

The current number of characters in the buffer.

size
The total size of the buffer.
buff

A pointer to the allocated buffer memory.

head

A pointer to the position where next character will be written.

tail

A pointer to the position where next character will be read.

Page updated: