X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fstruct%2Ffifobuf.h;h=117431be59980fac7d2fbdb6e78088e309c14281;hb=4d8a6a97c6c0e15296b51d5f02674079bede1aa0;hp=f58e1c0a7d0f4e99999298d5af2f63029a4de566;hpb=5eec6d12a34acf1095170c786416ae5515202f24;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 *