* Copyright 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
* -->
*
+ * \defgroup fifobuf FIFO buffer
+ * \ingroup struct
+ * \{
+ *
* \brief General pourpose FIFO buffer implemented with a ring buffer
*
* \li \c begin points to the first buffer element;
)
+/**
+ * Define a static fifo buffer
+ */
+#define DEFINE_FIFO(_name, _ptr, _size) \
+ FIFOBuffer _name = \
+ { \
+ .head = (_ptr), \
+ .tail = (_ptr), \
+ .begin = (_ptr), \
+ .end = (_ptr) + (_size) - 1, \
+ }; \
+ STATIC_ASSERT((_size) > 1)
+
/**
* Check whether the fifo is empty
*
}
#endif
+/** \} */ /* defgroup fifobuf */
+
#endif /* STRUCT_FIFO_H */