From 94259f725e5fa0d6631b2d5d15a5d307b894cd00 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 6 Jun 2014 10:28:18 -0600 Subject: [PATCH] IOB: Some handy macros --- include/nuttx/net/iob.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/nuttx/net/iob.h b/include/nuttx/net/iob.h index 0daa0f39db..b69e94cb46 100644 --- a/include/nuttx/net/iob.h +++ b/include/nuttx/net/iob.h @@ -54,9 +54,14 @@ #define IOBFLAGS_MCAST (1 << 0) /* Multicast packet */ +/* IOB helpers */ + +#define IOB_FREESPACE(n) (CONFIG_IOB_BUFSIZE - (n)->io_len - (n)->io_offset) + /* Queue helpers */ #define IOB_QINIT(q) do { (q)->qh_head = 0; (q)->qh_tail = 0; } while (0) +#define IOB_QEMPTY(q) ((q)->head == NULL) /**************************************************************************** * Public Types