]>
Commit | Line | Data |
---|---|---|
1 | /* vim:ts=4 sts=4 et tw=80 | |
2 | * | |
3 | * fnordlicht firmware | |
4 | * | |
5 | * for additional information please | |
6 | * see http://lochraster.org/fnordlichtmini | |
7 | * | |
8 | * (c) by Alexander Neumann <alexander@bumpern.de> | |
9 | * Lars Noschinski <lars@public.noschinski.de> | |
10 | * | |
11 | * This program is free software: you can redistribute it and/or modify it | |
12 | * under the terms of the GNU General Public License version 3 as published by | |
13 | * the Free Software Foundation. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, but WITHOUT | |
16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |
18 | * more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License along with | |
21 | * this program. If not, see <http://www.gnu.org/licenses/>. | |
22 | */ | |
23 | ||
24 | #ifndef __FIFO_H | |
25 | #define __FIFO_H | |
26 | ||
27 | #include <stdint.h> | |
28 | #include <stdbool.h> | |
29 | #include "globals.h" | |
30 | ||
31 | typedef uint8_t fifo_content_t; | |
32 | typedef uint8_t fifo_size_t; | |
33 | ||
34 | typedef struct | |
35 | { | |
36 | fifo_size_t read; | |
37 | fifo_size_t write; | |
38 | fifo_content_t buffer[CONFIG_FIFO_SIZE]; | |
39 | } fifo_t; | |
40 | ||
41 | void fifo_init(fifo_t *f); | |
42 | void fifo_enqueue(fifo_t *f, fifo_content_t data); | |
43 | fifo_content_t fifo_dequeue(fifo_t *f); | |
44 | fifo_size_t fifo_fill(fifo_t *f); | |
45 | bool fifo_empty(fifo_t *f); | |
46 | bool fifo_full(fifo_t *f); | |
47 | ||
48 | #endif |