]> git.ipfire.org Git - thirdparty/u-boot.git/blame - include/circbuf.h
Merge branch '2020-05-15-misc-bugfixes'
[thirdparty/u-boot.git] / include / circbuf.h
CommitLineData
83d290c5 1/* SPDX-License-Identifier: GPL-2.0+ */
232c150a
WD
2/*
3 * (C) Copyright 2003
4 * Gerry Hamel, geh@ti.com, Texas Instruments
232c150a
WD
5 */
6
7#ifndef __CIRCBUF_H__
8#define __CIRCBUF_H__
9
10typedef struct circbuf {
11 unsigned int size; /* current number of bytes held */
12 unsigned int totalsize; /* number of bytes allocated */
13
14 char *top; /* pointer to current buffer start */
15 char *tail; /* pointer to space for next element */
16
17 char *data; /* all data */
18 char *end; /* end of data buffer */
19} circbuf_t;
20
21int buf_init (circbuf_t * buf, unsigned int size);
22int buf_free (circbuf_t * buf);
23int buf_pop (circbuf_t * buf, char *dest, unsigned int len);
24int buf_push (circbuf_t * buf, const char *src, unsigned int len);
25
26#endif