blob: e8ec1276353b8bce96e0842f13c6614df0798b6b [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
wdenk232c1502004-03-12 00:14:09 +00002/*
3 * (C) Copyright 2003
4 * Gerry Hamel, geh@ti.com, Texas Instruments
wdenk232c1502004-03-12 00:14:09 +00005 */
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