wdenk | 29e7f5a | 2004-03-12 00:14:09 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Gerry Hamel, geh@ti.com, Texas Instruments |
| 4 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 29e7f5a | 2004-03-12 00:14:09 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef __CIRCBUF_H__ |
| 9 | #define __CIRCBUF_H__ |
| 10 | |
| 11 | typedef 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 | |
| 22 | int buf_init (circbuf_t * buf, unsigned int size); |
| 23 | int buf_free (circbuf_t * buf); |
| 24 | int buf_pop (circbuf_t * buf, char *dest, unsigned int len); |
| 25 | int buf_push (circbuf_t * buf, const char *src, unsigned int len); |
| 26 | |
| 27 | #endif |