projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fifobuf: introduce DECLARE_FIFO() macro
[bertos.git]
/
bertos
/
struct
/
fifobuf.h
diff --git
a/bertos/struct/fifobuf.h
b/bertos/struct/fifobuf.h
index f58e1c0a7d0f4e99999298d5af2f63029a4de566..117431be59980fac7d2fbdb6e78088e309c14281 100644
(file)
--- a/
bertos/struct/fifobuf.h
+++ b/
bertos/struct/fifobuf.h
@@
-92,6
+92,19
@@
typedef struct FIFOBuffer
)
)
+/**
+ * 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
*
/**
* Check whether the fifo is empty
*