📄 fifo.h
字号:
/******************************************************************************
**
** COPYRIGHT (C) 2001 Intel Corporation
**
** FILENAME: FIFO.h
**
** PURPOSE: A general purpose implementation of a FIFO
**
** $Modtime: 7/17/03 1:01p $
**
******************************************************************************/
#ifndef _FIFO_h // Only include this header file once!
#define _FIFO_h
/*
*******************************************************************************
* DATA TYPES
*******************************************************************************
*/
typedef struct {
UCHAR *head, *tail;
UINT size;
BOOL overrun, overwrite;
FnPVOID onFirstCharFnP, onLastCharFnP;
UCHAR buffer[1];
} FIFO_T;
/*
*******************************************************************************
* FUNCTION PROTOTYPES
*******************************************************************************
*/
// Set up a FIFO.
FIFO_T *FIFOalloc(UINT size, FnPVOID onFirstCharFnP, FnPVOID onLastCharFnP);
// Put a character into a FIFO.
ErrorT FIFOput(FIFO_T *r, UCHAR c);
// Get a character from a FIFO.
INT16 FIFOget(FIFO_T *r);
// Nondistructive get a character in a FIFO.
INT16 FIFOpeek(FIFO_T *r);
// Get the number of characters in a FIFO.
UINT FIFOcharsAvailable(FIFO_T *r);
// Set the overwrite mode of the FIFOput function.
void FIFOoverwrite(FIFO_T *r, BOOL overwrite);
// Has an overrun of the FIFO occurred?
BOOL FIFOoverrun(FIFO_T *r);
// Get the character that was discarded on FIFO overflow.
UCHAR FIFOoverrunChar(FIFO_T *r);
#endif // _FIFO_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -