* 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;
* location and head points to the first one:
* \code head == begin && tail == end \endcode
*
- * \version $Id: fifobuf.h 1532 2008-08-04 07:21:26Z bernie $
* \author Bernie Innocenti <bernie@codewiz.org>
*/
-#ifndef MWARE_FIFO_H
-#define MWARE_FIFO_H
+#ifndef STRUCT_FIFO_H
+#define STRUCT_FIFO_H
#include <cpu/types.h>
#include <cpu/irq.h>
)
+/**
+ * Declare a static fifo buffer
+ */
+#define DECLARE_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
-#endif /* MWARE_FIFO_H */
+/** \} */ /* defgroup fifobuf */
+#endif /* STRUCT_FIFO_H */