X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fstruct%2Ffifobuf.h;h=117431be59980fac7d2fbdb6e78088e309c14281;hb=76c3a84c29c451d164575134b29986f3bbc42656;hp=f58e1c0a7d0f4e99999298d5af2f63029a4de566;hpb=2f2be617c1e2ccc0aaefbb2e56fb34046c645126;p=bertos.git diff --git a/bertos/struct/fifobuf.h b/bertos/struct/fifobuf.h index f58e1c0a..117431be 100644 --- 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 *