projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename macro to more appropiate name.
[bertos.git]
/
bertos
/
struct
/
fifobuf.h
diff --git
a/bertos/struct/fifobuf.h
b/bertos/struct/fifobuf.h
index 1d7b555ac2a8bec5e5cff853a617acd833cec892..4bd205d0cf2dd16b105a213e64c036ff70d27808 100644
(file)
--- a/
bertos/struct/fifobuf.h
+++ b/
bertos/struct/fifobuf.h
@@
-28,12
+28,11
@@
*
* Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/)
* Copyright 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
*
* Copyright 2003, 2004 Develer S.r.l. (http://www.develer.com/)
* Copyright 2001, 2008 Bernie Innocenti <bernie@codewiz.org>
- *
* -->
*
* -->
*
- * \
version $Id: fifobuf.h 1532 2008-08-04 07:21:26Z bernie $
- *
- * \
author Bernie Innocenti <bernie@codewiz.org>
+ * \
defgroup fifobuf FIFO buffer
+ *
\ingroup struct
+ * \
{
*
* \brief General pourpose FIFO buffer implemented with a ring buffer
*
*
* \brief General pourpose FIFO buffer implemented with a ring buffer
*
@@
-64,10
+63,12
@@
* The buffer is also FULL when \c tail points to the last buffer
* location and head points to the first one:
* \code head == begin && tail == end \endcode
* The buffer is also FULL when \c tail points to the last buffer
* location and head points to the first one:
* \code head == begin && tail == end \endcode
+ *
+ * \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>
#include <cpu/types.h>
#include <cpu/irq.h>
@@
-91,6
+92,19
@@
typedef struct FIFOBuffer
)
)
+/**
+ * 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
*
/**
* Check whether the fifo is empty
*
@@
-357,5
+371,6
@@
void fifo_pushblock(FIFOBuffer *fb, unsigned char *block, size_t len)
}
#endif
}
#endif
-
#endif /* MWARE_FIFO_H
*/
+
/** \} */ /* defgroup fifobuf
*/
+#endif /* STRUCT_FIFO_H */