diff --git a/sys/auto_init/netif/auto_init_cc110x.c b/sys/auto_init/netif/auto_init_cc110x.c index 1403c5f7c6..42645c6c84 100644 --- a/sys/auto_init/netif/auto_init_cc110x.c +++ b/sys/auto_init/netif/auto_init_cc110x.c @@ -21,22 +21,37 @@ #ifdef MODULE_CC110X -#include "log.h" #include "cc110x.h" #include "cc1xxx_common.h" #include "cc110x_params.h" +#include "log.h" +#include "msg.h" +#include "net/gnrc/netif/conf.h" /* <- GNRC_NETIF_MSG_QUEUE_SIZE */ #define ENABLE_DEBUG (0) #include "debug.h" +#ifndef CC110X_EXTRA_STACKSIZE +/** + * @brief Additional stack size required by the driver + * + * With increasing of GNRC_NETIF_MSG_QUEUE_SIZE the required stack size + * increases as well. A queue size of 8 messages works with default stack size, + * so we increase the stack by `sizeof(msg_t)` for each additional element + */ +#define CC110X_EXTRA_STACKSIZE ((GNRC_NETIF_MSG_QUEUE_SIZE - 8) * sizeof(msg_t)) +#endif + /** * @brief Calculate the stack size for the MAC layer thread(s) */ -#define CC110X_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + DEBUG_EXTRA_STACKSIZE) +#define CC110X_MAC_STACKSIZE (THREAD_STACKSIZE_DEFAULT + \ + CC110X_EXTRA_STACKSIZE + \ + DEBUG_EXTRA_STACKSIZE) #ifndef CC110X_MAC_PRIO /** * @brief The priority of the MAC layer thread */ -#define CC110X_MAC_PRIO (GNRC_NETIF_PRIO) +#define CC110X_MAC_PRIO (GNRC_NETIF_PRIO) #endif /**