byte_fifo.h
来自「专业汽车级嵌入式操作系统OSEK的源代码」· C头文件 代码 · 共 35 行
H
35 行
/* Byte FIFO queue implementation. * * Implements a simple byte FIFO on top of a data buffer, that lets * you enqueue and dequeue single bytes. */#ifndef __BFIFO_H__# define __BFIFO_H__# include "mytypes.h"/* The byte fifo control structure. */struct byte_fifo { /* The buffer containing the fifo. */ U8 *buffer; /* Pointer to the end of the buffer. */ U8 *buffer_end; /* Size in bytes of the buffer. */ U32 buffer_size; /* Current head (freshest data) of the fifo in the buffer. */ U8 *head; /* Current tail (oldest data) of the fifo in the buffer. */ U8 *tail; /* Number of bytes currently enqueued in the fifo. */ U32 holding;};void byte_fifo_clear(struct byte_fifo *f);void byte_fifo_init(struct byte_fifo *f, U8 *buffer, U32 buff_size);int byte_fifo_put(struct byte_fifo *f, U32 force, U8 b);int byte_fifo_get(struct byte_fifo *f, U8 *b);#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?