blob: 34d0f85f2695db225f892840a2368d06414d1f14 [file] [log] [blame]
wdenk232c1502004-03-12 00:14:09 +00001/*
2 * (C) Copyright 2003
3 * Gerry Hamel, geh@ti.com, Texas Instruments
4 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
wdenk232c1502004-03-12 00:14:09 +00006 */
7
8#ifndef __CIRCBUF_H__
9#define __CIRCBUF_H__
10
11typedef struct circbuf {
12 unsigned int size; /* current number of bytes held */
13 unsigned int totalsize; /* number of bytes allocated */
14
15 char *top; /* pointer to current buffer start */
16 char *tail; /* pointer to space for next element */
17
18 char *data; /* all data */
19 char *end; /* end of data buffer */
20} circbuf_t;
21
22int buf_init (circbuf_t * buf, unsigned int size);
23int buf_free (circbuf_t * buf);
24int buf_pop (circbuf_t * buf, char *dest, unsigned int len);
25int buf_push (circbuf_t * buf, const char *src, unsigned int len);
26
27#endif