44,14 → 44,6 |
typedef unsigned long fifo_count_t; |
typedef unsigned long fifo_index_t; |
|
#define FIFO_CREATE_STATIC(name, t, itms) \ |
struct { \ |
t fifo[(itms)]; \ |
fifo_count_t items; \ |
fifo_index_t head; \ |
fifo_index_t tail; \ |
} name |
|
/** Create and initialize static FIFO. |
* |
* FIFO is allocated statically. |
62,7 → 54,12 |
* @param itms Number of items that can be stored in FIFO. |
*/ |
#define FIFO_INITIALIZE_STATIC(name, t, itms) \ |
FIFO_CREATE_STATIC(name, t, itms) = { \ |
struct { \ |
t fifo[(itms)]; \ |
fifo_count_t items; \ |
fifo_index_t head; \ |
fifo_index_t tail; \ |
} name = { \ |
.items = (itms), \ |
.head = 0, \ |
.tail = 0 \ |